Supabase setup takes about fifteen minutes if you know which buttons matter and which defaults will bite you later. This guide walks you through the full Supabase setup — creating a project, building your first Postgres table, locking it down with Row Level Security, wiring up auth and file storage, and moving to a proper local workflow with the Supabase CLI. Everything here was verified against the official Supabase docs and pricing page on 21 November 2026.
Supabase is an open-source Firebase alternative built on Postgres. One project gives you a database, authentication, file storage, realtime subscriptions, and Edge Functions, all reachable through a TypeScript SDK. You can start on the free tier, and because the whole stack is open source, you can self-host it later or take your Postgres data with you. That exit path is the main reason developers pick it over a proprietary backend-as-a-service.
What you get with a Supabase project
A Supabase project is not just a database. Here is what ships inside one project, and what each piece replaces:
- Postgres database — a real Postgres instance, not a wrapper. You can run any SQL, add extensions like pgvector, and connect with any Postgres client.
- Data API — every table is instantly available as a REST API (via PostgREST) and, with the client library, as a type-safe query builder.
- Auth — email/password, magic links, OAuth providers, and phone auth, with user data stored in the
auth.userstable. - Storage — S3-compatible file buckets with the same Row Level Security model as the database.
- Realtime — Postgres changes broadcast over websockets, so your UI updates when a row changes.
- Edge Functions — Deno-based TypeScript functions that run close to your users for webhooks, scheduled jobs, and anything the client should not do.
- Studio — the dashboard: a table editor, SQL editor, auth manager, and storage browser in one place.
Supabase free tier limits (verified November 2026)
Before you build anything, know what the free tier actually gives you. These numbers come from Supabase’s pricing page, checked 21 November 2026:
| Resource | Free plan | Pro plan ($25/month) |
|---|---|---|
| Active projects | 2 | Unlimited |
| Database storage | 500 MB | 8 GB included |
| File storage | 1 GB | 100 GB included |
| Egress | 5 GB/month | 250 GB included |
| Monthly active users | 50,000 | 100,000 |
| Edge Function invocations | 500,000/month | 2,000,000/month |
| Realtime connections | 200 concurrent | 500 concurrent |
| Project pausing | Pauses after 1 week idle | Never |
The limit that catches people out is the pause rule. A free project with no database activity for seven days is paused, and it stays down until you restore it from the dashboard — Supabase emails a warning about a week before, and you can restore a paused project for up to a year. Two active projects is the other quiet limit: one production project and one staging project fill the free plan by themselves. The free tier is genuinely enough to launch something real, but the moment your app has actual users, the $25 Pro plan is the honest price of staying online.
Step 1: Create your Supabase project
Go to supabase.com/dashboard, sign in with GitHub, and click New project. Pick an organisation, give the project a name, and set a strong database password — save it somewhere safe, because you will need it to connect directly to Postgres later. Choose the region closest to your users; you cannot move a project to another region afterwards.
Project creation takes about two minutes while Supabase provisions the database and services. When it is ready, open Project Settings → API (in newer dashboards this is the Connect panel) and copy two values:
- Project URL — something like
https://abcdefghijklm.supabase.co - Publishable key — the public key your frontend uses. Older tutorials call this the anon key; it is the same thing under the current name.
You will also see a secret key (formerly the service_role key). It bypasses Row Level Security entirely. Treat it like a database password: server-side only, never in frontend code, never committed to git.
Step 2: Create your first table
Open the Table Editor and create a table called todos with these columns: id (uuid, primary key, default gen_random_uuid()), user_id (uuid), title (text), is_complete (boolean, default false), and created_at (timestamptz, default now()). Or run the same thing in the SQL Editor:
create table public.todos (
id uuid primary key default gen_random_uuid(),
user_id uuid references auth.users not null,
title text not null,
is_complete boolean default false,
created_at timestamptz default now()
);
Referencing auth.users ties every todo to a real authenticated user, which is what makes the security policies in the next step work. Use the SQL Editor for anything beyond a simple table — it is faster, it is versionable, and it is how you will work once the CLI is in play.
Step 3: Turn on Row Level Security before you write any app code
This is the step most tutorials rush past, and it is the one that matters most. Supabase enables Row Level Security on tables you create through the dashboard, but a table with RLS enabled and no policies denies everyone — including your own app. A table with RLS disabled is readable by anyone holding your publishable key. Neither failure is obvious until it is embarrassing, so set your policies now:
-- RLS on, then explicit policies for each operation
alter table public.todos enable row level security;
create policy "Anyone can read todos"
on public.todos for select
using (true);
create policy "Users can insert their own todos"
on public.todos for insert
with check (auth.uid() = user_id);
create policy "Users can update their own todos"
on public.todos for update
using (auth.uid() = user_id);
create policy "Users can delete their own todos"
on public.todos for delete
using (auth.uid() = user_id);
auth.uid() returns the id of the currently signed-in user, straight from their JWT. The insert policy means a user can only create rows stamped with their own id; the update and delete policies mean they can only touch their own rows. Test this before you ship: sign in as one user in an incognito window and confirm you cannot see another user’s rows. If your app ever shows an empty list where data should be, a missing policy is the first thing to check — the query succeeds, it just returns nothing.
Step 4: Install the JavaScript client and connect
Install the client library in your app:
npm install @supabase/supabase-js
Create a client file and read the credentials from environment variables, never hardcode them:
// lib/supabase.ts
import { createClient } from '@supabase/supabase-js'
const supabaseUrl = process.env.NEXT_PUBLIC_SUPABASE_URL!
const supabasePublishableKey = process.env.NEXT_PUBLIC_SUPABASE_PUBLISHABLE_KEY!
export const supabase = createClient(supabaseUrl, supabasePublishableKey)
Add both values to .env.local. The NEXT_PUBLIC_ prefix is correct here: the URL and publishable key are designed to be public — the security lives in your RLS policies, not in hiding the key. The secret key must never carry that prefix and must never appear in a .env.local that ships to the browser.
If you are building with Next.js, use the official template instead of wiring this by hand: npx create-next-app@latest --example with-supabase scaffolds cookie-based auth with the @supabase/ssr package, which provides separate browser and server clients. The browser client cannot read server-only cookies and the server client cannot run in the browser, so keeping them separate is not optional — it is how auth survives page refreshes and Server Components.
Step 5: Query your data
Every client call returns { data, error }. Check error first — Supabase does not throw, so an unchecked error fails silently and your UI renders an empty state that looks like a bug in your code:
// Read all todos, newest first
const { data, error } = await supabase
.from('todos')
.select('*')
.order('created_at', { ascending: false })
// Insert one row
const { error: insertError } = await supabase
.from('todos')
.insert({ user_id: user.id, title: 'Ship the Supabase setup post' })
// Update and delete
await supabase.from('todos').update({ is_complete: true }).eq('id', todoId)
await supabase.from('todos').delete().eq('id', todoId)
The query builder maps closely to SQL: .eq(), .neq(), .gt(), .like(), .in(), and .range() for pagination cover most of what you will write day to day. For joins, use the embedded-resource syntax — .select('*, profiles(username)') pulls the related profile row in one request instead of an N+1 loop.
Step 6: Add authentication
Email and password auth is three calls. Sign up creates the user and sends a confirmation email; sign in returns a session the client stores and refreshes automatically:
// Sign up
const { data, error } = await supabase.auth.signUp({
email: 'you@example.com',
password: 'a-strong-password',
})
// Sign in
const { data, error } = await supabase.auth.signInWithPassword({
email: 'you@example.com',
password: 'a-strong-password',
})
// Get the current user anywhere
const { data: { user } } = await supabase.auth.getUser()
// Sign out
await supabase.auth.signOut()
For social login, enable the provider under Authentication → Providers — Google is the usual first one — then call supabase.auth.signInWithOAuth({ provider: 'google' }). You will need to register your Supabase callback URL in the Google Cloud Console; the Supabase docs show the exact redirect URL for your project, so copy it rather than guessing. In development, confirm-email is the most common stumbling block: with email confirmation on, signUp succeeds but the user cannot sign in until they click the link, so for local testing either click the link or temporarily disable confirmation under Authentication → Providers → Email.
Step 7: Add file storage
Create a bucket called avatars under Storage. Buckets are private by default, which is what you want for user uploads — a public bucket serves files to anyone with the URL, so only make a bucket public when the contents are genuinely public, like blog images. Upload from the client:
const { data, error } = await supabase.storage
.from('avatars')
.upload(`public/${user.id}.png`, file)
// Get a URL to display the image
const { data: { publicUrl } } = supabase.storage
.from('avatars')
.getPublicUrl(`public/${user.id}.png`)
Storage uses the same RLS model as tables, with policies on the storage.objects table. A private bucket with no storage policies behaves like a table with no policies: uploads fail with an unhelpful error. Add a policy that lets authenticated users upload to their own folder — (storage.foldername(name))[1] = auth.uid()::text is the standard pattern — before you debug anything else.
Step 8: Add realtime updates
Realtime broadcasts Postgres changes over a websocket channel. Subscribe to a table and your UI updates when any client changes a row:
const channel = supabase
.channel('todos-changes')
.on(
'postgres_changes',
{ event: '*', schema: 'public', table: 'todos' },
(payload) => {
console.log('Change received!', payload)
}
)
.subscribe()
Realtime only fires for tables with RLS enabled and a policy that allows the subscribing user to read the row — the same security model, applied to the websocket. Unsubscribe when the component unmounts (supabase.removeChannel(channel)), or you will leak a connection per navigation. On the free tier you get 200 concurrent connections, which is plenty for a side project and the first thing to watch when a launch goes well.
Step 9: Move to a local workflow with the CLI
Clicking around the dashboard is fine for learning, but it does not scale: dashboard changes are not in git, cannot be reviewed, and cannot be replayed on staging. The Supabase CLI runs the whole stack locally in Docker and turns your schema into migration files:
# Install the CLI (macOS example; see the docs for Linux/Windows)
brew install supabase/tap/supabase
# Initialise Supabase in your project
supabase init
# Start the local stack (Postgres, Studio, Auth, Storage, Realtime)
supabase start
# Make schema changes, then capture them as a migration
supabase db diff -f add_todos_table
# Link to your hosted project and push migrations to it
supabase link --project-ref your-project-ref
supabase db push
supabase start prints the local Studio URL and local API keys — use those for development and keep the hosted project’s keys out of your local setup. Seed data goes in supabase/seed.sql and is applied on every supabase db reset, so a new team member gets a working database with one command. Commit the supabase/migrations folder; it is the history of your database, and reviewing a migration file in a pull request is how schema mistakes get caught before production.
Step 10: Edge Functions for server-side work
Some work does not belong in the client: sending a welcome email, calling a third-party API with a secret, running a scheduled cleanup. Edge Functions are TypeScript functions that run on Deno at the edge:
# Create a function from the template
supabase functions new hello-world
# Test it locally (runs at localhost:54321/functions/v1/hello-world)
supabase start
# Deploy it to Supabase's edge network
supabase functions deploy hello-world
Functions run with the service role available, so they can do what the client cannot — but that also means a bug in a function is a security hole, not a UI glitch. Keep functions small, one job each, and invoke them from the client with supabase.functions.invoke('hello-world', { body: { name: 'World' } }).
7 mistakes every Supabase setup makes once
- Shipping with RLS disabled or policyless. Your publishable key is public by design. Without policies, anyone with it can read and write every row. Enable RLS and write policies before the first deploy, not after the first incident.
- Putting the secret key in frontend code. The secret key bypasses RLS. If it ships in a JavaScript bundle, your policies are decoration. Server-side only, always.
- Committing
.env.local. Add it to.gitignoreon day one. Rotating a leaked publishable key is annoying; rotating a leaked secret key is an incident. - Using one client for browser and server in Next.js. The plain
@supabase/supabase-jsclient cannot manage cookies. Use@supabase/ssrwith separate browser and server clients, or auth will break on refresh. - Forgetting the free-tier pause. A demo that nobody touches for a week goes dark. If the link matters — a portfolio piece, a README demo — keep it active or move it to Pro.
- Editing the hosted database by hand. Dashboard edits bypass your migration history, so staging and production drift apart silently. Make schema changes locally, push them with the CLI.
- No indexes on foreign keys and filtered columns. Supabase creates an index for primary keys, not for your
user_idorcreated_atfilters. Add them in a migration before the table grows, not after queries slow down.
Supabase vs Firebase: which one for your next project?
Firebase is the comparison everyone makes, and the honest answer depends on what you value. Supabase gives you real Postgres — real SQL, real joins, extensions, and a standard database you can take anywhere. Firebase gives you Firestore, a document store with a generous free tier and Google’s infrastructure, but your data model lives in Firebase’s world. If your app needs relational queries, if you want to self-host one day, or if you already think in SQL, Supabase is the better fit. If you need Firebase’s mobile SDKs, Crashlytics, and deep Google Cloud integration, stay there. The setup cost is similar either way; the lock-in is not.
When to upgrade to Pro
Upgrade when one of these becomes true: your project cannot afford to pause, your database passes 500 MB, you need more than two active projects, or you need daily backups and longer log retention. At $25 a month per project (plus usage), Pro is cheap for what it removes — the pause rule alone justifies it for anything with real users. Until then, the free tier is a legitimate place to build and launch.
Your Supabase setup checklist
- Project created in the right region, database password saved
- Tables created, RLS enabled, policies written and tested with two users
- JS client installed, keys in
.env.local, secret key nowhere near the frontend - Auth wired up, email confirmation behaviour understood
- Storage bucket created with policies, not just defaults
- CLI installed, local stack running, first migration committed
- Free-tier limits noted, and a plan for the day the project outgrows them
That is the whole setup. Fifteen minutes of clicking, an hour of wiring it into your app, and you have a backend that scales from a weekend prototype to a production product without a rewrite.
All prices, limits, and CLI commands in this post were verified against the official Supabase documentation and pricing page on 21 November 2026.
Further Reading & References
- Use Supabase with Next.js — Supabase Docs
- Local Development & Migrations — Supabase Docs
- Getting Started with Edge Functions — Supabase Docs
- Supabase Pricing in 2026: What You’ll Actually Pay — MakerKit
- Supabase Pricing: Plans, Free Tier, and Hidden Costs — CloudZero
- Connect Supabase to a Next.js Template (2026) — The Front Kit
- Self-Host Supabase with Docker: What Breaks After Up (2026) — LearnWithHasan
- Self-Host Supabase with Docker: Studio, API Keys and Errors — DEV
Related on HowToShipIt: How to Build REST APIs with FastAPI and Self-Host n8n on a VPS with Docker.



