Rivet Actors allows you to deploy resilient, stateful services that maintain their state between requests using RivetKit. Use them for websocket servers, game backends, real-time collaboration services, and more.
This guide shows you how to get started quickly with RivetKit. For use cases that require low-level control, see the low-level actors API.
import { registry } from "./registry";import { Hono } from "hono";// Start RivetKit with memory driver (for development)const { client, serve } = registry.createServer();// Setup Hono appconst app = new Hono();// Example API endpointapp.post("/increment/:name", async (c) => { const name = c.req.param("name"); // Get or create actor and call action const counter = client.counter.getOrCreate(name); const newCount = await counter.increment(1); return c.json({ count: newCount });});// Start server with RivetKitserve(app);
Note
The /registry endpoint is automatically mounted by RivetKit and is required for client communication. When using serve() with Hono, this is handled automatically.