All Guides

Supabase Setup

Integrate Supabase, the open-source Firebase alternative, into your project.

Beginner15 min

Setup Steps

1. Create an account at https://supabase.com and start a new project

2. Install the Supabase SDK:

npm install @supabase/supabase-js

3. Create the Supabase client:

javascript
import { createClient } from '@supabase/supabase-js'
const supabase = createClient(
  'https://project.supabase.co',
  'public-anon-key'
)

4. Create a table (Dashboard SQL Editor):

CREATE TABLE posts (
  id SERIAL PRIMARY KEY,
  title TEXT NOT NULL,
  content TEXT,
  created_at TIMESTAMPTZ DEFAULT NOW()
);

5. Insert data:

javascript
const { data, error } = await supabase
  .from('posts')
  .insert({ title: 'First Post', content: 'Content...' })

6. Query data:

javascript
const { data, error } = await supabase
  .from('posts')
  .select('*')
  .order('created_at', { ascending: false })

7. Authentication:

javascript
const { data, error } = await supabase.auth.signUp({
  email: 'user@test.com',
  password: 'password123'
})

8. Add Row Level Security (RLS) policies from the Dashboard