@bounda-dev/adapter-cloudflare
v0.1.0
Published
Cloudflare Durable Objects storage adapter for Bounda
Readme
@bounda-dev/adapter-cloudflare
A Bounda store in a Cloudflare Durable Object: the events, the read models and the scheduled work in the object's own SQLite, one object per tenant, and no server or background process to run.
npm create bounda@latest my-app -- --framework cloudflareOr by hand:
// bounda.config.ts
import { cloudflare } from "@bounda-dev/adapter-cloudflare";
import { defineConfig } from "@bounda-dev/core/config";
export default defineConfig({ storage: cloudflare() });// src/worker.ts
import { createBoundaObject, createWorker } from "@bounda-dev/adapter-cloudflare";
import { registry } from "../.bounda/registry.ts";
import config from "../bounda.config.ts";
export const Store = createBoundaObject({ registry, config });
export default createWorker({ binding: "STORE" });wrangler.jsonc binds STORE to the Store class with a new_sqlite_classes migration.
- A command resolves once its events are stored and every read model reflects them.
- Policies, processes, scheduled commands and retries run in the object's alarm, which it arms itself.
createWorkerservesPOST /commands/<name>andPOST /queries/<name>as JSON, one store perx-bounda-tenantheader. It has no authentication: a starting point. Your ownfetchtalks to a store withconnect(stub), which typescommandsandqueriesfrom your modules.
Status
0.x. Until 1.0 the API can still change between minor versions, and every change that breaks something is called out in the changelog.
Docs: docs.bounda.dev. Source and issues: github.com/bounda-dev/bounda.
