Follow these steps to set up your database. It's free and takes about 5 minutes.
- Go to supabase.com and sign in.
- Click "New Project".
- Name it
ShareMe, set a password, and click "Create New Project". Wait a minute for it to start.
- On the left sidebar, click the "Table Editor" (table icon).
- Click "Create a new table".
- Name:
snippets. - Uncheck
Enable Row Level Security (RLS)for now (we'll fix this later if needed, or keep it off for a quick MVP). - Add Columns:
id: Typetext, Primary Key:True, Default Value:NULL(we will generate this in the app).content: Typetext.created_at: Typetimestampz, Default:now().
- Click "Save".
To make sure anyone can read/write snippets (it's a public pastebin after all), go to the SQL Editor (icon with >_) on the left:
- Click "New Query".
- Paste this code:
-- Allow everyone to read snippets CREATE POLICY "Allow public read" ON snippets FOR SELECT USING (true); -- Allow everyone to insert snippets CREATE POLICY "Allow public insert" ON snippets FOR INSERT WITH CHECK (true); -- Enable RLS (if you disabled it earlier, run this to keep it secure) ALTER TABLE snippets ENABLE ROW LEVEL SECURITY;
- Click "Run".
- Go to Project Settings (gear icon at the bottom left).
- Click "API".
- Copy these two values:
- Project URL (e.g.,
https://xyz.supabase.co) - API Key (anon/public) (e.g.,
ey...)
- Project URL (e.g.,
- Go to the Database tab (database icon on the left).
- Click Replication.
- Under
Supabase Realtime, click on the number of tables. - Toggle the switch for the
snippetstable to ON.