HotupdaterHot Updater
Self Hosting (Custom)Server Frameworks

Elysia

Since v0.22.0+

Build a self-hosted Hot Updater server with Elysia framework.

Installation

Install Elysia and its bearer token plugin.

npm install @hot-updater/server elysia @elysiajs/bearer
npm install @hot-updater/standalone hot-updater --save-dev

Setup and Security

Make sure you've set up your database adapter first (see Database Adapters).

The Hot Updater handler does not include built-in authentication. Always protect bundle management routes with framework middleware before mounting the handler. Update-check routes are usually exposed for React Native clients, but that is a deployment choice:

  • Update check: /hot-updater/app-version/*, /hot-updater/fingerprint/*
  • Optional public diagnostics: /hot-updater/version
  • Protected management API: /hot-updater/api/*

This example uses Elysia middleware to protect /api/* before mounting the Hot Updater handler:

import { Elysia } from "elysia";
import { bearer } from "@elysiajs/bearer"; 
import { hotUpdater } from "./hotUpdater"; 

const managementToken = process.env.HOT_UPDATER_AUTH_TOKEN; 
if (!managementToken) { 
  throw new Error("HOT_UPDATER_AUTH_TOKEN is required"); 
} 

new Elysia()
  .use(bearer()) 
  .onBeforeHandle(({ bearer, request }) => { 
    const pathname = new URL(request.url).pathname; 
    if (pathname === "/hot-updater/api" || pathname.startsWith("/hot-updater/api/")) { 
      if (bearer !== managementToken) { 
        return new Response("Unauthorized", { status: 401 }); 
      } 
    } 
  }) 
  .mount("/hot-updater", hotUpdater.handler) 
  .listen(3000);

Set your auth token in environment variables:

HOT_UPDATER_AUTH_TOKEN=your-secret-auth-token

Configure the CLI to include the auth token when deploying bundles:

hot-updater.config.ts (database excerpt)
import { standaloneRepository } from "@hot-updater/standalone";

const managementToken = process.env.HOT_UPDATER_AUTH_TOKEN;
if (!managementToken) {
  throw new Error("HOT_UPDATER_AUTH_TOKEN is required");
}

const database = standaloneRepository({
  baseUrl: "http://localhost:3000/hot-updater",
  commonHeaders: {
    Authorization: `Bearer ${managementToken}`,
  },
});

Use this value as the database field in hot-updater.config.ts.

API Endpoints

The server automatically creates these endpoints. Bundle management endpoints under /hot-updater/api/* are mounted only when routes.bundles is enabled:

MethodEndpointDescription
GET/hot-updater/versionGet server version
GET/hot-updater/fingerprint/:platform/:fingerprintHash/:channel/:minBundleId/:bundleIdCheck for updates by fingerprint
GET/hot-updater/app-version/:platform/:appVersion/:channel/:minBundleId/:bundleIdCheck for updates by app version
GET/hot-updater/api/bundlesList bundles (query: channel, platform, limit, page, after, before)
GET/hot-updater/api/bundles/:idGet bundle by ID
POST/hot-updater/api/bundlesCreate bundles
PATCH/hot-updater/api/bundles/:idUpdate a bundle
DELETE/hot-updater/api/bundles/:idDelete bundle
GET/hot-updater/api/bundles/channelsList all channels

React Native Setup

Configure your React Native app to connect to this server.

App.tsx
import { HotUpdater } from '@hot-updater/react-native';

export default HotUpdater.wrap({
  baseURL: 'http://localhost:3000/hot-updater', 
  updateStrategy: 'appVersion', // or "fingerprint"
  fallbackComponent: ({ progress, status }) => (
    // ... Custom loading UI
  ),
  onError: error => {
    // ... Error handling
  },
})(App);

On this page