Registry Configuration
This page documents the configuration options available when setting up a RivetKit registry. The registry configuration is passed to the `setup()` function.
Example Configurations
Basic Setup
import { setup, actor } from "rivetkit";
const myActor = actor({ state: {}, actions: {} });
const registry = setup({
use: { myActor },
});
Connecting to Rivet Engine
import { setup, actor } from "rivetkit";
const myActor = actor({ state: {}, actions: {} });
// Reads from RIVET_ENDPOINT, RIVET_TOKEN, and RIVET_NAMESPACE
const registry = setup({
use: { myActor },
});
import { setup, actor } from "rivetkit";
const myActor = actor({ state: {}, actions: {} });
const registry = setup({
use: { myActor },
endpoint: "https://api.rivet.dev",
token: process.env.RIVET_TOKEN,
namespace: "production",
});
Starting Your App
After configuring your registry, start it:
import { actor, setup } from "rivetkit";
const myActor = actor({ state: {}, actions: {} });
const registry = setup({ use: { myActor } });
registry.start();
import { actor, setup } from "rivetkit";
const myActor = actor({ state: {}, actions: {} });
const registry = setup({ use: { myActor } });
export default registry.serve();
import { Hono } from "hono";
import { actor, setup } from "rivetkit";
const myActor = actor({ state: {}, actions: {} });
const registry = setup({ use: { myActor } });
const app = new Hono();
app.all("/api/rivet/*", (c) => registry.handler(c.req.raw));
export default app;
import { actor, setup } from "rivetkit";
const myActor = actor({ state: {}, actions: {} });
const registry = setup({ use: { myActor } });
registry.startEnvoy();
See Runtime Modes for details on when to use each mode.
Environment Variables
Many configuration options can be set via environment variables. See Environment Variables for a complete reference.
Configuration Reference
Actor definitions. Keys are actor names, values are actor definitions.
Maximum size of incoming WebSocket messages in bytes. Default: 65536
Maximum size of outgoing WebSocket messages in bytes. Default: 1048576
Disable the welcome message on startup. Default: false
Logging configuration.
Log level for RivetKit. Default: 'warn'
Endpoint URL to connect to Rivet Engine. Supports URL auth syntax: https://namespace:token@api.rivet.dev. Can also be set via RIVET_ENDPOINT environment variable.
Authentication token for Rivet Engine. Can also be set via RIVET_TOKEN environment variable.
Namespace to use. Default: 'default'. Can also be set via RIVET_NAMESPACE environment variable.
Additional headers to include in requests to Rivet Engine.
Directory to serve static files from. When set, registry.start() serves static files alongside the actor API.
Base path for the local RivetKit API. Default: '/'
Port to run the local HTTP server on. Default: 6421
Host to bind the local HTTP server to.
Inspector configuration for debugging and development.
Whether to enable the Rivet Inspector. Defaults to true in development mode.
Token used to access the Inspector.
Default RivetKit server endpoint for Rivet Inspector to connect to.
Starts the full Rust engine process locally. Default: false
Version of the local engine package to use. Defaults to the current RivetKit version.
Automatically configure serverless runners in the engine.
Name of the runner pool.
URL of the serverless platform to configure runners.
Headers to include in requests to the serverless platform.
Maximum lifespan of a request in seconds.
Additional metadata to pass to the serverless platform.
Interval in milliseconds between metadata polls from the engine. Defaults to 10000 milliseconds (10 seconds).
Drain runners when a new version is deployed. Defaults to true.
Configuration for serverless deployment mode.
Base path for serverless API routes. Default: '/api/rivet'
The endpoint that clients should connect to. Supports URL auth syntax: https://namespace:token@api.rivet.dev
Token that clients should use when connecting via the public endpoint.
Configuration for envoy mode.
Total number of actor slots available. Default: 100000
Name of this envoy pool. Default: 'default'
Deprecated. Authentication key for the envoy.
Version number of this envoy. Default: 1
Related
- Actor Configuration: Configure individual actors
- HTTP Server Setup: Set up HTTP routing and middleware
- Architecture: Understand how RivetKit works