HotupdaterHot Updater
Storage Plugins

Firebase Storage

Store your Hot Updater bundles in Firebase Cloud Storage.

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 FirebaseStorageConfig {
  projectId: string;               // Firebase project ID
  storageBucket: string;           // Storage bucket name
  credential: admin.credential.Credential;  // Firebase credential
  basePath?: string;               // Optional base path within bucket
}

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
FIREBASE_STORAGE_BUCKET=your-bucket-name

Usage

import { firebaseStorage } 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({
  storage: firebaseStorage({
    projectId: process.env.FIREBASE_PROJECT_ID,
    storageBucket: process.env.FIREBASE_STORAGE_BUCKET,
    credential
  }),
  // ... other config
});

Protocol

gs://

This prefix is stored in the storageUri field in the database.