Skip to content

Commit 7aef286

Browse files
committed
chore: update nextjs docs (#2950)
Fixes KIT-288
1 parent 43b7d56 commit 7aef286

File tree

3 files changed

+9
-29
lines changed

3 files changed

+9
-29
lines changed

site/src/content/docs/actors/quickstart/next-js.mdx

Lines changed: 4 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,8 @@ Create a RivetKit client to connect to your actor:
5656
import { createClient, createRivetKit } from "@rivetkit/next-js/client";
5757
import type { registry } from "@/rivet/registry";
5858

59-
const client = createClient<typeof registry>(`${window.location.href}api`, {
59+
const client = createClient<typeof registry>({
60+
endpoint: `${window.location.origin}/api/rivet`,
6061
transport: "sse",
6162
});
6263

@@ -70,22 +71,12 @@ export const { useActor } = createRivetKit(client);
7071

7172
<Step title="Setup Registry API routes">
7273

73-
```ts {{"title":"src/app/api/registry/[...all]/route.ts"}}
74+
```ts {{"title":"src/app/api/rivet/[...all]/route.ts"}}
7475
import { toNextHandler } from "@rivetkit/next-js";
7576
import { registry } from "@/rivet/registry";
7677

77-
const server = registry.start({
78-
// Use the same base path as the client
79-
// This is important for Next.js to route the API calls correctly
80-
basePath: "/api/registry",
81-
studio: {
82-
// Tell RivetKit Studio where to find RivetKit Registry
83-
defaultEndpoint: "http://localhost:3000/api/registry",
84-
},
85-
});
86-
8778
// Export the Next.js handler for the API routes
88-
export const { GET, POST, HEAD, PATCH, OPTIONS } = toNextHandler(server);
79+
export const { GET, POST, HEAD, PATCH, OPTIONS } = toNextHandler(registry);
8980
```
9081

9182
</Step>

site/src/content/docs/clients/next-js.mdx

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,8 @@ Create a RivetKit client to connect to your actor:
3939
import { createClient, createRivetKit } from "@rivetkit/next-js/client";
4040
import type { registry } from "@/rivet/registry";
4141

42-
const client = createClient<typeof registry>(`${window.location.href}api`, {
42+
const client = createClient<typeof registry>({
43+
endpoint: `${window.location.origin}/api/rivet`,
4344
transport: "sse",
4445
});
4546

site/src/content/docs/integrations/next-js.mdx

Lines changed: 3 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -53,22 +53,12 @@ export const registry = setup({
5353

5454
<Step title="Setup Registry API routes">
5555

56-
```ts {{"title":"src/app/api/registry/[...all]/route.ts"}}
56+
```ts {{"title":"src/app/api/rivet/[...all]/route.ts"}}
5757
import { toNextHandler } from "@rivetkit/next-js";
5858
import { registry } from "@/rivet/registry";
5959

60-
const server = registry.start({
61-
// Use the same base path as the client
62-
// This is important for Next.js to route the API calls correctly
63-
basePath: "/api/registry",
64-
studio: {
65-
// Tell RivetKit Studio where to find RivetKit Registry
66-
defaultEndpoint: "http://localhost:3000/api/registry",
67-
},
68-
});
69-
7060
// Export the Next.js handler for the API routes
71-
export const { GET, POST, HEAD, PATCH, OPTIONS } = toNextHandler(server);
61+
export const { GET, POST, HEAD, PATCH, OPTIONS } = toNextHandler(registry);
7262
```
7363

7464
</Step>
@@ -94,9 +84,7 @@ const registry = setup({
9484
use: { counter },
9585
});
9686

97-
const server = registry.start();
98-
99-
export const { GET, POST, HEAD, PATCH, OPTIONS } = toNextHandler(server);
87+
export const { GET, POST, HEAD, PATCH, OPTIONS } = toNextHandler(registry);
10088
```
10189

10290
#### Parameters

0 commit comments

Comments
 (0)