Skip to main content
The generated app includes one public file path. It stores an opaque file ID in SQLite and keeps the R2 bucket, key, checksum, and upload state out of application rows.

Declare the column

Declare one nullable file() column and include it in the table policy.
src/schema.ts
This release accepts files up to the column limit, capped by the current proxied-upload maximum. The generated example accepts JPEG and PNG files up to 5 MiB.

Bind the browser client

The browser uses a schema locator because schema.ts imports server-only Better Auth definitions.
Upload before the message mutation, then store the returned opaque ID.
The configured client adds the active organization to writes, uploads, and downloads. File routes use the Worker URL configured on createChardbReactClient, and the browser sends the Better Auth session cookie automatically. CharDB checks the active organization, current membership, table policy, row ID, and opaque file ID before returning bytes.
Do not store an R2 URL or object key. Store only the FileId returned by the upload.
Use Vectors when the row also needs semantic search.