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 }}
Repository navigation
Commit 70293eb
Browse filesBrowse the repository at this point in the historyBrowse files
| Multiplayer, presence, or collaboration | Room, session, or document | Joins, moves, and edits commit in order; subscribers refresh from committed state |
31
-
| Reservations and expiring holds | Show, resource, or stock item | Availability checks and holds cannot interleave; a durable reminder can release an old hold |
32
-
| Checkout and account workflows | Cart, order, account, device | The current step, retries, and effect results return to the same ordered mailbox |
33
-
| Per-key rate limits | API key, account, or device | Token checks and decrements are serialized; a reminder can refill the bucket |
34
-
| Stateful agent sessions | Agent session | Messages and tool results apply in order and pending work survives a worker exit |
35
-
36
-
The common shape is one durable coordination boundary with an application
37
-
defined identity. Work for that identity is serialized, while unrelated rooms,
38
-
carts, accounts, or sessions can progress concurrently. A single global rate
39
-
limiter or another very hot identity is a poor fit because it becomes an
40
-
intentional bottleneck. If one ordinary row transaction solves the problem,
41
-
prefer that. See [Choosing Solid Objects](docs/fit.md) for the longer guide.
42
-
43
21
## The programming model
44
22
45
23
```typescript
@@ -64,6 +42,28 @@ Both calls enter the durable mailbox for `cart-123`. They execute in order and
64
42
commit one state transition at a time, even when different requests or Node.js
65
43
processes submit them concurrently.
66
44
45
+
## What Solid Objects is for
46
+
47
+
Use Solid Objects when more than one request, job, or process can act on the
48
+
same logical thing and the next action must use its latest committed state.
49
+
These are the stateful coordination patterns for which people often reach for
50
+
Durable Objects:
51
+
52
+
| Pattern | One identity per | What the object coordinates |
| Multiplayer, presence, or collaboration | Room, session, or document | Joins, moves, and edits commit in order; subscribers refresh from committed state |
55
+
| Reservations and expiring holds | Show, resource, or stock item | Availability checks and holds cannot interleave; a durable reminder can release an old hold |
56
+
| Checkout and account workflows | Cart, order, account, device | The current step, retries, and effect results return to the same ordered mailbox |
57
+
| Per-key rate limits | API key, account, or device | Token checks and decrements are serialized; a reminder can refill the bucket |
58
+
| Stateful agent sessions | Agent session | Messages and tool results apply in order and pending work survives a worker exit |
59
+
60
+
The common shape is one durable coordination boundary with an application
61
+
defined identity. Work for that identity is serialized, while unrelated rooms,
62
+
carts, accounts, or sessions can progress concurrently. A single global rate
63
+
limiter or another very hot identity is a poor fit because it becomes an
64
+
intentional bottleneck. If one ordinary row transaction solves the problem,
65
+
prefer that. See [Choosing Solid Objects](docs/fit.md) for the longer guide.
66
+
67
67
## Run it now with SQLite
68
68
69
69
Node.js 24.15 or newer is required. The `0.13.0` release includes a
0 commit comments