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():
To integrate with a router like Hono or Elysia, use registry.handler():
Then run your server:
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:
Using Hono with @hono/node-server:
Using @whatwg-node/server to adapt the fetch handler to Node’s HTTP server:
Using Bun’s native server:
Using Deno’s native server: