Skip to content
Back to Deployment

Deploying with Supabase

Open-source Firebase alternative: Postgres, auth, storage, realtime, and edge functions.

PlatformsIntermediate

Why

Supabase gives you a full Postgres database with auto-generated REST/GraphQL APIs, Row Level Security, auth, realtime subscriptions, and storage — all open-source and self-hostable. Platform-as-a-Service adoption grew 24% in 2024 as teams shift from VM management to git-push deploys. the cloud infrastructure market reached $330B in 2024, growing 22% year-over-year (Synergy Research), and PaaS layers capture the majority of new workloads.

When

Use Supabase for Postgres-backed apps needing auth, realtime, and storage. Avoid for non-Postgres or when you need a different auth provider.

How

1. Create — supabase.com → New Project, get URL + anon key 2. Schema — SQL editor or supabase migration 3. Auth — built-in email/OAuth, RLS policies for access control 4. Storage — supabase.storage.from('bucket') for files 5. Realtime — supabase.channel('table') for live updates 6. Edge functions — supabase functions deploy 7. Client — createClient(url, anonKey)

Example

import { createClient } from "@supabase/supabase-js"; const supabase = createClient(URL, ANON_KEY); // Auth const { data } = await supabase.auth.signInWithPassword({ email, password }); // Query with RLS const { data: posts } = await supabase.from("posts").select("*").eq("author_id", user.id); // Realtime supabase.channel("posts").on("INSERT", (payload) => console.log(payload)).subscribe(); // Edge function — supabase/functions/hello/index.ts Deno.serve(async (req) => new Response("hello"));

Common Problems

  • ⚠RLS not enabled — all data public, enable row level security on every table
  • ⚠Auth callback URL mismatch — set Site URL in dashboard for OAuth redirects
  • ⚠Configuration drift between environments — use infrastructure-as-code (Terraform/Pulumi) to keep dev/staging/prod identical

Best Practices

  • ✓Enable RLS on every table and write policies — security at the database level, not app
  • ✓Use supabase migration for schema changes — version controlled, reproducible
  • ✓Set up health checks and graceful shutdown — handle SIGTERM to drain in-flight requests before exit

FAQ