HotupdaterHot Updater
Database Plugins

Firestore Database

Store your Hot Updater bundle metadata in Cloud Firestore, Firebase's NoSQL document database.

Installation

npm install @hot-updater/firebase firebase-admin --save-dev

Setup

The easiest way to set up your backend is using the init command:

npx hot-updater init

This interactive command will guide you through the setup process. For details on what the init command does, see the Firebase documentation.

For manual configuration, use the settings below.

Configuration

interface FirebaseDatabaseConfig {
  projectId: string;               // Firebase project ID
  credential: admin.credential.Credential;  // Firebase credential
}

Environment Variables

Set up your Firebase credentials:

.env.hotupdater
# Project Settings > Service Accounts > New Private Key > Download JSON
GOOGLE_APPLICATION_CREDENTIALS=/path/to/your-service-account-key.json
FIREBASE_PROJECT_ID=your-project-id

Usage

import { firebaseDatabase } from '@hot-updater/firebase';
import * as admin from 'firebase-admin';
import { defineConfig } from 'hot-updater';

// https://firebase.google.com/docs/admin/setup?hl=en#initialize_the_sdk_in_non-google_environments
// Check your .env file and add the credentials
// Set the GOOGLE_APPLICATION_CREDENTIALS environment variable to your credentials file path
// Example: GOOGLE_APPLICATION_CREDENTIALS=./firebase-adminsdk-credentials.json
const credential = admin.credential.applicationDefault();

export default defineConfig({
  database: firebaseDatabase({
    projectId: process.env.FIREBASE_PROJECT_ID,
    credential
  }),
  // ... other config
});

Complete Example

Combined storage and database:

import { firebaseStorage, firebaseDatabase } from '@hot-updater/firebase';
import * as admin from 'firebase-admin';
import { defineConfig } from 'hot-updater';

const credential = admin.credential.applicationDefault();

export default defineConfig({
  storage: firebaseStorage({
    projectId: process.env.FIREBASE_PROJECT_ID,
    storageBucket: process.env.FIREBASE_STORAGE_BUCKET,
    credential
  }),
  database: firebaseDatabase({
    projectId: process.env.FIREBASE_PROJECT_ID,
    credential
  }),
  // ... other config
});

Dependencies

Requires firebase-admin as a peer dependency:

npm install firebase-admin --save-dev