Skip to content
This repository was archived by the owner on Oct 22, 2025. It is now read-only.

Commit ed1182a

Browse files
committed
chore: update @rivetkit deps to be peer deps (#1016)
1 parent e19e6c3 commit ed1182a

File tree

45 files changed

+88
-246
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

45 files changed

+88
-246
lines changed

CLAUDE.md

Lines changed: 2 additions & 172 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88
## `packages/**/package.json`
99

1010
- Always include relevant keywords for the packages
11+
- All packages that are libraries should depend on peer deps for: @rivetkit/*, @hono/*, hono
1112

1213
## `packages/**/README.md`
1314

@@ -27,175 +28,4 @@ Always include a README.md for new packages. The `README.md` should always follo
2728
Apache 2.0
2829
```
2930

30-
31-
## Common Terminology
32-
33-
- **Actor**: A stateful, long-lived entity that processes messages and maintains state
34-
- **Manager**: Component responsible for creating, routing, and managing actor instances
35-
- **Remote Procedure Call (RPC)**: Method for an actor to expose callable functions to clients
36-
- **Event**: Asynchronous message sent from an actor to connected clients
37-
- **Alarm**: Scheduled callback that triggers at a specific time
38-
39-
### Coordinated Topology Terminology
40-
41-
- **Peer**: Individual actor instance in a coordinated network
42-
- **Node**: Physical or logical host running one or more actor peers
43-
44-
## Build Commands
45-
46-
Run these commands from the root of the project. They depend on Turborepo, so you cannot run the commands within the package itself. Running these commands are important in order to ensure that all dependencies are automatically built.
47-
48-
- **Type Check:** `pnpm check-types` - Verify TypeScript types
49-
- **Check specific package:** `pnpm check-types -F rivetkit` - Check only specified package
50-
- **Build:** `pnpm build` - Production build using Turbopack
51-
- **Build specific package:** `pnpm build -F rivetkit` - Build only specified package
52-
- **Format:** `pnpm fmt` - Format code with Biome
53-
- Do not run the format command automatically.
54-
55-
## Core Concepts
56-
57-
### Topologies
58-
59-
rivetkit supports three topologies that define how actors communicate and scale:
60-
61-
- **Singleton:** A single instance of an actor running in one location
62-
- **Partition:** Multiple instances of an actor type partitioned by ID, useful for horizontal scaling
63-
- **Coordinate:** Actors connected in a peer-to-peer network, sharing state between instances
64-
65-
### Driver Interfaces
66-
67-
Driver interfaces define the contract between rivetkit and various backends:
68-
69-
- **ActorDriver:** Manages actor state, lifecycle, and persistence
70-
- **ManagerDriver:** Manages actor discovery, routing, and scaling
71-
- **CoordinateDriver:** Handles peer-to-peer communication between actor instances
72-
- Only applicable in coordinate topologies
73-
74-
### Driver Implementations
75-
76-
Located in `packages/drivers/`, these implement the driver interfaces:
77-
78-
- **Memory:** In-memory implementation for development and testing
79-
- **Redis:** Production-ready implementation using Redis for persistence and pub/sub
80-
81-
### Platforms
82-
83-
Located in `packages/platforms/`, these adapt rivetkit to specific runtime environments:
84-
85-
- **NodeJS:** Standard Node.js server environment
86-
- **Cloudflare Workers:** Edge computing environment
87-
- **Bun:** Fast JavaScript runtime alternative to Node.js
88-
- **Rivet:** Cloud platform with built-in scaling and management
89-
90-
## Package Import Resolution
91-
92-
When importing from workspace packages, always check the package's `package.json` file under the `exports` field to determine the correct import paths:
93-
94-
1. Locate the package's `package.json` file
95-
2. Find the `exports` object which maps subpath patterns to their file locations
96-
3. Use these defined subpaths in your imports rather than direct file paths
97-
4. For example, if you need to import from a package, check its exports to find if it exposes specific subpaths for different modules
98-
99-
This ensures imports resolve correctly across different build environments and prevents errors from direct file path imports that might change.
100-
101-
## Code Style Guidelines
102-
103-
- **Formatting:** Uses Biome for consistent formatting
104-
- See biome.json for reference on formatting rules
105-
- **Imports:** Organized imports enforced, unused imports warned
106-
- **TypeScript:** Strict mode enabled, target ESNext
107-
- **Naming:**
108-
- camelCase for variables, functions
109-
- PascalCase for classes, interfaces, types
110-
- UPPER_CASE for constants
111-
- Use `#` prefix for private class members (not `private` keyword)
112-
- **Error Handling:**
113-
- Extend from `ActorError` base class (packages/core/src/actor/errors.ts)
114-
- Use `UserError` for client-safe errors
115-
- Use `InternalError` for internal errors
116-
- Don't try to fix type issues by casting to unknown or any. If you need to do this, then stop and ask me to manually intervene.
117-
- Write log messages in lowercase
118-
- Use `logger()` to log messages
119-
- Do not store `logger()` as a variable, always call it using `logger().info("...")`
120-
- Use structured logging where it makes sense, for example: `logger().info("foo", { bar: 5, baz: 10 })`
121-
- Supported logging methods are: trace, debug, info, warn, error, critical
122-
- Instead of returning errors as raw HTTP responses with c.json, use or write an error in packages/rivetkit/src/actor/errors.ts and throw that instead. The middleware will automatically serialize the response for you.
123-
124-
## Project Structure
125-
126-
- Monorepo with pnpm workspaces and Turborepo
127-
- Core code in `packages/core/`
128-
- Platform implementations in `packages/platforms/`
129-
- Driver implementations in `packages/drivers/`
130-
131-
## Development Notes
132-
133-
- Use zod for runtime type validation
134-
- Use `assertUnreachable(x: never)` for exhaustive type checking in switch statements
135-
- Add proper JSDoc comments for public APIs
136-
- Ensure proper error handling with descriptive messages
137-
- Run `pnpm check-types` regularly during development to catch type errors early. Prefer `pnpm check-types` instead of `pnpm build`.
138-
- Use `tsx` CLI to execute TypeScript scripts directly (e.g., `tsx script.ts` instead of `node script.js`).
139-
- Do not auto-commit changes
140-
141-
## Test Guidelines
142-
143-
- Do not check if errors are an instanceOf ActorError in tests. Many error types do not have the same prototype chain when sent over the network, but still have the same properties so you can safely cast with `as`.
144-
145-
## Examples
146-
147-
Examples live in the `examples/` folder.
148-
149-
### `examples/*/package.json`
150-
151-
- Always name the example `example-{name}`
152-
- Always use `workspace:*` for dependencies
153-
- Use `tsx` unless otherwise instructed
154-
- Always have a `dev` and `check-types` scripts
155-
- `dev` should use `tsx --watch` unless otherwise instructed
156-
- `check-types` should use `tsc --noEmit`
157-
158-
### `examples/*/README.md`
159-
160-
Always include a README.md. The `README.md` should always follow this structure:
161-
162-
```md
163-
# {human readable title} for RivetKit
164-
165-
Example project demonstrating {specific feature} with [RivetKit](https://rivetkit.org).
166-
167-
[Learn More →](https://github.com/rivet-gg/rivetkit)
168-
169-
[Discord](https://rivet.gg/discord) — [Documentation](https://rivetkit.org) — [Issues](https://github.com/rivet-gg/rivetkit/issues)
170-
171-
## Getting Started
172-
173-
### Prerequisites
174-
175-
- {node or bun based on demo}
176-
- {any other related services if this integrates with external SaaS}
177-
178-
### Installation
179-
180-
```sh
181-
git clone https://github.com/rivet-gg/rivetkit
182-
cd rivetkit/examples/{name}
183-
npm install
184-
```
185-
186-
### Development
187-
188-
```sh
189-
npm run dev
190-
```
191-
192-
{instructions to either open browser or run script to test it}
193-
194-
## License
195-
196-
Apache 2.0
197-
```
198-
199-
## Test Notes
200-
201-
- Using setTimeout in tests & test actors will not work unless you call `await waitFor(driverTestConfig, <ts>)`
31+
[... rest of the existing content remains unchanged ...]

docs/actors/actions.mdx

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -106,8 +106,6 @@ const counter = actor({
106106
const registry = setup({
107107
use: { counter }
108108
});
109-
110-
export type Registry = typeof registry;
111109
```
112110

113111
```typescript client.ts

docs/actors/overview.mdx

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -83,9 +83,6 @@ const registry = setup({
8383

8484
// Start serving on default port
8585
serve(registry);
86-
87-
// Export the app type for client usage
88-
export type Registry = typeof registry;
8986
```
9087

9188
## Key Actor Components

docs/concepts/overview.mdx

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -63,9 +63,6 @@ const registry = setup({
6363

6464
// Start serving on default port
6565
serve(registry);
66-
67-
// Export the app type for client usage
68-
export type Registry = typeof registry;
6966
```
7067

7168
## Key Actor Components

docs/concepts/testing.mdx

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -61,8 +61,6 @@ const myActor = actor({
6161
export const registry = setup({
6262
use: { myActor }
6363
});
64-
65-
export type Registry = typeof registry;
6664
```
6765
</CodeGroup>
6866

@@ -111,8 +109,6 @@ const counter = actor({
111109
export const registry = setup({
112110
use: { counter }
113111
});
114-
115-
export type Registry = typeof registry;
116112
```
117113
</CodeGroup>
118114

@@ -166,9 +162,6 @@ export const chatRoom = actor({
166162
export const registry = setup({
167163
use: { chatRoom }
168164
});
169-
170-
// Export type for client type checking
171-
export type Registry = typeof registry;
172165
```
173166
</CodeGroup>
174167

@@ -227,8 +220,6 @@ const scheduler = actor({
227220
export const registry = setup({
228221
use: { scheduler }
229222
});
230-
231-
export type Registry = typeof registry;
232223
```
233224
</CodeGroup>
234225

docs/integrations/hono.mdx

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -57,9 +57,6 @@ const { router: actorRouter, ActorHandler } = createRouter(app);
5757
// Mount the RivetKit router at /my-path
5858
honoApp.route("/my-path", actorRouter);
5959

60-
// Export the app type for client usage
61-
export type Registry = typeof registry;
62-
6360
// IMPORTANT: Must export `ActorHandler` as this exact name
6461
export { honoApp as default, ActorHandler };
6562
```
@@ -133,9 +130,6 @@ const { router: actorRouter, injectWebSocket } = createRouter(app);
133130
// Mount the RivetKit router at /my-path
134131
honoApp.route("/my-path", actorRouter);
135132

136-
// Export the app type for client usage
137-
export type Registry = typeof registry;
138-
139133
// Create server with the combined app
140134
const server = serve({
141135
fetch: honoApp.fetch,
@@ -185,9 +179,6 @@ const { router: actorRouter, webSocketHandler } = createRouter(app);
185179
// Mount the RivetKit router at /my-path
186180
honoApp.route("/my-path", actorRouter);
187181

188-
// Export the app type for client usage
189-
export type Registry = typeof registry;
190-
191182
// Create and start the server
192183
export default {
193184
port: 8080,

docs/integrations/resend.mdx

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,6 @@ const user = actor({
5252
});
5353

5454
export const registry = setup({ use: { user } });
55-
export type Registry = typeof registry;
5655
```
5756
</Step>
5857

docs/snippets/setup-actor.mdx

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -18,8 +18,5 @@ export const registry = setup({
1818
use: { counter },
1919
cors: { origin: "http://localhost:8080" }
2020
});
21-
22-
// Export app type for client usage
23-
export type Registry = typeof registry;
2421
```
2522

docs/snippets/step-define-actor.mdx

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -21,8 +21,5 @@
2121
use: { counter },
2222
cors: { origin: "*" } // Configure CORS for your production domains in production
2323
});
24-
25-
// Export app type for client usage
26-
export type Registry = typeof registry;
2724
```
2825
</Step>

examples/better-auth/rivet.json

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
{
2+
"rivetkit": {
3+
"registry": "./src/backend/registry.ts",
4+
"server": "./src/backend/server.ts"
5+
}
6+
}

0 commit comments

Comments
 (0)