Firetool

Home / Features / Backup and restore

Backup and restore

Firestore backup and restore, with scheduled exports

Back up a collection or a whole database to one file on your computer, with subcollections and every value exactly as stored, and, if you choose, the project's Authentication users, security rules and composite indexes. Restore it to the same project or another one, and schedule regular CSV or JSON exports with a SHA-256 checksum for each file.

Why it matters

A copy you can hold before a risky change

Before a migration script, a bulk field rename or a clean-up of old records, you want a copy of the data that you can put back exactly. Firetool makes that copy in a few clicks and keeps it as a plain file you control. Backups, restores and scheduled exports are part of Firetool Pro, which the 30-day trial includes.

Back up

A collection or every collection

Right-click a collection in the sidebar and choose Back up collection…, or right-click a database and choose Back up every collection…. Firetool reads every document and saves one JSON file, named after the project, database, collection and time.

  • Every subcollection, at any depth
  • Subcollections under parent documents that don't exist themselves, which the console shows in italics and a normal query skips
  • Values exactly as Firestore stores them: 64-bit integers, decimals such as 10.0, NaN, timestamps with microseconds, references, geopoints and bytes
  • Each backup is noted in the audit log
The collection menu in Firetool, with Back up collection marked exact, with subcollections

New in 3.0

A whole project in one file

When you back up every collection of a database, Firetool asks what to add to the documents, so one file can rebuild a complete copy, such as a staging project.

  • Authentication users, optionally with password hashes so passwords keep working after a restore
  • Security rules: Firestore for that database, Storage for the default bucket
  • Composite indexes
  • Firetool's settings for it: saved queries, expected schemas and where to look for user data
  • A part the account can't read is noted in the file and skipped; Storage files aren't included

A file with password hashes is as sensitive as the passwords themselves, so keep it safe.

Backing up a database in Firetool: Firestore documents, Authentication users with an option for password hashes, security rules, composite indexes and Firetool settings

Restore

Put it back, here or somewhere else

Right-click the database you want to restore into and choose Restore a backup…, or press Import on any collection and pick the backup file. Documents go back to the same paths they came from, with their subcollections.

  • Another project or database: restore into any database you can open. References that pointed into the backed-up project are pointed at the new one
  • If a document already exists: Replace it with the backed-up version, or Keep it, skip that document
  • Batches of 500, four at a time, with progress as it goes. Stop at any time; Resume continues with only the documents that didn't make it
  • The parts you tick: from a whole-project backup, users are created (existing users are kept, never overwritten), rules are deployed, only missing indexes are made, and settings are added where the project has none. Each part reports what it did
  • Same checks as any change: every part goes through your role, the project rules and the audit log, and a production project asks for its project ID
  • Only the documents you choose: from 4.5.2, Choose documents… in the restore dialog lists the backup's collections; tick some or paste paths, then Preview compares them with the project now. Only the missing and different ones are written, a document changed since the preview is skipped, and each is read back afterwards. From a tab showing an earlier time (Show as of…), tick rows and choose Put these back… to do the same without a backup file. Restore only some documents
  • Asked before replacing: the restore says how many documents already in the target it would replace and how many are new, and asks only then
  • A restore can be undone: from 4.5.1, restoring with Replace keeps a copy of each document it writes over in the audit log, on every project (unless the policy keeps no copies), so Undo… in Tasks, or Undo this operation… in the audit log, puts the target back as it was and removes what the restore added. Undo an operation

From the terminal, firetool restore puts a backup's documents back with references pointed at the target, and --with users,rules,indexes (or --with all) restores those parts of a whole-project backup too: existing users are kept, only missing indexes are made, and the rules are replaced only when they differ. --dry-run says what each part would do, and the whole restore is one operation you can undo. --only orders,users/alice restores only those collections and documents, and --preview compares them with the project and writes nothing. The firetool command

From Firetool 4.1, a backup runs in the background in Tasks and is written to the file as it's read, and a restore reads the file as it goes, so the size of the data isn't limited by your computer's memory. A backup can be paused and resumed, even after Firetool closes, and every read is pinned to the moment it started, taken from Firestore's own clock, so the file is one moment in time and holds every save made before you pressed Back up. Firestore keeps that moment for an hour; big collections are read in several ranges at once to finish well within it, and Tasks says so if a backup still runs longer. For databases too big to download, Google's managed export, described below, can be started from Firetool.

On a schedule

Scheduled exports that run while Firetool is closed

Open Tools → Scheduled exports (Ctrl+Shift+E) and choose New scheduled export, or set up a query and choose Schedule this export… from its Export menu.

SettingChoices
How oftenHourly, daily at a time, or weekly on a day and time
WhatA collection in a project and database, with optional filters
FormatCSV (Excel), with nested fields flattened or not, or JSON
Save files inA folder you choose; by default Firetool exports in your Documents folder
Keep files forA number of days (90 to start with), or 0 to keep them forever

Each run writes the export, a .sha256 file with its checksum next to it, and an audit-log entry. You can check later that a file hasn't changed since it was written. The schedule is handed to your system's own scheduler: Windows Task Scheduler, launchd on macOS, or cron on Linux. It starts Firetool in the background at the chosen time, so the computer has to be on and you have to be signed in. The Scheduled exports tab shows each schedule's last run, and has Run now, Pause and Delete.

Scheduled exports are CSV or JSON exports of one collection or query, the same as the Export button makes. They are not backup files: they don't include subcollections, and Restore a backup can't read them, though a JSON export can be imported again.

Safety net

Copies in the audit log

Apart from backups, Firetool keeps a copy of a document before it changes in some cases, and the audit log can put it back. By default that covers deleted documents, single-document edits and bulk field changes, including originals deleted by a move or rename.

It doesn't cover imports, documents replaced by a copy or a restore, or script updates, unless your policy is set to keep copies of everything that changes. Firebase Authentication users can't be restored this way. It is a safety net, not a backup.

How the audit log works
The Firetool audit log, with edited and deleted documents marked restorable

Google's own tools

How this differs from managed export and PITR

Google Cloud has its own ways to protect Firestore data. They run inside Google Cloud and are the right choice for some jobs; Firetool can start a managed export or import for you, and reads the earlier versions point-in-time recovery keeps.

  • Managed export and import: writes a database to a Cloud Storage bucket, and loads it back, on Google's side, so its size isn't limited by your computer; it needs billing on the project and the role that allows exports and imports. In Firetool, right-click a database and choose Back up with Google… or Restore a Google export…, and follow it in Tasks; gcloud firestore export and import do the same from a terminal.
  • Point-in-time recovery (PITR): when turned on, Firestore keeps earlier versions of your data for up to seven days, so you can read or recover data as it was at a past minute.
  • Firetool backups: a file on your computer, made through the same API reads as any query, which you can open, keep anywhere and restore to any project you can sign in to.

Questions

Backup and restore questions

What does a Firetool backup file contain?

One JSON file in the firetool-backup format: the project, database, collection and time it was made, then every document's path and fields in Firestore's own value format. Because it is plain JSON you can read it in any editor, and it keeps types that a CSV or a simple JSON export would round off. A whole-database backup can also hold the Authentication users, security rules, composite indexes and Firetool settings you chose to add.

Can I copy production into a staging project from a backup?

Yes. Back up every collection of the production database with the users, rules and indexes added, then choose Restore a backup… on the staging project and tick the parts to restore. Users that already exist in staging are kept, rules are deployed, and only missing indexes are created. This needs Pro, and a production target asks for its project ID.

Can I restore only one collection from a database backup?

Yes, from version 4.5.2. In the restore dialog, choose Choose documents…, tick the collection (or paste the paths of the documents you want), and Preview: Firetool compares them with the project now and writes only the ones that are missing or different. A document someone changed after the preview is skipped, not overwritten. From the terminal, firetool restore --only does the same.

How much does a backup cost in Firestore reads?

One read per document, including documents in subcollections. Firetool also asks Firestore, for each document, whether it has subcollections. A restore costs one write per document. Running a backup during quiet hours keeps it out of the way of your users.

Do scheduled exports need Firetool to stay open?

No. Your system's scheduler starts Firetool in the background at the set time, writes the file and its checksum, and closes it. The computer has to be on, and you have to be signed in to it.

New in 2.26

Smaller backups, and a look back in time

Compressed backups

Backups are saved as .json.gz, usually a fraction of the size; Restore opens .json and .json.gz files.

Show as of…

See and restore documents as they were, up to an hour ago, or 7 days when point-in-time recovery is on for the database.

Storage too

Bring back deleted Storage files and older versions from the Storage browser.

Try it on your own data

Free for Windows, macOS and Linux, with every Pro feature for the first 30 days.