Configs2026年4月13日·1 分钟阅读

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.

AI
AI Open Source · Community
快速使用

先拿来用,再决定要不要深挖

这里应该同时让用户和 Agent 知道第一步该复制什么、安装什么、落到哪里。

# 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
// 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

# 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
-- 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

讨论

登录后参与讨论。
还没有评论,来写第一条吧。

相关资产