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
{{ message }}
This repository was archived by the owner on Oct 22, 2025. It is now read-only.
@@ -83,26 +85,28 @@ This ensures imports resolve correctly across different build environments and p
83
85
- UPPER_CASE for constants
84
86
- Use `#` prefix for private class members (not `private` keyword)
85
87
-**Error Handling:**
86
-
- Extend from `WorkerError` base class
88
+
- Extend from `WorkerError` base class (packages/core/src/worker/errors.ts)
87
89
- Use `UserError` for client-safe errors
88
90
- Use `InternalError` for internal errors
89
91
- 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.
90
92
- Write log messages in lowercase
91
-
- Instead of returning raw HTTP responses with c.json, use or write an error in packages/rivetkit/src/worker/errors.ts and throw that instead. The middleware will automatically serialize the response for you.
93
+
- Use `logger()` to log messages
94
+
- Do not store `logger()` as a variable, always call it using `logger().info("...")`
95
+
- Use structured logging where it makes sense, for example: `logger().info("foo", { bar: 5, baz: 10 })`
- Instead of returning errors as raw HTTP responses with c.json, use or write an error in packages/rivetkit/src/worker/errors.ts and throw that instead. The middleware will automatically serialize the response for you.
92
98
93
99
## Project Structure
94
100
95
101
- Monorepo with pnpm workspaces and Turborepo
96
-
- Core code in `packages/rivetkit/`
102
+
- Core code in `packages/core/`
97
103
- Platform implementations in `packages/platforms/`
98
104
- Driver implementations in `packages/drivers/`
99
105
100
106
## Development Notes
101
107
102
-
- Prefer classes over factory functions
103
108
- Use zod for runtime type validation
104
109
- Use `assertUnreachable(x: never)` for exhaustive type checking in switch statements
105
-
- Follow existing patterns for P2P networking
106
110
- Add proper JSDoc comments for public APIs
107
111
- Ensure proper error handling with descriptive messages
108
112
- Run `pnpm check-types` regularly during development to catch type errors early. Prefer `pnpm check-types` instead of `pnpm build`.
0 commit comments