Skip to content

Commit a0ac16e

Browse files
committed
chore: fix quickstart & update hotsing providers links (#2777)
<!-- Please make sure there is an issue that this PR is correlated to. --> ## Changes <!-- If there are frontend changes, please include screenshots. -->
1 parent 97e7f7e commit a0ac16e

File tree

15 files changed

+623
-214
lines changed

15 files changed

+623
-214
lines changed

site/src/components/Card.tsx

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ interface CardProps extends PropsWithChildren<{ className?: string }> {
77
title?: string;
88
icon?: any;
99
href?: string;
10+
target?: string;
1011
}
1112

1213
export function Card({
@@ -15,6 +16,7 @@ export function Card({
1516
title,
1617
icon,
1718
href,
19+
target,
1820
}: CardProps) {
1921
const content = (
2022
<div
@@ -48,7 +50,7 @@ export function Card({
4850

4951
if (href) {
5052
return (
51-
<Link href={href} className="block group">
53+
<Link href={href} className="block group" target={target}>
5254
{content}
5355
</Link>
5456
);

site/src/components/CollapsibleSidebarItem.tsx

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -85,7 +85,6 @@ export function CollapsibleSidebarItem({
8585
open: { rotateZ: 0 },
8686
closed: { rotateZ: "-90deg" },
8787
}}
88-
initial={hasActiveChild ? "open" : "closed"}
8988
animate={isItemOpen ? "open" : "closed"}
9089
className="ml-2 inline-block flex-shrink-0 opacity-70"
9190
>
@@ -94,7 +93,6 @@ export function CollapsibleSidebarItem({
9493
</button>
9594
<motion.div
9695
className="overflow-hidden"
97-
initial={hasActiveChild ? "open" : "closed"}
9896
variants={{
9997
open: { height: "auto", opacity: 1 },
10098
closed: { height: 0, opacity: 0 },

site/src/components/docs/Hosting.tsx

Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
import { CardGroup, Card } from '@/components/Card'
2+
3+
export function Hosting() {
4+
return (
5+
<>
6+
<p>By default, Rivet stores actor state on the local file system. To scale Rivet in production, follow a guide to deploy a hosting provider or integrate a driver:</p>
7+
8+
<h3>Hosting Providers</h3>
9+
<CardGroup>
10+
<Card title="Railway" href="/docs/hosting-providers/railway">
11+
Deploy Rivet applications with Railway's platform-as-a-service
12+
</Card>
13+
<Card title="Cloudflare Workers" href="/docs/hosting-providers/cloudflare-workers">
14+
Run Rivet actors on Cloudflare's edge computing platform
15+
</Card>
16+
<Card title="Rivet Cloud (Enterprise)" href="/docs/hosting-providers/rivet-cloud">
17+
Managed Rivet hosting with enterprise features and support
18+
</Card>
19+
</CardGroup>
20+
21+
<h3>Drivers</h3>
22+
<CardGroup>
23+
<Card title="Redis" href="/docs/drivers/redis">
24+
High-performance in-memory data store for production workloads
25+
</Card>
26+
<Card title="File System" href="/docs/drivers/file-system">
27+
Simple file-based storage for development and small deployments
28+
</Card>
29+
<Card title="Memory" href="/docs/drivers/memory">
30+
In-memory storage for testing and ephemeral use cases
31+
</Card>
32+
<Card title="Build Your Own" href="/docs/drivers/build-your-own">
33+
Create custom storage drivers for your specific requirements
34+
</Card>
35+
</CardGroup>
36+
</>
37+
)
38+
}
39+

site/src/content/docs/actors/quickstart/backend.mdx

Lines changed: 13 additions & 119 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
import { Hosting } from "@/components/docs/Hosting";
2+
13
# Node.js & Bun Quickstart
24

35
Get started with Rivet Actors in Node.js and Bun
@@ -15,7 +17,7 @@ npm install @rivetkit/actor
1517

1618
Create a simple counter actor:
1719

18-
```ts registry.ts
20+
```ts {{"title":"registry.ts"}}
1921
import { actor, setup } from "@rivetkit/actor";
2022

2123
export const counter = actor({
@@ -43,7 +45,7 @@ Choose your preferred web framework:
4345

4446
<CodeGroup>
4547

46-
```ts Hono
48+
```ts {{"title":"Hono"}}
4749
import { registry } from "./registry";
4850
import { Hono } from "hono";
4951

@@ -68,7 +70,7 @@ app.post("/increment/:name", async (c) => {
6870
serve(app);
6971
```
7072

71-
```ts Express.js
73+
```ts {{"title":"Express.js"}}
7274
import { registry } from "./registry";
7375
import express from "express";
7476

@@ -97,7 +99,7 @@ app.listen(8080, () => {
9799
});
98100
```
99101

100-
```ts Elysia
102+
```ts {{"title":"Elysia"}}
101103
import { registry } from "./registry";
102104
import { Elysia } from "elysia";
103105

@@ -132,11 +134,11 @@ The `/registry` endpoint is automatically mounted by Rivet and is required for c
132134

133135
<CodeGroup>
134136

135-
```sh Node.js
137+
```sh {{"title":"Node.js"}}
136138
npx tsx --watch server.ts
137139
```
138140

139-
```sh Bun
141+
```sh {{"title":"Bun"}}
140142
bun --watch server.ts
141143
```
142144

@@ -152,7 +154,7 @@ Test your counter actor using HTTP requests:
152154

153155
<CodeGroup>
154156

155-
```ts JavaScript
157+
```ts {{"title":"JavaScript"}}
156158
// Increment counter
157159
const response = await fetch("http://localhost:8080/increment/my-counter", {
158160
method: "POST"
@@ -173,115 +175,7 @@ curl -X POST http://localhost:8080/increment/my-counter
173175

174176
<Step title="Deploy">
175177

176-
By default, Rivet stores actor state on the local file system and will not scale in production.
177-
178-
The following providers let you deploy & scale Rivet:
179-
180-
<Tabs>
181-
182-
<Tab title="Redis">
183-
184-
For production with Redis storage, install the Redis driver:
185-
186-
```sh
187-
npm install @rivetkit/redis
188-
```
189-
190-
Then configure the driver:
191-
192-
```ts server.ts
193-
import { registry } from "./registry";
194-
195-
const { client, serve } = registry.createServer({
196-
driver: createRedisDriver()
197-
});
198-
199-
// ... rest of server setup ...
200-
```
201-
202-
Your backend can now be deployed to your cloud provider of choice.
203-
204-
</Tab>
205-
206-
<Tab title="Cloudflare Workers">
207-
208-
Deploy to Cloudflare Workers, install the Cloudflare Workers driver:
209-
210-
```sh
211-
npm install @rivetkit/cloudflare-workers
212-
```
213-
214-
Update your `server.ts` to support Cloudflare Workers:
215-
216-
<CodeGroup>
217-
218-
```ts Hono
219-
import { createServer } from "@rivetkit/cloudflare-workers";
220-
import { Hono } from "hono";
221-
import { registry } from "./registry";
222-
223-
const { client, createHandler } = createServer(registry);
224-
225-
// Setup router
226-
const app = new Hono();
227-
228-
// ... etc ...
229-
230-
const { handler, ActorHandler } = createHandler(app);
231-
232-
export { handler as default, ActorHandler };
233-
```
234-
235-
```ts No Router
236-
import { createServerHandler } from "@rivetkit/cloudflare-workers";
237-
import { registry } from "./registry";
238-
239-
const { handler, ActorHandler } = createServerHandler(registry);
240-
export { handler as default, ActorHandler };
241-
```
242-
243-
</CodeGroup>
244-
245-
Update your configuration file to support `ACTOR_DO` and `ACTOR_KV` bindings:
246-
247-
```json wrangler.json
248-
{
249-
"name": "my-rivetkit-app",
250-
"main": "src/index.ts",
251-
"compatibility_date": "2025-01-20",
252-
"compatibility_flags": ["nodejs_compat"],
253-
"migrations": [
254-
{
255-
"tag": "v1",
256-
"new_classes": ["ActorHandler"]
257-
}
258-
],
259-
"durable_objects": {
260-
"bindings": [
261-
{
262-
"name": "ACTOR_DO",
263-
"class_name": "ActorHandler"
264-
}
265-
]
266-
},
267-
"kv_namespaces": [
268-
{
269-
"binding": "ACTOR_KV",
270-
"id": "your_namespace_id"
271-
}
272-
]
273-
}
274-
```
275-
276-
Finally, deploy:
277-
278-
```sh
279-
wrangler deploy
280-
```
281-
282-
</Tab>
283-
284-
</Tabs>
178+
<Hosting />
285179

286180
</Step>
287181

@@ -297,7 +191,7 @@ Create a type-safe client to connect from your frontend:
297191

298192
<Tab title="JavaScript">
299193

300-
```ts
194+
```ts {{"title":"client.ts"}}
301195
import { createClient } from "@rivetkit/actor/client";
302196
import type { registry } from "./registry";
303197

@@ -331,7 +225,7 @@ See the [JavaScript client documentation](/clients/javascript) for more informat
331225

332226
<Tab title="React">
333227

334-
```tsx
228+
```tsx {{"title":"Counter.tsx"}}
335229
import { useState } from "react";
336230
import { createClient, createRivetKit } from "@rivetkit/react";
337231
import type { registry } from "./registry";
@@ -370,7 +264,7 @@ See the [React documentation](/clients/react) for more information.
370264

371265
<Tab title="Rust">
372266

373-
```rust
267+
```rust {{"title":"main.rs"}}
374268
use rivetkit_client::{Client, EncodingKind, GetOrCreateOptions, TransportKind};
375269
use serde_json::json;
376270

0 commit comments

Comments
 (0)