is there any way to have supabase as locally so we can use locally supabase?
Yes! You can run Supabase locally using their official CLI. Here's how:
- Docker Desktop installed and running
- Node.js (or you can use the binary directly)
Via npm:
npm install -g supabaseVia Homebrew (macOS/Linux):
brew install supabase/tap/supabaseVia Scoop (Windows):
scoop bucket add supabase https://github.com/supabase/scoop-bucket.git
scoop install supabase# 1. Initialize Supabase in your project folder
supabase init
# 2. Start local Supabase (Docker must be running)
supabase startAfter supabase start, you'll get local credentials like:
API URL: http://localhost:54321
DB URL: postgresql://postgres:postgres@localhost:54322/postgres
Studio URL: http://localhost:54323
Anon Key: eyJ...
Service Role: eyJ...
| Service | Port | Description |
|---|---|---|
| API (PostgREST) | 54321 | REST API |
| Studio | 54323 | Dashboard UI |
| PostgreSQL | 54322 | Database |
| Auth (GoTrue) | 54321/auth | Auth service |
| Storage | 54321/storage | File storage |
| Inbucket | 54324 | Email testing |
Just swap the URL and keys:
import { createClient } from "@supabase/supabase-js";
const supabase = createClient(
"http://localhost:54321", // local API URL
"your-local-anon-key", // from supabase start output
);supabase stop # Stop all services
supabase status # Check running services & credentials
supabase db reset # Reset DB and re-run migrations
supabase migration new my_migration # Create a new migration
supabase db push # Push local migrations to remote- Studio UI at
http://localhost:54323gives you a full dashboard (table editor, SQL editor, auth users, etc.) - Inbucket at
http://localhost:54324catches all emails locally (great for testing auth flows) - Use
.env.localto switch between local and production keys easily - Add
supabase/to.gitignoreonly for generated files, but commit your migrations folder
This setup is great for development — full parity with the hosted Supabase platform, completely offline.
Verdict: feasible and worth doing. The generic guide above is accurate, but our project needs 4 specific adjustments it doesn't mention. Notes below are from auditing how the app actually wires Supabase.
- Schema exists & is idempotent —
supabase/schema.sqlis safe to re-run, so seeding a local DB is one command. - Env wiring is clean — code reads
NEXT_PUBLIC_SUPABASE_URL+NEXT_PUBLIC_SUPABASE_PUBLISHABLE_KEYin one place (src/utils/supabase/*). Swapping to local = just changing.env.local. - Docker is installed (just needs to be running — it was stopped during audit).
- Supabase CLI is NOT installed yet;
supabase/config.tomland amigrations/folder don't exist yet (supabase inithas not been run).
-
Key naming. Our code uses
NEXT_PUBLIC_SUPABASE_PUBLISHABLE_KEY, butsupabase startprints it asanon key. Same thing locally — paste the localanon keyinto thePUBLISHABLE_KEYvar. No code change needed. -
Schema isn't a migration. We have
schema.sql, notsupabase/migrations/, sosupabase db resetwon't auto-apply it. Either:- Simplest: after
supabase start, run the SQL once via Studio (localhost:54323) orpsql. - Cleaner (recommended):
supabase init, then moveschema.sqlintosupabase/migrations/0001_init.sqlsodb resetrebuilds from scratch.
- Simplest: after
-
OAuth is the real work. Sign-in is GitHub + Google OAuth only (
signInWithOAuthinsrc/components/auth/sign-in-buttons.tsx) — there is no email/password path. Local Supabase needs each provider configured insupabase/config.tomlwith a client id/secret, plus a dev OAuth app whose callback points athttp://127.0.0.1:54321/auth/v1/callback.- Recommendation: for local dev, enable email/magic-link auth (captured by
Inbucket at
localhost:54324) instead of fighting OAuth setup — zero external apps, instant login. OR configure one GitHub dev OAuth app for parity.
- Recommendation: for local dev, enable email/magic-link auth (captured by
Inbucket at
-
Subdomain redirect URLs. We auth across both
localhost:3000andresume.localhost:3000(redirectTo useswindow.location.origin).config.tomlmust allowlist both:site_url = "http://localhost:3000" additional_redirect_urls = [ "http://localhost:3000/**", "http://resume.localhost:3000/**", ]
or the OAuth/magic-link callback breaks.
brew install supabase/tap/supabase # CLI (not installed yet)
# start Docker Desktop first
supabase init # creates config.toml
# move schema.sql -> supabase/migrations/0001_init.sql
supabase start # boots local stack
# copy the printed anon key + URL into .env.local
supabase db reset # applies the migrationThen: edit config.toml for auth (gotchas 3 + 4), and add supabase/.branches
and supabase/.temp to .gitignore.
The only non-trivial piece is auth — steer toward local email/magic-link to keep the dev loop frictionless.