HotupdaterHot Updater
Self Hosting (Custom)

CLI Configuration

Since v0.22.0+

Configure your Hot Updater CLI to connect to your self-hosted server.

Overview

Your CLI configuration (hot-updater.config.ts) connects your React Native project to your self-hosted Hot Updater server. This file defines how bundles are built, stored, and tracked.

Basic Configuration

Create a hot-updater.config.ts file in your React Native project root:

hot-updater.config.ts
import { defineConfig } from "@hot-updater/core";
import { bare } from "@hot-updater/bare";
import { s3Storage } from "@hot-updater/aws";
import { standaloneRepository } from "@hot-updater/standalone";

export default defineConfig({
  build: bare(),
  storage: s3Storage({
    region: "auto",
    endpoint: process.env.R2_ENDPOINT,
    credentials: {
      accessKeyId: process.env.R2_ACCESS_KEY_ID!,
      secretAccessKey: process.env.R2_SECRET_ACCESS_KEY!,
    },
    bucketName: process.env.R2_BUCKET_NAME!,
  }),
  database: standaloneRepository({
    baseUrl: "http://localhost:3000/hot-updater",
  }),
});

Critical: Storage Plugin Must Match

The storage plugin in your CLI config must match the storages in your server's createHotUpdater configuration.

CLI uses s3Storage → Server must use s3Storage

Both sides need the same plugin type and configuration to encode/decode storage URIs correctly.

Standalone Repository Configuration

The standaloneRepository plugin connects your CLI to your self-hosted server:

interface StandaloneRepositoryConfig {
  baseUrl: string;                        // Your server URL
  commonHeaders?: Record<string, string>; // Optional headers (e.g., authentication)
  routes?: Routes;                        // Optional custom route configuration
}

Basic Example

database: standaloneRepository({
  baseUrl: "http://localhost:3000/hot-updater",
})

With Authentication

database: standaloneRepository({
  baseUrl: process.env.HOT_UPDATER_SERVER_URL!,
  commonHeaders: {
    "Authorization": `Bearer ${process.env.API_TOKEN}`
  }
})

With Custom Routes

database: standaloneRepository({
  baseUrl: "https://api.example.com",
  routes: {
    upsert: () => ({
      path: "/v1/hot-updater/api/bundles",
      headers: { "X-Custom-Header": "value" }
    }),
    list: () => ({
      path: "/v1/hot-updater/api/bundles"
    }),
    retrieve: (bundleId) => ({
      path: `/v1/hot-updater/api/bundles/${bundleId}`
    }),
    delete: (bundleId) => ({
      path: `/v1/hot-updater/api/bundles/${bundleId}`
    })
  }
})

API Endpoints

Your server must implement these endpoints (when using default routes):

MethodEndpointDescription
POST/hot-updater/api/bundlesCreate or update bundles
GET/hot-updater/api/bundlesList bundles (query: channel, platform, limit, offset)
GET/hot-updater/api/bundles/:idGet bundle by ID
DELETE/hot-updater/api/bundles/:idDelete bundle
GET/hot-updater/api/bundles/channelsList all channels

These endpoints are automatically created when you use @hot-updater/server with database adapters.

Next Steps

Choose your build and storage plugins:

Set up your server: