Supabase is an open-source backend-as-a-service (BaaS) built on top of PostgreSQL. It gives you a database, authentication, file storage, real-time subscriptions, and auto-generated APIs β all without writing backend code.
Think of it as the open-source alternative to Firebase, but with a real relational database instead of a document store.
What you get out of the box
PostgreSQL database β a full relational database with SQL support, joins, indexes, and constraints. Unlike Firebaseβs Firestore, youβre not locked into a proprietary data model.
Authentication β email/password, magic links, OAuth (Google, GitHub, etc.), and phone auth. Supabase handles sessions, JWTs, and user management.
Auto-generated REST API β Supabase reads your database schema and generates a REST API automatically. Create a table, and you immediately have CRUD endpoints.
Real-time subscriptions β listen for database changes in real-time via WebSockets:
const supabase = createClient(url, key);
supabase
.channel('messages')
.on('postgres_changes', { event: 'INSERT', schema: 'public', table: 'messages' },
(payload) => console.log('New message:', payload.new)
)
.subscribe();
File storage β upload and serve files (images, documents, videos) with built-in CDN and image transformations.
Edge Functions β serverless functions written in TypeScript/Deno that run close to your users.
Quick example
import { createClient } from '@supabase/supabase-js';
const supabase = createClient(
'https://your-project.supabase.co',
'your-anon-key'
);
// Read data
const { data: posts } = await supabase
.from('posts')
.select('*')
.order('created_at', { ascending: false })
.limit(10);
// Insert data
await supabase.from('posts').insert({ title: 'Hello', content: 'World' });
// Auth
await supabase.auth.signInWithOAuth({ provider: 'github' });
Supabase vs Firebase
| Supabase | Firebase | |
|---|---|---|
| Database | PostgreSQL (relational) | Firestore (document) |
| Query language | SQL | Proprietary |
| Open source | Yes | No |
| Self-hosting | Yes | No |
| Pricing | Generous free tier | Pay-as-you-go |
| Vendor lock-in | Low (itβs just Postgres) | High |
Supabase wins on data modeling flexibility and portability. Firebase wins on ecosystem maturity and mobile SDKs. For a detailed comparison, see Convex vs Supabase.
When to use Supabase
Good fit:
- Side projects and MVPs that need a backend fast
- Apps with relational data (users, posts, comments, orders)
- Real-time features (chat, notifications, live dashboards)
- Teams that want SQL and donβt want vendor lock-in
Not ideal:
- Apps that need complex server-side logic (youβll outgrow Edge Functions)
- High-write workloads (PostgreSQL has limits compared to purpose-built databases)
- If you need full control over your infrastructure
Self-hosting
Since Supabase is open source, you can run it yourself with Docker:
git clone https://github.com/supabase/supabase
cd supabase/docker
cp .env.example .env
docker compose up
This gives you the full Supabase stack locally β useful for development or if you want to avoid the hosted service.
FAQ
Is Supabase free?
Supabase has a generous free tier that includes 500MB database storage, 1GB file storage, 50,000 monthly active users for auth, and 500MB bandwidth. For most side projects and MVPs, you wonβt need to pay anything until you have real traction.
Can I use Supabase with React Native or Flutter?
Yes, Supabase has official client libraries for React Native, Flutter, Swift, and Kotlin. The real-time subscriptions, auth, and storage APIs all work on mobile exactly as they do on the web, making it a solid choice for cross-platform apps.
What happens if Supabase shuts down?
Since Supabase is built on standard PostgreSQL, your data is never locked in. You can export your database as a regular Postgres dump and move it to any other PostgreSQL host. You can also self-host the entire Supabase stack using Docker if you want full control.
Learn more
- What is an ORM? β how ORMs compare to Supabaseβs approach
- What is a REST API? β the API pattern Supabase generates
- PostgreSQL cheat sheet β SQL reference for your Supabase database
- Docker complete guide β for self-hosting Supabase