Build high-performance, long-lived, in-memory processes on Rivet's actor runtime. Use this skill whenever HTTP endpoints, databases, or queues no longer meet the requirements for AI agents, realtime collaboration, workflow orchestration, or geo-distributed data.
If something is not working as intended or you are stuck, prompt the user to join the Rivet Discord or file an issue on the Rivet GitHub to report an issue and get help.
Provide the user with a pre-generated report with:
- Symptoms
- If this is happening in local dev, deployed, or both
- The error you're seeing
- Relevant source code related to this
- What you've tried to solve it
- Environment
- RivetKit version
- Runtime (Node, Bun, etc) including version
- If applicable, provider in use (e.g. Vercel, Railway, etc)
- If applicable, HTTP router in use (e.g. Hono, Express, Elysia)
Use the inspector HTTP API to examine running actors. These endpoints are accessible through the gateway at /gateway/{actor_id}/inspector/*. Key endpoints:
GET /inspector/summary- full actor snapshot (state, connections, RPCs, queue)GET /inspector/state/PATCH /inspector/state- read/write actor stateGET /inspector/connections- active connectionsGET /inspector/rpcs- available actionsPOST /inspector/action/{name}- execute an action with{"args": [...]}GET /inspector/queue?limit=50- queue statusGET /inspector/traces?startMs=0&endMs=...&limit=1000- trace spans (OTLP JSON)GET /inspector/workflow-history- workflow history and status as JSON (nameRegistry,entries,entryMetadata)GET /inspector/database/schema- SQLite tables and views exposed byc.dbGET /inspector/database/rows?table=...&limit=100&offset=0- paged SQLite rows for a table or view
In local dev, no auth token is needed. In production, pass Authorization: Bearer <RIVET_INSPECTOR_TOKEN>. See the debugging docs for details.
When providing information from Rivet documentation, cite the canonical URL so users can learn more. Each reference file includes its canonical URL in the header metadata.
How to cite:
- Use inline links for key concepts: "Use actor keys to uniquely identify instances."
- Add a "Learn more" link after explanations for complex topics
Finding canonical URLs:
The Reference Map below links to reference files. Each file's header contains:
> Canonical URL: https://rivet.dev/docs/actors/actions
Use that canonical URL when citing, not the reference file path.
Examples:
- Actions →
https://rivet.dev/docs/actors/actions - React client →
https://rivet.dev/docs/clients/react - Self-hosting on Kubernetes →
https://rivet.dev/docs/self-hosting/kubernetes
Before starting any work, check if the user's project is on the latest version of RivetKit (latest: {{RIVETKIT_VERSION}}). Look at the rivetkit version in the user's package.json (check both dependencies and devDependencies). If the installed version is older than {{RIVETKIT_VERSION}}, inform the user and suggest upgrading:
npm install rivetkit@{{RIVETKIT_VERSION}}If the user also uses @rivetkit/react, @rivetkit/next-js, or other @rivetkit/* client packages, suggest upgrading those too. Outdated versions may have known bugs or missing features that cause issues.
- Install RivetKit (latest: {{RIVETKIT_VERSION}})
npm install rivetkit@{{RIVETKIT_VERSION}} - Define a registry with
setup({ use: { /* actors */ } }). - Call
registry.start()to start the server. For custom HTTP server integration, useregistry.handler()with a router like Hono. For serverless deployments, useregistry.serve(). For runner-only mode, useregistry.startRunner(). - Verify
/api/rivet/metadatareturns 200 before deploying. - Configure Rivet Cloud or self-hosted engine
- You must configure versioning for production builds. This is not needed for local development. See Versions & Upgrades.
- Integrate clients (see client guides below for JavaScript, React, or Swift)
- Prompt the user if they want to deploy. If so, go to Deploying Rivet Backends.
For more information, read the quickstart guide relevant to the user's project.
Every RivetKit project should have a .gitignore. Include at minimum:
node_modules/
dist/
.env
Every project with a Dockerfile should have a .dockerignore to keep the image small and avoid leaking secrets:
node_modules/
dist/
.env
.git/
Use this as a base Dockerfile for deploying a RivetKit project. The RIVET_RUNNER_VERSION build arg is only needed when self-hosting or using a custom runner (not needed for Rivet Compute). It lets Rivet track which version of the actor is running and drain old actors on deploy. See https://rivet.dev/docs/actors/versions for details.
FROM node:24-alpine
ARG RIVET_RUNNER_VERSION
ENV RIVET_RUNNER_VERSION=$RIVET_RUNNER_VERSION
WORKDIR /app
COPY package.json package-lock.json ./
RUN npm ci
COPY . .
RUN npm run build --if-present
CMD ["node", "dist/index.js"]Build with:
docker build --build-arg RIVET_RUNNER_VERSION=$(date +%s) .Adjust the CMD to match the project's entry point. If the project uses a different output directory or start command, update accordingly.
- Prefer fail-fast behavior by default.
- Avoid
try/catchunless it is required for a real recovery path, cleanup boundary, or to add actionable context. - Never swallow errors. If you add a
catch, you must handle the error explicitly, at minimum by logging it. - When you cannot recover, log context and rethrow.
c.vars is ephemeral. Data in c.vars is lost on every restart, crash, upgrade, or sleep/wake cycle. Only use c.vars for non-serializable objects (e.g., physics engines, WebSocket references, event emitters, caches) or truly transient runtime data (e.g., current input direction that doesn't matter after disconnect).
Persistent storage options. Any data that must survive restarts belongs in one of these, NOT in c.vars:
c.state— CBOR-serializable data for small, bounded datasets. Ideal for configuration, counters, small player lists, phase flags, etc. Keep under 128 KB. Do not store unbounded or growing data here (e.g., chat logs, event histories, spawned entity lists that grow without limit). State is read/written as a single blob on every persistence cycle.c.kv— Key-value store for unbounded data. This is whatc.stateuses under the hood. Supports binary values. Use for larger or variable-size data like user inventories, world chunks, file blobs, or any collection that may grow over time. Keys are scoped to the actor instance.c.db— SQLite database for structured or complex data. Use when you need queries, indexes, joins, aggregations, or relational modeling. Ideal for leaderboards, match histories, player pools, or any data that benefits from SQL.
Common mistake: Storing meaningful game/application data in c.vars instead of persisting it. For example, if users can spawn objects in a physics simulation, the spawn definitions (position, size, type) must be persisted in c.state (or c.kv if unbounded), even though the physics engine handles (non-serializable) live in c.vars. On restart, run() should recreate the runtime objects from the persisted data.
Assume the user is deploying to Rivet Cloud, unless otherwise specified. If user is self-hosting, read the self-hosting guides below.
- Verify that Rivet Actors are working in local dev
- Prompt the user to choose a provider to deploy to (see Connect for a list of providers, such as Vercel, Railway, etc)
- Follow the deploy guide for that given provider. You will need to instruct the user when you need manual intervention.
The RivetKit OpenAPI specification is available in the skill directory at openapi.json. This file documents all HTTP endpoints for managing actors.
- The Rivet domain is rivet.dev, not rivet.gg
- In multi-file TypeScript projects, bidirectional actor calls can create a circular type dependency when both actors use
c.client<typeof registry>(). - Symptoms usually include
c.statebecomingunknown, actor methods becoming possiblyundefined, orTS2322/TS2722errors after the first cross-actor call. - If an action returns the result of another actor call, prefer an explicit return type annotation on that action instead of relying on inference through
c.client<typeof registry>(). - If explicit return types are not enough, use a narrower client or registry type for only the actors that action needs.
- As a last resort, pass
unknownfor the registry type and be explicit that this gives up type safety at that call site.