npx skills add ...
npx skills add rivet-dev/skills --skill rivetkit-client-javascript
npx skills add rivet-dev/skills --skill rivetkit-client-javascript
RivetKit JavaScript client guidance. Use for browser, Node.js, or Bun clients that connect to Rivet Actors with rivetkit/client, create clients, call actions, or manage connections.
Use this skill when building JavaScript clients (browser, Node.js, or Bun) that connect to Rivet Actors with rivetkit/client.
createClient() and call actor actions.try/catch unless absolutely needed.catch is used, handle the error explicitly, at minimum by logging it.See the backend quickstart guide for getting started.
Use params for static connection parameters. Use getParams when the value can change between connection attempts, such as refreshing a JWT before each .connect() or reconnect.
For actors that implement onRequest or onWebSocket, call them directly:
Keys uniquely identify actor instances. Use compound keys (arrays) for hierarchical addressing:
Don't build keys with string interpolation like "org:${userId}" when userId contains user data. Use arrays instead to prevent key injection attacks.
createClient() automatically reads:
RIVET_ENDPOINT (endpoint)RIVET_NAMESPACERIVET_TOKENRIVET_POOLDefaults to http://localhost:6420 when unset. RivetKit runs on port 6420 by default.
Endpoints support URL auth syntax:
You can also pass the endpoint without auth and provide RIVET_NAMESPACE and RIVET_TOKEN separately. For serverless deployments, use your app's /api/rivet URL. See Endpoints for details.
Requests are normally held at the gateway until the actor is ready to accept traffic. An actor is not ready while it's still starting (before onWake finishes) or while it's in the sleep grace period (running onSleep, waitUntil, and pending disconnects).
Pass skipReadyWait: true on the low-level HTTP and WebSocket APIs to deliver immediately and reach the actor's onRequest / onWebSocket handler in either window:
Requests can still return transient lifecycle or gateway errors. Retry once the actor is available again.
actor.stopping: the actor has fully stopped, i.e. the sleep grace period has ended but it has not yet restarted.guard.actor_stopped_while_waiting: the request reached the actor tunnel, but the actor stopped before the gateway received a response.guard.tunnel_request_aborted: the actor tunnel aborted the request before a response started.guard.tunnel_message_timeout: the gateway dropped the in-flight tunnel request after its tunnel message timeout.guard.tunnel_response_closed: the actor tunnel closed before sending a response.guard.gateway_response_start_timeout: the gateway timed out waiting for the actor response to start.Package: rivetkit
See the RivetKit client overview.
createClient - Create a clientClient - Client typeIf you need more about Rivet Actors, registries, or server-side RivetKit, add the main skill:
Then use the rivetkit skill for backend guidance.