Supabase is an open-source Firebase alternative built on Postgres. It provides:
- Authentication (email/password, OAuth)
- PostgreSQL database with Row Level Security (RLS)
- Real-time subscriptions
- Storage and Edge Functions
- Strong relational data with Postgres and SQL
- Built-in auth tightly integrated with RLS for secure data access
- Real-time out of the box for collaborative/live updates
- Open-source and self-hostable, or use hosted service
- You need auth + database quickly without managing servers
- You want SQL and relational constraints
- You need real-time change streams
- MVPs, prototypes, internal tools, and many production apps
- Email/password authentication for signup/login
- A
todos
table secured by RLS (each user sees only their own) - CRUD UI in Next.js App Router with real-time updates
- Create a project at
https://supabase.com
and get yourProject URL
andanon key
. - In the Supabase SQL editor, run
schema.sql
from the repo to create thetodos
table and RLS policies. - Create
.env.local
with:
NEXT_PUBLIC_SUPABASE_URL=your-project-url
NEXT_PUBLIC_SUPABASE_ANON_KEY=your-anon-key
- Install deps and run the app:
npm install
npm run dev
- Visit
/signup
to create an account, then/login
, then/todos
to manage your list.
src/lib/supabaseClient.ts
: Supabase clientsrc/app/signup/page.tsx
: Signup formsrc/app/login/page.tsx
: Login formsrc/app/todos/page.tsx
: Protected CRUD with realtimeschema.sql
: Database schema + RLS policies
- Ensure RLS is enabled and policies are applied; otherwise queries will return empty or errors.
- For OAuth providers or server actions, extend this base as needed.