Skip to main content
Configuration

HTTP Server

Different ways to run your RivetKit HTTP server.

Methods of Running Your Server

registry.start()

The simplest way to run your server. Starts a local manager server, serves static files from a public directory, and starts the actor runner:

import { actor, setup } from "rivetkit";

const myActor = actor({ state: {}, actions: {} });
const registry = setup({ use: { myActor } });

registry.start();

Run with npx tsx --watch index.ts (Node.js), bun --watch index.ts (Bun), or deno run --allow-net --allow-read --allow-env --watch index.ts (Deno). The server starts on http://localhost:6420 by default.

With Fetch Handlers

A fetch handler is a function that takes a Request and returns a Response. This is the standard pattern used by Cloudflare Workers, Deno Deploy, Bun, and other modern runtimes.

Use registry.serve() to get a fetch handler:

import { actor, setup } from "rivetkit";

const myActor = actor({ state: {}, actions: {} });
const registry = setup({ use: { myActor } });

export default registry.serve();

To integrate with a router like Hono or Elysia, use registry.handler():

Then run your server:

Explicit HTTP Server

If you need to explicitly start the HTTP server instead of using the fetch handler pattern: