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

Commit 43e35aa

Browse files
committed
chore: rename workers -> actors
1 parent 5e205cf commit 43e35aa

File tree

342 files changed

+5484
-4717
lines changed

Some content is hidden

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

342 files changed

+5484
-4717
lines changed

CLAUDE.md

Lines changed: 17 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414
Always include a README.md for new packages. The `README.md` should always follow this structure:
1515

1616
```md
17-
# RivetKit {subname, e.g. library: RivetKit Workers, driver and platform: RivetKit Redis Adapter, RivetKit Cloudflare Workers Adapter}
17+
# RivetKit {subname, e.g. library: RivetKit Actors, driver and platform: RivetKit Redis Adapter, RivetKit Cloudflare Workers Adapter}
1818

1919
_Lightweight Libraries for Backends_
2020

@@ -30,16 +30,16 @@ Always include a README.md for new packages. The `README.md` should always follo
3030

3131
## Common Terminology
3232

33-
- **Worker**: A stateful, long-lived entity that processes messages and maintains state
34-
- **Manager**: Component responsible for creating, routing, and managing worker instances
35-
- **Remote Procedure Call (RPC)**: Method for an worker to expose callable functions to clients
36-
- **Event**: Asynchronous message sent from an worker to connected clients
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
3737
- **Alarm**: Scheduled callback that triggers at a specific time
3838

3939
### Coordinated Topology Terminology
4040

41-
- **Peer**: Individual worker instance in a coordinated network
42-
- **Node**: Physical or logical host running one or more worker peers
41+
- **Peer**: Individual actor instance in a coordinated network
42+
- **Node**: Physical or logical host running one or more actor peers
4343

4444
## Build Commands
4545

@@ -56,19 +56,19 @@ Run these commands from the root of the project. They depend on Turborepo, so yo
5656

5757
### Topologies
5858

59-
rivetkit supports three topologies that define how workers communicate and scale:
59+
rivetkit supports three topologies that define how actors communicate and scale:
6060

61-
- **Singleton:** A single instance of an worker running in one location
62-
- **Partition:** Multiple instances of an worker type partitioned by ID, useful for horizontal scaling
63-
- **Coordinate:** Workers connected in a peer-to-peer network, sharing state between instances
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
6464

6565
### Driver Interfaces
6666

6767
Driver interfaces define the contract between rivetkit and various backends:
6868

69-
- **WorkerDriver:** Manages worker state, lifecycle, and persistence
70-
- **ManagerDriver:** Manages worker discovery, routing, and scaling
71-
- **CoordinateDriver:** Handles peer-to-peer communication between worker instances
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
7272
- Only applicable in coordinate topologies
7373

7474
### Driver Implementations
@@ -110,7 +110,7 @@ This ensures imports resolve correctly across different build environments and p
110110
- UPPER_CASE for constants
111111
- Use `#` prefix for private class members (not `private` keyword)
112112
- **Error Handling:**
113-
- Extend from `WorkerError` base class (packages/core/src/worker/errors.ts)
113+
- Extend from `ActorError` base class (packages/core/src/actor/errors.ts)
114114
- Use `UserError` for client-safe errors
115115
- Use `InternalError` for internal errors
116116
- 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.
@@ -119,7 +119,7 @@ This ensures imports resolve correctly across different build environments and p
119119
- Do not store `logger()` as a variable, always call it using `logger().info("...")`
120120
- Use structured logging where it makes sense, for example: `logger().info("foo", { bar: 5, baz: 10 })`
121121
- 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/worker/errors.ts and throw that instead. The middleware will automatically serialize the response for you.
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.
123123

124124
## Project Structure
125125

@@ -140,7 +140,7 @@ This ensures imports resolve correctly across different build environments and p
140140

141141
## Test Guidelines
142142

143-
- Do not check if errors are an instanceOf WorkerError 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`.
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`.
144144

145145
## Examples
146146

docs/clients/javascript.mdx

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -4,12 +4,12 @@ icon: node-js
44
---
55

66
import MvpWarning from "/snippets/mvp-warning.mdx";
7-
import StepDefineWorker from "/snippets/step-define-worker.mdx";
7+
import StepDefineActor from "/snippets/step-define-actor.mdx";
88
import StepRunStudio from "/snippets/step-run-studio.mdx";
99
import StepDeploy from "/snippets/step-deploy.mdx";
1010
import SetupNextSteps from "/snippets/setup-next-steps.mdx";
1111

12-
The RivetKit JavaScript client allows you to connect to and interact with workers from browser and Node.js applications.
12+
The RivetKit JavaScript client allows you to connect to and interact with actors from browser and Node.js applications.
1313

1414
<MvpWarning />
1515

@@ -71,20 +71,20 @@ The RivetKit JavaScript client allows you to connect to and interact with worker
7171
</CodeGroup>
7272
</Step>
7373

74-
<StepDefineWorker />
74+
<StepDefineActor />
7575

7676
<Step title="Create your client">
77-
Create a file `src/client.ts` in your project to connect to your worker:
77+
Create a file `src/client.ts` in your project to connect to your actor:
7878

7979
```typescript src/client.ts
8080
import { createClient } from "rivetkit/client";
81-
import type { App } from "../workers/app";
81+
import type { App } from "../actors/app";
8282

8383
async function main() {
8484
// Replace with your endpoint URL after deployment
8585
const client = createClient<App>("http://localhost:6420");
8686

87-
// Get or create a worker instance
87+
// Get or create a actor instance
8888
const counter = await client.counter.get();
8989

9090
// Subscribe to events
@@ -139,5 +139,5 @@ The RivetKit JavaScript client allows you to connect to and interact with worker
139139

140140
## Next Steps
141141

142-
See the [Interacting with Workers](/concepts/interacting-with-workers) documentation for information on how to use the client.
142+
See the [Interacting with Actors](/concepts/interacting-with-actors) documentation for information on how to use the client.
143143

docs/clients/python.mdx

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -4,12 +4,12 @@ icon: python
44
---
55

66
import MvpWarning from "/snippets/mvp-warning.mdx";
7-
import StepDefineWorker from "/snippets/step-define-worker.mdx";
7+
import StepDefineActor from "/snippets/step-define-actor.mdx";
88
import StepRunStudio from "/snippets/step-run-studio.mdx";
99
import StepDeploy from "/snippets/step-deploy.mdx";
1010
import SetupNextSteps from "/snippets/setup-next-steps.mdx";
1111

12-
The RivetKit Python client provides a way to connect to and interact with workers from Python applications.
12+
The RivetKit Python client provides a way to connect to and interact with actors from Python applications.
1313

1414
<MvpWarning />
1515

@@ -39,7 +39,7 @@ The RivetKit Python client provides a way to connect to and interact with worker
3939
```
4040
</Step>
4141

42-
<StepDefineWorker />
42+
<StepDefineActor />
4343

4444
<Step title="Create your client">
4545
Create a new file `main.py`:
@@ -53,7 +53,7 @@ The RivetKit Python client provides a way to connect to and interact with worker
5353
# Replace with your endpoint URL after deployment
5454
client = AsyncClient("http://localhost:6420")
5555

56-
# Get or create a worker instance
56+
# Get or create a actor instance
5757
counter = await client.get("counter")
5858

5959
# Subscribe to events using callback
@@ -82,7 +82,7 @@ The RivetKit Python client provides a way to connect to and interact with worker
8282
# Replace with your endpoint URL after deployment
8383
client = Client("http://localhost:6420")
8484

85-
# Get or create a worker instance
85+
# Get or create a actor instance
8686
counter = client.get("counter")
8787

8888
# Subscribe to events using callback

docs/concepts/cors.mdx

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,8 @@ Cross-Origin Resource Sharing (CORS) is a security mechanism that allows a web a
88

99
You'll need to configure CORS when:
1010

11-
- **Local Development**: You're developing locally and your client runs on a different port than your worker service
12-
- **Different Domain**: Your frontend application is hosted on a different domain than your worker service
11+
- **Local Development**: You're developing locally and your client runs on a different port than your actor service
12+
- **Different Domain**: Your frontend application is hosted on a different domain than your actor service
1313

1414
## Example
1515

@@ -18,7 +18,7 @@ import { setup } from "rivetkit";
1818
import counter from "./counter";
1919

2020
const registry = setup({
21-
workers: { counter },
21+
actors: { counter },
2222
// Change this to match your frontend's origin
2323
cors: { origin: "https://yourdomain.com" }
2424
});

docs/concepts/edge.mdx

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,14 @@
11
---
22
title: Edge Networking
3-
description: Workers run near your users on your provider's global network (if supported).
3+
description: Actors run near your users on your provider's global network (if supported).
44
icon: globe
55
---
66

77
## Region selection
88

99
### Automatic region selection
1010

11-
By default, workers will choose the optimal region based on the client's location.
11+
By default, actors will choose the optimal region based on the client's location.
1212

1313
<Note>
1414
Under the hood, Rivet uses [Anycast routing](https://en.wikipedia.org/wiki/Anycast) to automatically find
@@ -17,16 +17,16 @@ By default, workers will choose the optimal region based on the client's locatio
1717

1818
### Manual region selection
1919

20-
The region a worker is created in can be overridden using region options:
20+
The region a actor is created in can be overridden using region options:
2121

2222
```typescript client.ts
2323
import { createClient } from "rivetkit/client";
2424
import type { App } from "./src/index";
2525

2626
const client = createClient<App>("http://localhost:6420");
2727

28-
// Create worker in a specific region
29-
const worker = await client.example.get({
28+
// Create actor in a specific region
29+
const actor = await client.example.get({
3030
options: {
3131
create: {
3232
region: "atl"
@@ -35,7 +35,7 @@ const worker = await client.example.get({
3535
});
3636
```
3737

38-
See [Create & Manage Workers](/docs/manage) for more information.
38+
See [Create & Manage Actors](/docs/manage) for more information.
3939

4040
## Available regions
4141

@@ -45,6 +45,6 @@ See available regions [here](/docs/regions).
4545

4646
It's common to need to display a list of available regions in your application.
4747

48-
To fetch a full list of regions, you can use the `GET https://api.rivet.gg/regions` HTTP endpoint. See API documentation [here](/docs/api/worker/regions/list).
48+
To fetch a full list of regions, you can use the `GET https://api.rivet.gg/regions` HTTP endpoint. See API documentation [here](/docs/api/actor/regions/list).
4949

5050
We don't recommend hard-coding the region list. This allows you to develop your application with a local development cluster.

docs/concepts/external-sql.mdx

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -3,9 +3,9 @@ title: External SQL Database
33
icon: database
44
---
55

6-
While workers can serve as a complete database solution, they can also complement your existing databases. For example, you might use workers to handle frequently-changing data that needs real-time access, while keeping less frequently accessed data in your traditional database.
6+
While actors can serve as a complete database solution, they can also complement your existing databases. For example, you might use actors to handle frequently-changing data that needs real-time access, while keeping less frequently accessed data in your traditional database.
77

8-
Workers can be used with common SQL databases, such as PostgreSQL and MySQL.
8+
Actors can be used with common SQL databases, such as PostgreSQL and MySQL.
99

1010
## Libraries
1111

@@ -35,8 +35,8 @@ There are several options for places to host your SQL database:
3535

3636
Here's a basic example of how you might set up a connection to a PostgreSQL database using the `pg` library:
3737

38-
```typescript worker.ts
39-
import { worker } from "rivetkit";
38+
```typescript actor.ts
39+
import { actor } from "rivetkit";
4040
import { Pool } from "pg";
4141

4242
// Create a database connection pool
@@ -48,16 +48,16 @@ const pool = new Pool({
4848
port: 5432,
4949
});
5050

51-
// Create the worker
52-
const databaseWorker = worker({
51+
// Create the actor
52+
const databaseActor = actor({
5353
state: {
5454
// Local state if needed
5555
lastQueryTime: 0
5656
},
5757

5858
// Initialize any resources
5959
onStart: (c) => {
60-
console.log("Database worker started");
60+
console.log("Database actor started");
6161
},
6262

6363
// Clean up resources if needed
@@ -98,15 +98,15 @@ const databaseWorker = worker({
9898
}
9999
});
100100

101-
export default databaseWorker;
101+
export default databaseActor;
102102
```
103103

104104
## With Drizzle ORM
105105

106106
Here's an example using Drizzle ORM for more type-safe database operations:
107107

108-
```typescript worker.ts
109-
import { worker } from "rivetkit";
108+
```typescript actor.ts
109+
import { actor } from "rivetkit";
110110
import { drizzle } from "drizzle-orm/node-postgres";
111111
import { pgTable, serial, text, timestamp } from "drizzle-orm/pg-core";
112112
import { Pool } from "pg";
@@ -127,10 +127,10 @@ const pool = new Pool({
127127
// Initialize Drizzle with the pool
128128
const db = drizzle(pool);
129129

130-
// Create the worker
131-
const userWorker = worker({
130+
// Create the actor
131+
const userActor = actor({
132132
state: {
133-
// Worker state (frequently accessed data can be cached here)
133+
// Actor state (frequently accessed data can be cached here)
134134
userCache: {}
135135
},
136136

@@ -169,5 +169,5 @@ const userWorker = worker({
169169
}
170170
});
171171

172-
export default userWorker;
172+
export default userActor;
173173
```

docs/concepts/logging.mdx

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -3,11 +3,11 @@ title: Logging
33
icon: list-ul
44
---
55

6-
Workers provide a built-in way to log complex data to the console.
6+
Actors provide a built-in way to log complex data to the console.
77

88
When dealing with lots of data, `console.log` often doesn't cut it. Using the context's log object (`c.log`) allows you to log complex data using structured logging.
99

10-
<Note>Using the worker logging API is completely optional.</Note>
10+
<Note>Using the actor logging API is completely optional.</Note>
1111

1212
## Log levels
1313

@@ -46,9 +46,9 @@ Consider this example:
4646
<CodeGroup>
4747

4848
```typescript structured_logging.ts
49-
import { worker } from "rivetkit";
49+
import { actor } from "rivetkit";
5050

51-
const counter = worker({
51+
const counter = actor({
5252
state: { count: 0 },
5353

5454
actions: {
@@ -64,9 +64,9 @@ const counter = worker({
6464
```
6565

6666
```typescript unstructured_logging.ts
67-
import { worker } from "rivetkit";
67+
import { actor } from "rivetkit";
6868

69-
const counter = worker({
69+
const counter = actor({
7070
state: { count: 0 },
7171

7272
actions: {
@@ -92,13 +92,13 @@ Additionally, structured logs can be parsed and queried at scale using tools lik
9292
The logger is available in all lifecycle hooks:
9393

9494
```typescript
95-
import { worker } from "rivetkit";
95+
import { actor } from "rivetkit";
9696

97-
const loggingExample = worker({
97+
const loggingExample = actor({
9898
state: { events: [] },
9999

100100
onStart: (c) => {
101-
c.log.info('worker_started', { timestamp: Date.now() });
101+
c.log.info('actor_started', { timestamp: Date.now() });
102102
},
103103

104104
onBeforeConnect: (c, { params }) => {
@@ -137,7 +137,7 @@ const loggingExample = worker({
137137
},
138138

139139
actions: {
140-
// Worker actions...
140+
// Actor actions...
141141
}
142142
});
143143
```

0 commit comments

Comments
 (0)