Why Replace Firebase?
Firebase bills you per operation. At small scale, it's free. At medium scale, costs become unpredictable — and at production scale, they can be shocking. A Firebase project processing 50,000 document reads/day, 10,000 auth operations/month, and 50 GB of storage runs $50-200/month depending on patterns. The same workload on a $5/month VPS running Appwrite or PocketBase costs exactly $5/month, regardless of how many reads, writes, or auth operations you perform.
Beyond cost, Firebase locks you into Google's ecosystem. Firestore's data model doesn't export cleanly to standard SQL. Cloud Functions run on Google Cloud only. Firebase Auth doesn't give you user password hashes for migration. Every month on Firebase adds more switching costs.
| Factor | Firebase (Blaze Plan) | Self-Hosted (Appwrite/PocketBase) |
|---|---|---|
| Cost model | Per-operation billing | Fixed server cost |
| Typical monthly cost | $50-200+ at scale | $5-20 (VPS) |
| Auth operations | 10K free, then $0.01-0.06/verification | Unlimited |
| Database reads | 50K free/day, then $0.06/100K | Unlimited |
| Storage | 5 GB free, then $0.026/GB | Your disk capacity |
| Data portability | Difficult (Firestore-specific format) | Standard SQL/SQLite |
| Vendor lock-in | Heavy (Google Cloud ecosystem) | None |
| Offline support | Yes (Firestore SDK) | Depends on implementation |
Best Alternatives
Appwrite — Best Overall Firebase Replacement
Appwrite is the most feature-complete self-hosted Firebase alternative. It matches Firebase's core services nearly one-for-one: authentication (email, OAuth, phone), databases, file storage, serverless functions, real-time subscriptions, and messaging. It provides SDKs for Flutter, React Native, web, iOS, Android, and 10+ server-side languages.
The deployment is substantial — 15-20 Docker containers — but you get a production-ready backend with a polished admin console, API explorer, and built-in user management. If your Firebase project uses auth + Firestore + Cloud Storage + Cloud Functions, Appwrite is the closest drop-in replacement.
[Read our full guide: How to Self-Host Appwrite]
PocketBase — Best Lightweight Alternative
If Appwrite is the "full Firebase," PocketBase is the "Firebase Lite." A single Go binary (~15 MB) that provides authentication, a real-time database (SQLite-backed), file storage, and an admin dashboard. No Docker required — though it runs well in a container.
PocketBase doesn't have serverless functions, but it has an extensible Go framework for custom server-side logic. For small-to-medium projects that need auth + database + file storage without the overhead of managing 15+ containers, PocketBase is dramatically simpler.
[Read our full guide: How to Self-Host PocketBase]
Supabase (Self-Hosted) — Best for PostgreSQL-First Projects
Supabase is "Firebase built on PostgreSQL." The self-hosted version gives you PostgreSQL with real-time subscriptions, PostgREST for instant API generation, GoTrue for authentication, and an S3-compatible storage layer. If your team already uses PostgreSQL and wants a Firebase-like experience without leaving standard SQL, self-hosted Supabase is the bridge.
The trade-off: self-hosted Supabase requires managing multiple services (PostgreSQL, PostgREST, GoTrue, Kong, Studio), and the setup is more complex than Appwrite or PocketBase.
Migration Guide
From Firebase Auth
-
Export user records using the Firebase Admin SDK (
admin.auth().listUsers()) -
Note: Firebase does NOT export password hashes in a usable format by default — you need the
passwordHashandpasswordSaltfields which require a specific scrypt configuration - Import users into your new platform's database, asking users to reset passwords on first login
- Update OAuth providers — reconfigure Google/GitHub/Apple OAuth with new redirect URIs pointing to your self-hosted platform
From Firestore
-
Export Firestore data using
gcloud firestore export(creates files in GCS) - Transform data from Firestore's document/collection model to relational tables — this is the hardest part since Firestore's nested document model doesn't map cleanly to SQL
- Import into Appwrite's database or PocketBase's collections
- Rewrite queries — Firestore queries are different from SQL/REST. Expect to rewrite most data access code.
From Cloud Functions
- Extract function code from your Firebase Functions source
- Adapt to your platform — Appwrite Functions support Node.js, Python, PHP, and more; PocketBase uses Go hooks
- Recreate triggers — Firestore triggers become database webhooks; HTTP functions become API routes
Cost Comparison
| Firebase (Blaze) | Appwrite (Self-Hosted) | PocketBase (Self-Hosted) | |
|---|---|---|---|
| Monthly cost (small app) | $5-20 | $5 (VPS) | $5 (VPS) |
| Monthly cost (medium app) | $50-200 | $5-10 (VPS) | $5 (VPS) |
| Monthly cost (large app) | $200-1,000+ | $20-40 (VPS) | $10-20 (VPS) |
| Cost predictability | Unpredictable | Fixed | Fixed |
| Scales with usage | Yes (bill grows) | Yes (upgrade VPS) | Yes (upgrade VPS) |
| Free tier | Generous | N/A (self-hosted) | N/A (self-hosted) |
What You Give Up
- Firebase's free tier — Firebase is genuinely free for small apps. Self-hosting has a minimum cost (VPS).
- Managed infrastructure — no server maintenance, no updates, no security patches. Firebase handles all of this.
- Firebase Analytics and Crashlytics — deeply integrated mobile analytics. Self-hosted platforms don't include this — use Plausible or Umami for web analytics.
- Firebase Cloud Messaging (FCM) — push notifications. No self-hosted equivalent with the same reach — FCM is the standard for Android notifications.
- Firestore offline sync — Firestore's SDK handles offline-first data sync natively. Self-hosted platforms require you to implement offline caching yourself.
- Google Cloud integrations — BigQuery, Cloud ML, Vertex AI, and other Google Cloud services integrate natively with Firebase. Self-hosted backends require explicit API connections.
- Global CDN and multi-region — Firebase runs on Google's global infrastructure. Your VPS is in one datacenter.
For backend-focused applications (auth, database, storage, functions), the self-hosted alternatives match Firebase's capabilities. The biggest gap is the mobile-specific features — analytics, crash reporting, push notifications, and offline sync.
Frequently Asked Questions
Can PocketBase or Appwrite handle Firebase's real-time database features?
Yes. PocketBase provides real-time subscriptions via Server-Sent Events — subscribe to collection changes and get instant updates. Appwrite uses WebSockets for real-time events. Both deliver sub-second updates for most use cases. The main difference from Firestore: you subscribe per-collection rather than per-document, and there's no built-in offline sync like Firestore's SDK provides.
How do I handle push notifications without Firebase Cloud Messaging?
FCM is the standard for Android push notifications and is free — you can continue using FCM even with a self-hosted backend. For a fully self-hosted notification stack, use ntfy (supports Android push via UnifiedPush) or Gotify. iOS push notifications still require Apple's APNs service regardless of your backend choice.
Is Firestore data exportable to standard SQL?
Not directly. Firestore uses a document/collection model that doesn't map cleanly to relational tables. Export via gcloud firestore export creates binary files in Google Cloud Storage. You'll need a transformation script to convert nested documents to flat SQL tables. Budget 1-2 days for a complex Firestore-to-SQL migration. This is Firebase's strongest lock-in mechanism.
What's the minimum server needed to replace Firebase?
PocketBase: 1 vCPU, 512 MB RAM, 10 GB disk — runs on a $4/month VPS. Appwrite: 2 vCPU, 2 GB RAM, 20 GB disk — needs a $10-12/month VPS due to its multi-container architecture. Self-hosted Supabase: 2 vCPU, 4 GB RAM — needs a $20/month VPS. All three handle thousands of concurrent users at these specs.
Can I use Firebase Auth with a self-hosted backend?
Yes — this is a valid hybrid approach. Keep Firebase Auth for its polished SDKs and social login support, but point your app at a self-hosted backend for database and storage. Firebase Auth issues JWTs that any backend can verify. This gives you the easiest migration path: swap the backend first, then migrate auth later when ready.
How do Firebase costs compare to self-hosting at different scales?
At 1,000 daily users: Firebase is free or near-free, self-hosting costs $5-10/month — Firebase wins. At 10,000 daily users: Firebase costs $30-80/month, self-hosting costs $10-20/month. At 50,000 daily users: Firebase costs $150-500/month, self-hosting costs $20-40/month. The crossover point where self-hosting becomes cheaper is typically around 5,000-10,000 DAU, depending on your read/write patterns.
Does self-hosted Supabase include the Studio dashboard?
Yes, as of recent releases. Run docker compose up with the official Supabase Docker setup and Studio is included. You get the table editor, SQL editor, auth management, and storage browser — similar to the cloud version. Some features like database branching and edge functions have limited self-hosted support, but core Studio functionality works.
Top comments (0)