Kaizen Today I Learned by Ville Säävuori

Export Firebase Database to JSON

Even though Goole Firebase documents look and feel like JSON, it’s surprisingly painful to export a database as a plain JSON file. (I assume this is 100% because they want to keep the vendor lock-in.) Not surprisingly there are NPM packages that help. Here’s the fastest and simplest way I managed to export a very small Firebase DB to JSON:

  1. Install node-firestore-import-export: pnpm add -D node-firestore-import-export
  2. Login to Firebase console, go to Project Settings -> Service accounts, and “Generate new private key” -> save it as credentials.json
  3. Export your db: pnpm firestore-export -a credentials.json -b export.json

There’s also firestore-backfire which has similar but more configurable functionality. YMMV.

Tagged with , ,

Published . Last modified .