Originally published on SelfHostStack
For years, Firebase was the default backend-as-a-service (BaaS) for web and mobile startups. "Focus on your product, let Google manage the database."
Until you wake up to a surprise invoice because an unindexed Firestore query ran in an infinite useEffect loop.
In this breakdown, we examine why modern developers are fleeing Firebase in favor of Supabase (open-source PostgreSQL powerhouse) and PocketBase (single-binary SQLite speed), complete with Docker Compose templates and production hardware recommendations.
The 3 Inherent Flaws of Firebase
- Vendor Lock-In: Firestore's proprietary NoSQL document format makes complex relational queries painful and migrations nearly impossible without writing custom ETL pipelines.
- Per-Read/Write Pricing Anxiety: Every document read, write, and delete is metered. A simple dashboard refresh with nested collections can trigger thousands of billable operations.
-
No Native Vector AI Support: In the era of AI and LLM embeddings, Firestore lacks native vector indexing (like PostgreSQL's
pgvector).
Option 1: Supabase — The Full PostgreSQL Powerhouse
If your app requires relational data integrity, complex SQL aggregations, foreign keys, row-level security (RLS), and vector search for AI embeddings, Supabase is the gold standard.
Supabase Highlights:
-
True PostgreSQL: Full access to standard SQL, extensions (
pgvector,postgis,pg_trgm), and standard database dumps. - Instant APIs: Generates REST and GraphQL endpoints automatically based on table schemas.
- Realtime WebSockets: Listen to database INSERT/UPDATE/DELETE events in real time.
- S3 Object Storage: Built-in file upload buckets for images and documents.
Recommended Production Specs:
- Hetzner CX32 (4 vCPU, 8GB RAM, 80GB NVMe) — €7.14/month.
- Effortlessly serves thousands of concurrent API requests.
Option 2: PocketBase — The 1-File Wonder for Indie Devs
If Supabase feels too heavy for your lightweight MVP or side project, PocketBase is a revelation.
PocketBase is written in Go and packages an entire BaaS into a single standalone binary (<35MB):
- Embedded SQLite with WAL mode (Write-Ahead Logging) handling 10,000+ reads/sec.
- Real-time subscriptions over Server-Sent Events (SSE).
- Built-in user authentication (OAuth2: Google, GitHub, Apple).
- File storage and admin dashboard UI included out of the box.
- RAM usage: < 40 MB at idle.
PocketBase Docker Compose:
version: '3.8'
services:
pocketbase:
image: ghcr.io/muchobien/pocketbase:latest
container_name: pocketbase
restart: unless-stopped
ports:
- "8090:8090"
volumes:
- ./pb_data:/pb_data
healthcheck:
test: ["CMD", "wget", "--no-verbose", "--tries=1", "--spider", "http://localhost:8090/api/health"]
interval: 10s
timeout: 5s
retries: 3
Run docker compose up -d, navigate to http://your-server-ip:8090/_/, and your backend is live in under 60 seconds.
Cost Comparison: 1 Year Projection
| Metric | Firebase Cloud | Self-Hosted Supabase (VPS) | Self-Hosted PocketBase (VPS) |
|---|---|---|---|
| Database Engine | Proprietary Firestore NoSQL | Pure PostgreSQL 15 | Embedded SQLite WAL |
| 10M DB Operations | ~$18 - $45/mo | $0 (included) | $0 (included) |
| File Storage (100GB) | $2.60/mo + Egress | €3.81/mo (Hetzner Box) | €3.81/mo (Hetzner Box) |
| Fixed Server Cost | $0 base + variable | €7.14/mo | €3.79/mo |
| Total 1-Year Cost | $600 - $2,500+ | ~€85.68 ($92) | ~€45.48 ($49) |
Summary
You don't need to surrender your project's database to proprietary cloud silos. With Supabase and PocketBase, you get faster development speed, zero vendor lock-in, and a predictable monthly bill that never spikes.
Discover full deployment tutorials and 20+ other SaaS alternatives at SelfHostStack.
Top comments (0)