Skip to main content
A live query is a registered Drizzle query. The browser sends its reference and validated JSON arguments. It never sends SQL.

Register the query

This is the complete generated query file.
src/queries.ts
Keep ref stable after release. It identifies the query across the browser bundle, Worker, reconnects, and pending subscriptions. The organization predicate is required even though CharDB also applies the ownership policy. It tells the router which partition can answer the query.

Subscribe in React

Configure one client with the public Worker URL and the same Better Auth client. CharDB derives /ws from this URL.
src/web/App.tsx
Pass the exported handle to the configured client. It reads the active organization from Better Auth and adds organizationId to the wire arguments.
src/MessageList.tsx
pending means the first snapshot has not arrived. live means the subscription is current. refetching means CharDB could not safely resume an earlier snapshot and is replacing it.

Write through a mutation

The client adds the active organization and retains one mutation ID while it reconnects, so a retry does not create a second write. Every matching subscription receives a complete replacement snapshot after the commit. Use Files when a row needs an attachment.