HotupdaterHot Updater
Database Plugins

AWS S3 Database

Store your Hot Updater bundle metadata as JSON files in S3, served via CloudFront CDN.

Installation

npm install @hot-updater/aws --save-dev

Setup

The easiest way to set up your backend is using the init command:

npx hot-updater init

This interactive command will guide you through the setup process. For details on what the init command does, see the AWS documentation.

For manual configuration, use the settings below.

Configuration

interface S3DatabaseConfig {
  region: string;                     // AWS region
  bucketName: string;                 // S3 bucket for metadata
  cloudfrontDistributionId?: string;  // CloudFront distribution ID for cache invalidation
  apiBasePath?: string;               // API path (default: "/api/check-update")
  credentials?: {
    accessKeyId: string;
    secretAccessKey: string;
  };
}

Usage

import { s3Database } from '@hot-updater/aws';
import { defineConfig } from 'hot-updater';

export default defineConfig({
  database: s3Database({
    region: 'us-east-1',
    credentials: {
      accessKeyId: process.env.AWS_ACCESS_KEY_ID,
      secretAccessKey: process.env.AWS_SECRET_ACCESS_KEY
    },
    bucketName: 'my-metadata-bucket',
    cloudfrontDistributionId: process.env.CLOUDFRONT_DISTRIBUTION_ID
  }),
  // ... other config
});

Complete Example

Combined storage and database:

import { s3Storage, s3Database } from '@hot-updater/aws';
import { defineConfig } from 'hot-updater';

export default defineConfig({
  storage: s3Storage({
    region: 'us-east-1',
    credentials: {
      accessKeyId: process.env.AWS_ACCESS_KEY_ID,
      secretAccessKey: process.env.AWS_SECRET_ACCESS_KEY
    },
    bucketName: 'my-bundles-bucket'
  }),
  database: s3Database({
    region: 'us-east-1',
    credentials: {
      accessKeyId: process.env.AWS_ACCESS_KEY_ID,
      secretAccessKey: process.env.AWS_SECRET_ACCESS_KEY
    },
    bucketName: 'my-metadata-bucket',
    cloudfrontDistributionId: process.env.CLOUDFRONT_DISTRIBUTION_ID
  }),
  // ... other config
});

Custom Server Usage

Use s3Database with createHotUpdater for self-hosted servers:

import { s3Database } from "@hot-updater/aws";
import { createHotUpdater } from "@hot-updater/server";

const hotUpdater = createHotUpdater({
  database: s3Database({
    region: process.env.AWS_REGION!,
    credentials: {
      accessKeyId: process.env.AWS_ACCESS_KEY_ID!,
      secretAccessKey: process.env.AWS_SECRET_ACCESS_KEY!,
    },
    bucketName: process.env.AWS_S3_METADATA_BUCKET!,
  }),
  // ... other options
});

For complete server setup guides, see S3 Database Adapter.

CloudFront Cache Invalidation

The cloudfrontDistributionId option enables automatic CloudFront cache invalidation when bundles are updated. This is particularly useful when using Lambda@Edge for request handling.

If omitted, cache invalidation is skipped