Migrate from Firebase

Leave Firebase for Cloudflare — the document→relational redesign, done honestly.

Firebase gets you live fast, but a Cloudflare-native move is a real redesign: Firestore's denormalized documents become a relational D1 schema, Auth becomes passwordless email-code, Cloud Functions become Workers, and FCM has no native equivalent. The document→relational step is the biggest task — this page names it instead of hiding it.

pnpm create microservices-app@latest my-app --template saas-starter-sveltekit

Local-first · no login · Node ≥ 20 · driven by the firebase-to-microservices agent skill

Concept mapping

How Firebase maps onto Cloudflare-native.

Firebase microservices.sh / Cloudflare Note
Firestore collections / documents D1 tables via Drizzle Denormalized docs → relational schema — the biggest task
Realtime Database (JSON tree) D1, or Durable Objects for live state Pick per access pattern
Security Rules Permission checks at the Worker boundary No DB-enforced rules in D1
Firebase Auth (password, phone, OAuth) Passwordless email-code auth Credentials do not carry over
Cloud Storage R2 buckets
Cloud Functions (triggers, HTTPS) Module events/hooks + Worker routes
FCM push External push provider via a Worker No native equivalent
onSnapshot listeners Durable Objects + WebSocket No drop-in — rebuilt

The migration

Five steps, plan-first and approval-gated.

  1. 01

    Assess the source

    Enumerate collections, subcollections, document shapes, denormalized data, Security Rules, auth providers, Cloud Functions, scheduled jobs, FCM usage, and document counts.

  2. 02

    Pick template & modules

    Use a customer-backed template when documents model people/accounts; add email and payment as needed.

  3. 03

    Model documents as relational schema

    Promote collections to tables, subcollections to child tables with FKs, embedded arrays to join tables; convert Timestamp→epoch, reference→FK, map→JSON text.

  4. 04

    Move the data

    Export with gcloud firestore export, flatten maps and resolve references to FKs, load to local D1 first, verify counts per collection before remote import.

  5. 05

    Cut over auth

    Import Firebase email + uid into the customer table; users re-verify by email code; map Security Rules to explicit Worker checks.

What doesn't port 1:1

The real cost — no surprises.

pnpm create microservices-app@latest my-app --template saas-starter-sveltekit
See the quickstart

Still deciding? Read the evaluation-intent comparison: microservices.sh vs Supabase & BaaS →