# Supabase — The Open Source Firebase Alternative > Supabase is an open-source backend platform built on Postgres. It provides a complete backend — database, authentication, real-time subscriptions, storage, edge functions, and vector embeddings — with instant APIs and a generous free tier. ## Install Save in your project root: # Supabase — The Open Source Firebase Alternative ## Quick Use ```bash # Install Supabase CLI npm install -g supabase # Start a local Supabase instance supabase init supabase start # Or use the hosted platform at supabase.com # Create a project and get your API keys ``` ```javascript // Connect from your app import { createClient } from "@supabase/supabase-js" const supabase = createClient( "https://your-project.supabase.co", "your-anon-key" ) // Query data const { data } = await supabase.from("posts").select("*").limit(10) // Auth await supabase.auth.signUp({ email: "user@example.com", password: "secret" }) ``` ## Introduction Supabase provides everything you need to build a modern application backend — all powered by PostgreSQL. Instead of cobbling together separate services for database, auth, storage, and real-time, Supabase bundles them into a single platform with auto-generated APIs, a dashboard, and client libraries for every major framework. With over 101,000 GitHub stars, Supabase has become the leading open-source alternative to Firebase. Unlike Firebase (which uses a proprietary NoSQL database), Supabase is built on PostgreSQL — giving you the full power of SQL, joins, transactions, and extensions like pgvector for AI applications. ## What Supabase Does Supabase wraps PostgreSQL with a suite of tools: PostgREST for instant RESTful APIs, GoTrue for authentication, Realtime for WebSocket subscriptions, Storage for file management, and Edge Functions for serverless compute. Everything works together seamlessly and can be self-hosted. ## Architecture Overview ``` [Client SDKs] JS, Flutter, Swift, Kotlin, Python | [Supabase API Gateway (Kong)] | +-------+-------+-------+-------+ | | | | | [PostgREST] [GoTrue] [Realtime] [Storage] Auto-gen Auth & WebSocket S3-compat REST API OAuth subscript file store from schema providers ions | | | [PostgreSQL] [Edge Functions] Core database Deno-based + pgvector serverless + Row Level Security compute + pg_cron | [Supabase Studio] Web dashboard for tables, SQL, auth, logs ``` ## Self-Hosting & Configuration ```bash # Self-host with Docker git clone https://github.com/supabase/supabase cd supabase/docker cp .env.example .env # Edit .env with your secrets docker compose up -d # Access Studio at http://localhost:8000 ``` ```sql -- Row Level Security example CREATE TABLE posts ( id uuid DEFAULT gen_random_uuid() PRIMARY KEY, user_id uuid REFERENCES auth.users(id), title text NOT NULL, content text, created_at timestamptz DEFAULT now() ); ALTER TABLE posts ENABLE ROW LEVEL SECURITY; CREATE POLICY "Users can read all posts" ON posts FOR SELECT USING (true); CREATE POLICY "Users can insert own posts" ON posts FOR INSERT WITH CHECK (auth.uid() = user_id); ``` ## Key Features - **PostgreSQL** — full SQL database with extensions, joins, and transactions - **Auto-Generated APIs** — RESTful and GraphQL APIs from your schema - **Authentication** — email, OAuth, magic links, phone, and SSO - **Real-Time** — WebSocket subscriptions for database changes - **Storage** — S3-compatible file storage with CDN and transformations - **Edge Functions** — serverless Deno functions at the edge - **Vector Embeddings** — pgvector extension for AI/RAG applications - **Row Level Security** — fine-grained access control at the database level ## Comparison with Similar Tools | Feature | Supabase | Firebase | PocketBase | Appwrite | Nhost | |---|---|---|---|---|---| | Database | PostgreSQL | Firestore (NoSQL) | SQLite | MariaDB | PostgreSQL | | Self-Hosted | Yes | No | Yes | Yes | Yes | | SQL Support | Full | No | Limited | No | Full | | Real-Time | Yes | Yes | Yes | Yes | Yes | | Auth | Built-in | Built-in | Built-in | Built-in | Built-in | | Edge Functions | Deno | Cloud Functions | N/A | Cloud Functions | Serverless | | Vector/AI | pgvector | Via extension | No | No | pgvector | | Free Tier | Generous | Limited | Self-host | Self-host | Limited | ## FAQ **Q: Can I migrate from Firebase to Supabase?** A: Yes. Supabase provides migration tools for Firestore data and Firebase Auth users. The main shift is from NoSQL document model to SQL relational model. **Q: Is Supabase production-ready?** A: Yes. Supabase hosts thousands of production applications. The hosted platform provides automated backups, monitoring, and scalability. Large companies use it in production. **Q: How does pricing compare to Firebase?** A: Supabase offers a more generous free tier (500MB database, 1GB storage, 50K monthly active users). Paid plans are based on compute and storage, not per-operation pricing like Firestore. **Q: Can I use Supabase for AI applications?** A: Yes. Enable the pgvector extension for vector embeddings, use Edge Functions for AI workflows, and leverage the REST API for LLM tool integration. ## Sources - GitHub: https://github.com/supabase/supabase - Documentation: https://supabase.com/docs - Website: https://supabase.com - Created by Paul Copplestone and Ant Wilson - License: Apache-2.0 --- Source: https://tokrepo.com/en/workflows/3487159f-3701-11f1-9bc6-00163e2b0d79 Author: AI Open Source