Skip to content

AlessandroAnnini/simple-share

Repository files navigation

Simple share

A simple and customisable knowledge sharing system. When publishing a link the open graph metadata are automatically scraped from source. When publishing a post the use can use markdown.

Deploy with Vercel

DEMO

This uses Supabase - the open source Firebase alternative

and Next.js - the React framework for production.

Supabase Next.js Tailwindcss

Getting Started

Make a .env file like this:

NEXT_PUBLIC_SUPABASE_URL=
NEXT_PUBLIC_SUPABASE_ANON_KEY=
NEXT_PUBLIC_WEBSITE_NAME=Your site name
NEXT_PUBLIC_TAGS_PIPE_SEPARATED=tag1|tag2|tag3

You can get SUPABASE_URL and SUPABASE_ANON_KEY from Supabase project API keys page at this url: https://app.supabase.io/project/<your-project-id>/settings/api

then, run the development server:

npm run dev
# or
yarn dev

Open http://localhost:3000 with your browser to see the result.

Supabase scaffolding query

-- Scaffolding

--Create a table for "profiles"
create table profiles (
  id uuid references auth.users not null,
  name text unique,
  updated_at timestamp with time zone,

  primary key (id),
  constraint name_length check (char_length(name) >= 3)
);

alter table profiles enable row level security;

--Create profiles table policies

create policy "Public profiles are viewable by everyone."
  on profiles for select
  using ( true );

create policy "Users can insert their own profile."
  on profiles for insert
  with check ( auth.uid() = id );

create policy "Users can update own profile."
  on profiles for update
  using ( auth.uid() = id );

--Create a table for "posts"
CREATE TABLE posts (
  id bigint generated by default as identity primary key,
  user_id uuid references auth.users not null,
  title text,
  content text,
  type text,
  author_name text,
  metadata json,
  tag text,
  inserted_at timestamp with time zone,
  updated_at timestamp with time zone
);

alter table posts enable row level security;

--Create posts table policies

create policy "Users can create posts." on posts for
    insert with check (auth.uid() = user_id);

create policy "Users can update their own posts." on posts for
    update using (auth.uid() = user_id);

create policy "Users can delete their own posts." on posts for
    delete using (auth.uid() = user_id);

create policy "Posts are public." on posts for
    select using ( true );

About

A simple and customisable knowledge sharing system.

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published