HotupdaterHot Updater
Storage Adapters

Firebase Storage

Store your Hot Updater bundles in Firebase Cloud Storage.

Installation

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

For a deployed server, install these packages as runtime dependencies instead of development dependencies.

Setup

For a complete provider deployment, follow the Firebase setup. For an existing bucket or a custom server, use the storage configuration below; you do not need to provision the provider's database and server to use this adapter.

Configuration

import type { AppOptions } from "firebase-admin/app";

interface FirebaseStorageConfig extends AppOptions {
  storageBucket: string; // Storage bucket name
  basePath?: string; // Optional base path within bucket
  cdnUrl?: string; // Optional CDN URL
  signedUrlExpiresIn?: number; // Default: 3600 seconds
}

Environment variables

Use an existing application-default identity when available. Set GOOGLE_APPLICATION_CREDENTIALS only when you need a private credential file; keep the file outside the app bundle and exclude local environment files from Git. A Firebase CLI login alone does not necessarily authenticate the local Admin SDK.

When cdnUrl is omitted, the server needs a service-account identity that can sign download URLs as well as read objects. For keyless signing, enable the IAM Service Account Credentials API and grant the calling identity iam.serviceAccounts.signBlob on the signing service account. A local user ADC session or bucket access alone does not establish that signing access. Follow the Google Cloud signing setup. Using the actual server identity, call getDownloadUrl for an existing object and fetch its returned URL before serving updates.

.env.hotupdater
# Optional: a private credential file when existing ADC is unavailable
# GOOGLE_APPLICATION_CREDENTIALS=/private/path/to/your-service-account-key.json
FIREBASE_PROJECT_ID=your-project-id
FIREBASE_STORAGE_BUCKET=your-bucket-name

Usage

hot-updater.config.ts (excerpt)
import { existsSync } from "node:fs";
import { firebaseStorage } from "@hot-updater/firebase"; 
import { applicationDefault } from "firebase-admin/app";
import { defineConfig } from "hot-updater";

if (existsSync(".env.hotupdater")) {
  process.loadEnvFile(".env.hotupdater");
}

// Reuse the environment's application-default credentials.
const credential = applicationDefault();

export default defineConfig({
  // ... build, database, plugins, and updateStrategy
  storage: firebaseStorage({ 
    projectId: process.env.FIREBASE_PROJECT_ID!, 
    storageBucket: process.env.FIREBASE_STORAGE_BUCKET!, 
    credential, 
  }), 
});

Protocol

gs://bucket/encoded/key

For example, gs://my-bucket/releases/1.0.0/bundle%20ios.zip is stored in the storageUri field. Keys retain their slash hierarchy and encode each segment.

Capabilities

firebaseStorage implements the Web-stream upload and Response read contract, but the current Firebase Admin implementation buffers each complete upload and download in memory. It also implements download URL generation, existence checks, and exact deletion. getDownloadUrl returns a CDN URL when cdnUrl is configured and a Firebase signed URL otherwise.

On this page