Create the app
Run the initializer from the directory that should contain your new project. It createsmy-chardb-app for you.
bun run test reads the generated wrangler.toml and runs the Worker through Cloudflare’s Vitest integration. It migrates a fresh Miniflare database, checks the four Durable Object bindings and R2 binding, signs in through Better Auth, creates an organization, then writes and reads one message.
Run it
Start the Worker and web app together.bun run dev starts Wrangler, migrates the local database, then starts Vite. It prints the browser URL only after both processes are ready.
Try the complete path once.
- Create an organization.
- Open the same organization in a second tab.
- Post a message with a JPEG or PNG attachment and watch both tabs update.
- Download the attachment through the same-origin authenticated route.
- Restart
bun run devand reload the persisted message.
Know the core files
You will make most changes here:src/auth.tsdefines the Better Auth plugins.src/schema.tsdeclares the organization table and policy.src/queries.tsandsrc/api.tsdeclare the live read and mutations.src/worker.tsmounts CharDB and application routes.wrangler.tomlbinds Catalog, Cdb, Gateway, Resharder, and R2.