Use Durable Objects in a real application path
Durable Objects give Workers a named place for stateful coordination, storage, and alarms.
A real Durable Objects application path with config and runtime code kept side by side.
Use this as the application-focused Durable Objects example before you add feature-specific abstractions around the binding.
- Config focus
- Auto-discovered file plus one DO binding
- Runtime shape
- Durable Objects calls from worker application code
- Best use
- Counters, room state, and small single-identity coordination examples
Start by wiring the binding clearly in config
Minimal Durable Object config using the default discovery pattern
Build the application flow around the binding
Treat this as the app-level Durable Objects path: the route, event handler, or service module receives a real request and uses the binding to do useful work.
Keep product limits, remote ownership, and fallback behavior visible in the code around the binding instead of hiding everything behind a vague utility too early.
- This tiny shape already proves that the object class, namespace, storage, and worker path are wired correctly.
- Once this works, richer room, session, or lock logic becomes a normal extension instead of a blind leap.
A tiny object and one worker path
Keep production boundaries visible
- Config focus: Auto-discovered file plus one DO binding.
- Runtime shape: Durable Objects calls from worker application code.
- Best use: Counters, room state, and small single-identity coordination examples.
Previous
Testing Durable Objects
Durable Objects are well-supported in the default Devflare harness, which means you can test real object behavior without hand-building a fake namespace first.
Next
Queues
Devflare models Queue producers and consumers explicitly, which makes local tests and preview naming much easier to reason about.