Configuration

HTTP Server

Different ways to run your RivetKit HTTP server.

Methods of Running Your Server

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.

The simplest setup uses registry.serve():

import { registry } from "./registry";

export default registry.serve();
server.ts

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

Then run your server:

npx srvx server.ts
Node.js
bun server.ts
Bun
deno run --allow-net --allow-read --allow-env server.ts
Deno

srvx is a universal server runner for fetch handlers. It compiles TypeScript on-the-fly for Node.js and can be used in production. Bun and Deno support fetch handlers and TypeScript natively.

Explicit HTTP Server

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