HotupdaterHot Updater
Self Hosting (Custom)

Quick Start

Since v0.22.0+

Get started with a self-hosted Hot Updater server in 5 minutes.

Installation

Install all required dependencies at once.

npm install @hot-updater/server @hot-updater/aws 
npm install hono @hono/node-server
npm install kysely better-sqlite3 @types/better-sqlite3 --save-dev

Database Setup

Create the database connection file.

src/kysely.ts
import { Kysely, SqliteDialect } from "kysely";
import Database from "better-sqlite3";

export const db = new Kysely({
  dialect: new SqliteDialect({
    database: new Database("./data/database.db"),
  }),
});

Hot Updater Configuration

Create the Hot Updater instance with your database adapter and storage plugin (see Storage Plugins).

src/hotUpdater.ts
import { createHotUpdater } from "@hot-updater/server";
import { kyselyAdapter } from "@hot-updater/server/adapters/kysely";
import { s3Storage } from "@hot-updater/aws";
import { db } from "./kysely";

export const hotUpdater = createHotUpdater({
  database: kyselyAdapter({ db, provider: "sqlite" }),
  storages: [
    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!,
    }),
  ],
  basePath: "/hot-updater",
});

Server Setup

Create the server entry point.

src/index.ts
import { Hono } from "hono";
import { serve } from "@hono/node-server";
import { hotUpdater } from "./hotUpdater"; 

const app = new Hono();

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

serve({ fetch: app.fetch, port: 3000 }, (info) => {
  console.log(`Server running at http://localhost:${info.port}`);
});

Schema Generation

Generate the database schema.

npx hot-updater db generate src/hotUpdater.ts --yes

Run Server

Start your server.

node src/index.ts

Your Hot Updater server is now running at http://localhost:3000/hot-updater!

CLI Configuration

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

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",
  }),
});

The storage plugin here must match the storages in your server's createHotUpdater configuration. Both use s3Storage in this example.

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);

Next Steps