firebase-github-backup
TypeScript icon, indicating that this package has built-in type declarations

1.0.17 • Public • Published

🔥🗄️ Firebase GitHub Backup

Automagically backup your Firebase Cloud Firestore database to a GitHub repository, with AES-256 encryption. The GitHub Actions workflow runs every week and stores encrypted backups in the ./backups directory as .zip files.

Release CI Backup CI

Getting started

  1. Fork this repository
  2. Add required repository secrets

Backup files will be created weekly, and can be downloaded and manually decrypted for viewing. You can also use the npm run decrypt script to decrypt all stored files. As an example, our production database' backups are available in the ./backups directory of this repository.

⚙️ Configuration

Environment variables

Locally, environment variables are loaded from a .env file. For GitHub Actions, add the following as repository secrets (see Creating and storing encrypted secrets):

  • FIREBASE_SERVICE_ACCOUNT_KEY is the Firebase Service Account Key in JSON format
  • FIREBASE_DATABASE_URL is the Firebase Cloud Firestore database URL, e.g., https://example.firebaseio.com
  • BACKUPS_DIRECTORY is the directory to save backups in, defaults to backups
  • KEY is the key for AES-256 encryption, can be any length since it is hashed
  • INITIALIZATION_VECTOR is the IV for AES-256, can be any length since it is hashed

Deployment

Run the script using ts-node:

npm run run

You can also decrypt all backups in the directory:

npm run decrypt

Compile TypeScript and run Node.js script:

npm run build && npm run start

📄 License

  • Code: MIT © Koj
  • "Firebase" is a trademark of Google LLC
  • "GitHub" is a trademark of GitHub, Inc.

Koj

An open source project by Koj.
Furnish your home in style, for as low as CHF175/month →

Readme

Keywords

Package Sidebar

Install

npm i firebase-github-backup

Weekly Downloads

1

Version

1.0.17

License

MIT

Unpacked Size

33.4 kB

Total Files

6

Last publish

Collaborators

  • kojbot