npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

firestore-backup

v2.4.0

Published

Google Firebase Firestore backup tool

Downloads

25

Readme

firestore-backup

A Google Firebase Firestore backup tool.

codebeat badge Codacy Badge David badge Known Vulnerabilities

Installation

Install using npm.

npm install -g firestore-backup

or yarn

yarn global add firestore-backup

Alternatively download the source.

git clone https://github.com/steadyequipment/node-firestore-backup.git

Retrieving Google Cloud Account Credentials

  1. Visit the Firebase Console
  2. Select your project
  3. Navigate to Project Settings (at the time of writing the gear icon button at the top left of the page).
  4. Navigate to Service Accounts
  5. Click Generate New Private Key

This downloaded json file contains the proper credentials needed for firestore-backup to authenticate.

Usage

Backup:

  • -a, --accountCredentials <path> - Google Cloud account credentials JSON file.
  • -B, --backupPath <path>- Path to store the backup.

Example:

firestore-backup --accountCredentials path/to/credentials/file.json --backupPath /backups/myDatabase

Backup with pretty printing:

  • -P, --prettyPrint - JSON backups done with pretty-printing.

Example:

firestore-backup --accountCredentials path/to/credentials/file.json --backupPath /backups/myDatabase --prettyPrint

Backup from a starting path:

  • -S, --databaseStartPath <path> - The database collection or document path to begin backup.

Example:

firestore-backup --accountCredentials path/to/credentials/file.json --backupPath /backups/myDatabase --databaseStartPath /myCollection/document_3

Limit number of requests:

  • -L, --requestCountLimit <number> - The maximum number of requests to be made in parallel.

Example:

firestore-backup --accountCredentials path/to/credentials/file.json --backupPath /backups/myDatabase --requestCountLimit 2

Exclude top level collections from backup:

  • -E, --excludeCollections <id> - Top level collection id(s) to exclude from backing up.

Note: because of how the command line parsing library works multiple collection ids must be specified as separate parameters.

Example:

firestore-backup --accountCredentials path/to/credentials/file.json --backupPath /backups/myDatabase --excludeCollections myFirstAnnoyingCollection --excludeCollections mySecondAnnoyingCollection

Exclude paths by regex:

  • --excludePattern <regex> - Patterns to match against paths to exclude from the backup. All subpaths of matched paths will also be excluded.

These patterns can support excluding several different sections of trees, e.g.:

  • Exclude top level collection: ^/collectionToIgnore
  • Exclude sub collections of all documents in a collection: ^/organizations/[^/]*/subcollectionToIgnore
  • Exclude sub collections at a given level: ^/[^/]/[^/]/subcollectionToIgnore
  • Exclude a particular document: ^/organizations/organizationToIgnore

Note: when combining excludePattern with databaseStartPath, the patterns are tested against the full path of the document off the root of database (with a leading slash).

Note: because of how the command line parsing library works multiple exclude patterns must be specified as separate parameters.

Example:

firestore-backup --accountCredentials path/to/credentials/file.json --backupPath /backups/myDatabase --excludePattern '^/collectionToIgnore' --excludePattern '^/[^/]*/[^/]*/subcollectionToIgnore'

Fetch documents in batches:

  • --batchSize <number - The maximum number of documents to fetch in a single request.

Example:

firestore-backup --accountCredentials path/to/credentials/file.json --backupPath /backups/myDatabase --batchSize 25

Relax:

That's it! ✨🌈

Contributions

This project has been made much better by it's contributors, feel free to report bugs and make feature requests in the Issue Tracker, fork and create pull requests!