Skip to content
WebBuild

Migrating from Firebase to PostgreSQL: how we do it

Why projects leave Firestore for PostgreSQL, how to design the schema, move data and users and cut over with zero downtime.

Published — 5 min read

Firestore is convenient at the start, but as a project grows you get complex reports, relations between entities and a read bill that is hard to predict. PostgreSQL fixes that: SQL queries, transactions and a predictable server price.

Steps

  1. Export collections and study the real document structure — it almost always differs from the plan.
  2. Design tables, relations and indexes for the app’s actual queries.
  3. Write an idempotent migration script that updates rather than duplicates.
  4. Move files from Firebase Storage to S3 storage.
  5. Reconcile record counts and spot-check content.
  6. Switch the app to the new database; the old one stays available for a week.

Users and login

Firebase Auth accounts move with email and phone. Firebase stores passwords in its own format, so login either keeps working via their hashes or the user signs in once with an email or SMS code.

Data sizeTimePrice
Up to 100k documents1 dayfrom $150
Up to 1M documents2–3 daysfrom $300
Larger, with fileson estimatefrom $500

Read also

Tell us about your task — get a price and deadline

We reply on Telegram, WhatsApp or email, in English, Russian or Georgian.

17 Ilia Chavchavadze Ave, Tbilisi

Where to reply

By sending the form you agree to the privacy policy.