You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: site/src/posts/2025-10-17-rivet-actors-vercel/page.mdx
+46-16Lines changed: 46 additions & 16 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -34,9 +34,33 @@ Similar to Durable Objects, Rivet Actors provide long-lived, stateful actors wit
34
34
35
35
-**No Vendor Lock-In**: Open-source and fully self-hostable.
36
36
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.
Read more about [realtime events](/docs/actors/events/) and the [raw WebSocket handler](/docs/actors/fetch-and-websocket-handler/).
60
+
37
61
## Quick Example: Building an AI Agent with Rivet Actors
38
62
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:
@@ -197,22 +225,24 @@ export function AgentChat() {
197
225
198
226
</CodeGroup>
199
227
200
-
## Why run Rivet on Vercel?
201
228
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
211
230
212
231
1. Sign in to [Rivet Cloud](https://dashboard.rivet.dev) or [self-host Rivet](/docs/self-hosting)
213
232
2. Select _Vercel_
214
233
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/)
215
234
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.
0 commit comments