HotupdaterHot Updater
Self Hosting (Custom)Server Frameworks

Hono

Since v0.22.0+

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

Installation

Install Hono.

npm install hono --save-dev

Setup

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

Import the Hot Updater instance and mount it to your Hono app:

import { Hono } from "hono";
import { hotUpdater } from "./hotUpdater"; 

const app = new Hono();

app.on(["POST", "GET", "DELETE"], "/hot-updater/*", async (c) => { 
  return hotUpdater.handler(c.req.raw); 
}); 

export default app;

API Endpoints

The server automatically creates these endpoints:

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/:version/:channel/:minBundleId/:bundleIdCheck for updates by app version
GET/hot-updater/api/bundlesList bundles (query: channel, platform, limit, offset)
GET/hot-updater/api/bundles/:idGet bundle by ID
POST/hot-updater/api/bundlesCreate or update bundles
DELETE/hot-updater/api/bundles/:idDelete bundle
GET/hot-updater/api/bundles/channelsList all channels

Security

The Hot Updater handler does not include built-in authentication. Protect admin endpoints at the framework level.

Protecting Endpoints

Update endpoints are public for React Native clients. Bundle management endpoints (/api/*) require protection.

import { Hono } from "hono";
import { bearerAuth } from "hono/bearer-auth"; 
import { hotUpdater } from "./hotUpdater";

const app = new Hono();

// Protect /api/* endpoints
app.use("/hot-updater/api/*", bearerAuth({ token: process.env.API_KEY! })); 

app.on(["GET", "POST", "DELETE"], "/hot-updater/*", (c) => {
  return hotUpdater.handler(c.req.raw);
});

export default app;

Set your API key in environment variables:

API_KEY=your-secret-api-key

CLI Configuration

Configure the CLI to include the API key when deploying bundles:

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

export default defineConfig({
  // ...
  database: standaloneRepository({
    baseUrl: "http://localhost:3000/hot-updater",
    commonHeaders: {
      Authorization: `Bearer ${process.env.API_KEY}`,
    },
  }),
});

React Native Setup

Configure your React Native app to connect to this server. Use getUpdateSource with your server URL.

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

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