A lightweight library for tracking and persisting state changes in Cloudflare Durable Objects using SQLite, version 0.1.1. It simplifies state management by automatically diffing property assignments and storing only mutations, reducing bandwidth and storage costs. Key differentiators from manual state handling include decorator-based or explicit state registration, configurable snapshot policies (e.g., every-change), and tight integration with Cloudflare Workers. The package is in early development with decorator support requiring wrangler@next. Ships TypeScript types and is designed for serverless environments.
npm install diffable-objectsNo compatibility data collected yet for this library.
Verified import paths — ran on the pinned version, not inferred.
Demonstrates explicit state tracking with `state()`: creates a Durable Object with a tracked state object, mutates it, and retrieves it.
Use explicit `state()` function instead of `@diffable` decorator until wrangler@next is stable
Always mutate `this.#state` directly; do not extract to a local variable and modify it
Use `snapshotPolicy: 'periodic'` with appropriate options
Pass `this.ctx` (the DurableObjectState) to `state()`
Use explicit `state()` function instead of `@diffable`, or update wrangler to @next
Ensure code runs in a Cloudflare Worker with durable objects enabled
Verify that `state()` is called with `this.ctx` and that the Durable Object is properly bound