Skip to content

Commit ae290d1

Browse files
committed
chore(site): tweak launch post
1 parent 32a716f commit ae290d1

File tree

1 file changed

+46
-16
lines changed
  • site/src/posts/2025-10-17-rivet-actors-vercel

1 file changed

+46
-16
lines changed

site/src/posts/2025-10-17-rivet-actors-vercel/page.mdx

Lines changed: 46 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -34,9 +34,33 @@ Similar to Durable Objects, Rivet Actors provide long-lived, stateful actors wit
3434

3535
- **No Vendor Lock-In**: Open-source and fully self-hostable.
3636

37+
## Why Run Rivet With Vercel?
38+
39+
Running Rivet Actors on Vercel provides many benefits:
40+
41+
- **Industry standard runtime**: Runs on Node.js today (with Bun coming soon to Vercel Functions). No proprietary runtime, use the Node APIs and NPM packages you already know.
42+
- **More memory & CPU**: Vercel Functions let you configure memory and vCPU per function (up to 4 GB RAM, 2 vCPU cores). This enables larger PDF processing, multiplayer games, agent context, and heavier compute that would exceed typical isolate caps.
43+
- **Scale to zero with zero cold starts**: Actors scale down when idle to eliminate costs, yet wake instantly on demand with hibernation preserving state for immediate activation.
44+
- **Regions you choose**: Set regions directly to keep actors close to your primary database or within compliance boundaries.
45+
- **Developer experience**: Deploy actors alongside your Next.js app in one place, leverage Vercel's best-in-class observability, and use Rivet's built-in inspector for deep visibility into your actors.
46+
47+
## One More Thing: WebSockets on Vercel Functions
48+
49+
Until today, Vercel Functions have [not supported WebSockets](https://vercel.com/guides/do-vercel-serverless-functions-support-websocket-connections). Rivet now **enables native WebSockets with code running directly in Vercel Functions**, powered by our tunneling technology. This brings the flexibility and power of traditional WebSocket servers like Socket.io to Vercel's fully serverless platform for the first time.
50+
51+
This unlocks use cases like:
52+
53+
- Collaborative documents ([example code](https://github.com/rivet-dev/rivetkit/tree/main/examples/crdt/src/backend/registry.ts))
54+
- Chat rooms ([example code](https://github.com/rivet-dev/rivetkit/tree/main/examples/chat-room/src/backend/registry.ts))
55+
- Local-first sync ([example code](https://github.com/rivet-dev/rivetkit/tree/main/examples/sync/src/backend/registry.ts))
56+
- Multiplayer games ([example code](https://github.com/rivet-dev/rivetkit/tree/main/examples/game/src/backend/registry.ts))
57+
- Agent streams ([example code](https://github.com/rivet-dev/rivetkit/tree/main/examples/ai-agent/src/backend/registry.ts))
58+
59+
Read more about [realtime events](/docs/actors/events/) and the [raw WebSocket handler](/docs/actors/fetch-and-websocket-handler/).
60+
3761
## Quick Example: Building an AI Agent with Rivet Actors
3862

39-
Here's how simple it is to build a stateful AI agent using Rivet Actors on Vercel. This example demonstrates an AI chatbot that maintains conversation history, processes messages with OpenAI, and broadcasts updates to all connected clients in real-time – all without managing databases or WebSocket infrastructure.
63+
A stateful AI chatbot with persistent memory and real-time updates:
4064

4165
<CodeGroup>
4266

@@ -45,7 +69,7 @@ import { actor, setup } from "rivetkit";
4569
import { openai } from "@ai-sdk/openai";
4670
import { generateText, tool } from "ai";
4771
import { z } from "zod";
48-
import { type Message, getWeather } from "./utils";
72+
import { type Message, getWeather } from "../lib/utils";
4973

5074
// Create an actor for every agent
5175
export const aiAgent = actor({
@@ -69,13 +93,13 @@ export const aiAgent = actor({
6993
c.state.messages.push(userMsg);
7094

7195
const { text } = await generateText({
72-
model: openai("gpt-4o"),
96+
model: openai("gpt-4-turbo"),
7397
prompt: userMessage,
7498
messages: c.state.messages,
7599
tools: {
76100
weather: tool({
77101
description: "Get the weather in a location",
78-
parameters: z.object({
102+
inputSchema: z.object({
79103
location: z
80104
.string()
81105
.describe("The location to get the weather for"),
@@ -111,9 +135,13 @@ export const registry = setup({
111135
import { createRivetKit } from "@rivetkit/next-js/client";
112136
import { useEffect, useState } from "react";
113137
import { registry } from "../rivet/registry";
114-
import type { Message } from "../backend/types";
138+
import type { Message } from "../lib/utils";
115139

116-
const { useActor } = createRivetKit<typeof registry>();
140+
const { useActor } = createRivetKit<typeof registry>({
141+
endpoint: "https://api.rivet.dev",
142+
namespace: "xxxx",
143+
token: "xxxx",
144+
});
117145

118146
export function AgentChat() {
119147
// Connect to the actor
@@ -197,22 +225,24 @@ export function AgentChat() {
197225

198226
</CodeGroup>
199227

200-
## Why run Rivet on Vercel?
201228

202-
Running Rivet Actors on Vercel sidesteps several constraints with Cloudflare Durable Objects:
203-
204-
- **Industry standard runtime**: Runs on Node.js today (with Bun coming soon to Vercel Functions). No proprietary runtime, use the Node APIs and NPM packages you already know.
205-
- **More memory & CPU**: Vercel Functions let you configure memory and vCPU per function (up to 4 GB RAM, 2 vCPU cores). This enables larger PDF processing, multiplayer games, agent context, and heavier compute that would exceed typical isolate caps.
206-
- **Developer experience**: Deploy actors alongside your Next.js app in one place, leverage Vercel's best-in-class observability, and use Rivet's built-in inspector for deep visibility into your actors.
207-
- **Regions you choose.** Set regions directly to keep actors close to your primary database or within compliance boundaries.
208-
- **Portability by design.** Your actor logic is built on RivetKit — an open-source library — and runs on industry standard runtimes. If your needs change, you can move between clouds or self-host without rewriting your application.
209-
210-
## Getting started on Vercel
229+
## Getting Started on Vercel
211230

212231
1. Sign in to [Rivet Cloud](https://dashboard.rivet.dev) or [self-host Rivet](/docs/self-hosting)
213232
2. Select _Vercel_
214233
3. Follow instructions to deploy the [Vercel starter template](https://github.com/rivet-dev/template-vercel) or [integrate Rivet into your existing Next.js application](https://www.rivet.dev/docs/actors/quickstart/next-js/)
215234

235+
## FAQ
236+
237+
- **Do Rivet Actors scale to zero?** Yes. Actors run as a Vercel Function invocation. When no actors are active, no Vercel Functions will be running.
238+
- **Do Rivet Actors have coldstarts?** No. Vercel's platform enables Rivet Actors to scale to zero without coldstarts.
239+
- **Do I pay for Vercel Function invocation time for the entire lifespan of my Rivet Actor?** No. Rivet Actors go to sleep when not in use and wake up immediately when activated again.
240+
- **Can Rivet Actors live longer than Vercel Function timeouts?** Yes, actors have a transparent migration system that allows it to migrate between processes in order to live longer than your timeout.
241+
- **How does Rivet make WebSockets work on Vercel?** Rivet's tunneling technology works similar to tools like Ngrok or Tailscale which enables us to achieve advanced routing, including support for WebSockets.
242+
- **Do you support Durable Objects-like WebSocket hibernation?** Not yet. When we do, this will enable Rivet to keep WebSockets open while your actors go to sleep, therefore significantly saving on invocation time for idle sockets (e.g. notifications, dead chats).
243+
- **Can I self-host Rivet and use it with Vercel?** [Yes](/docs/self-hosting).
244+
- **Does Rivet integrate with Vercel's preview deployments?** Not yet. When available, Rivet will automatically provision isolated actor environments for each preview deployment, at no additional cost thanks to scale-to-zero architecture.
245+
216246
## Support
217247

218248
- [GitHub Issues](https://github.com/rivet-dev/rivet/issues)

0 commit comments

Comments
 (0)