durable-objects

Solid

Use when building stateful per-key actors — chat rooms, multiplayer rooms, rate limiters, long-running agents, leaderboards — that need persistent in-memory + storage state across requests

AI & Automation 424 stars 40 forks Updated today MIT

Install

View on GitHub

Quality Score: 88/100

Stars 20%
88
Recency 20%
100
Frontmatter 20%
70
Documentation 15%
100
Issue Health 10%
80
License 10%
100
Description 5%
100

Skill Content

# Butterbase Durable Objects Durable Objects (DOs) are **stateful per-key actors** running on Cloudflare Workers. Each instance has its own in-memory state and a built-in transactional KV store. Use one when state must survive across requests for a single room/user/agent. For stateless work, use a serverless function instead (`butterbase-skills:function-dev`). One tool: **`manage_durable_objects`**. --- ## 1. The mental model ``` Class: ChatRoom (deployed once) │ ├── instance "lobby" ─► in-memory state + state.storage + WebSockets ├── instance "general" ─► separate state, separate sockets └── instance "user-123" ─► separate again Each URL https://<app>.butterbase.dev/_do/chat-room/<instance-id> gets routed to the instance with that id. State is isolated per id. ``` A class is shared code; an **instance** is a unique key (`/lobby`, `/general`, `/user-123`). Different ids = different state. There is no shared cross-instance state. --- ## 2. Constraints (read these first) - **One TypeScript file per class.** No npm imports. Only `import { ... } from 'cloudflare:workers'` is allowed. - **Exactly one exported class.** `export class Foo { ... }` — no extra exports, no helpers re-exported. - **PascalCase class name** in source; **kebab-case** for the URL name (e.g. `ChatRoom` ↔ `chat-room`). - File size: ≤ 5 MB. Total of all DO classes per app: ≤ 10 MB compressed. - ≤ 5 DO classes per app (v1). - **No service bindings yet.** Functions reach DOs ...

Details

Author
butterbase-ai
Repository
butterbase-ai/butterbase-skills
Created
1 months ago
Last Updated
today
Language
N/A
License
MIT

Integrates with

Similar Skills

Semantically similar based on skill content — not just same category

AI & Automation Listed

durable-objects

Create and review Cloudflare Durable Objects. Use when building stateful coordination (chat rooms, multiplayer games, booking systems), implementing RPC methods, SQLite storage, alarms, WebSockets, or reviewing DO code for best practices. Covers Workers integration, wrangler config, and testing with Vitest. Biases towards retrieval from Cloudflare docs over pre-trained knowledge.

0 Updated today
Tekkiiiii
AI & Automation Solid

journey-durable

Use as the durable-objects build stage of the Butterbase journey. Implements the Durable section of 02-plan.md by delegating to durable-objects. Calls manage_durable_objects (deploy). Skipped if the plan has no per-key stateful actors (chat rooms, multiplayer, rate limiters).

424 Updated today
butterbase-ai
AI & Automation Featured

dbos-typescript

Guide for building reliable, fault-tolerant TypeScript applications with DBOS durable workflows. Use when adding DBOS to existing TypeScript code, creating workflows and steps, or using queues for concurrency control.

39,350 Updated today
sickn33
AI & Automation Listed

architecture-and-stack

Cloudflare-first platform selection. Decision trees for Workers, D1, R2, KV, DO, Queues, Vectorize, Containers, Sandboxes, Flagship, Agent Memory, Workflows v2. Default stack, override conditions, auth, data patterns, reliability.

9 Updated yesterday
heymegabyte
AI & Automation Solid

dbos-typescript

DBOS TypeScript SDK for building reliable, fault-tolerant applications with durable workflows. Use this skill when writing TypeScript code with DBOS, creating workflows and steps, using queues, using DBOSClient from external applications, or building applications that need to be resilient to failures.

335 Updated today
aiskillstore