durable-objects

Implement Durable Objects with SQLite migrations and deterministic getByName routing.

Updated Jan 4, 2026
One-click install
npx skills add https://github.com/devsanthoshmk/MKS-Agency --skill durable-objects-devsanthoshmk
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: durable-objects
Source: https://github.com/devsanthoshmk/MKS-Agency/tree/main/backend/.agents/skills/durable-objects
Command: npx skills add https://github.com/devsanthoshmk/MKS-Agency --skill durable-objects-devsanthoshmk

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill includes references (resource) components.

What problem does it solve?

Durable Objects solve the challenge of building stateful, strongly coordinated systems on Cloudflare’s edge where multiple requests must share consistent per-entity state (rather than relying on stateless Workers).

Core Features & Use Cases

  • Stateful coordination: Create one Durable Object class per logical coordination unit such as chat rooms, game sessions, booking entities, or per-tenant/user state.
  • Strong storage and consistency: Use Durable Object SQLite storage for durable per-entity data and avoid losing critical state on eviction.
  • RPC methods, alarms, and advanced routing: Implement typed RPC methods, schedule per-DO background work with alarms, and use deterministic routing via getByName to ensure the right instance handles each request.

Use cases include inventory/booking consistency, real-time notifications, multiplayer coordination, and review-focused guidance for Durable Objects best practices and configuration (wrangler bindings and migrations).

Quick Start

Ask to create a Durable Object that persists an entity-specific counter using SQLite storage and exposes an RPC method you can call via a deterministic stub with getByName for local and production behavior validation.

Frequently Asked Questions about durable-objects

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
When should I use Durable Objects instead of stateless Workers?

Durable Objects expose typed RPC methods instead of traditional fetch handlers. You route requests deterministically using getByName to retrieve a stub, then call your custom RPC methods on that stub to interact with the specific object instance.

How do I schedule background tasks in a Durable Object?

You schedule background work using Durable Object alarms, which support one alarm per DO instance. This allows you to run scheduled tasks like cleanup or notifications without external cron triggers.

How do I test Durable Objects locally?

Test Durable Objects using @cloudflare/vitest-pool-workers. This setup validates both local and production behavior, ensuring your SQLite migrations, RPC methods, and deterministic routing work correctly before deployment.

What are the concurrency limitations of Durable Objects?

Durable Objects require safe concurrency practices, restricting blockConcurrencyWhile to initialization only. This prevents deadlocks while ensuring strongly consistent state access for all incoming requests to the object instance.