> ## Documentation Index
> Fetch the complete documentation index at: https://docs.chardb.dev/llms.txt
> Use this file to discover all available pages before exploring further.

# Quickstart

> Generate, test, and run the starter.

You need Bun 1.2.22 or newer and Node.js 22 or newer. Local development does not need a Cloudflare account.

## Create the app

Run the initializer from the directory that should contain your new project. It creates `my-chardb-app` for you.

```bash theme={null}
bunx @chardb/core init my-chardb-app
cd my-chardb-app
bun install
bun run typecheck
bun run test
bun run build
```

`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.

```bash theme={null}
bun run dev
```

`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.

1. Create an organization.
2. Open the same organization in a second tab.
3. Post a message with a JPEG or PNG attachment and watch both tabs update.
4. Download the attachment through the same-origin authenticated route.
5. Restart `bun run dev` and reload the persisted message.

## Know the core files

You will make most changes here:

* `src/auth.ts` defines the Better Auth plugins.
* `src/schema.ts` declares the organization table and policy.
* `src/queries.ts` and `src/api.ts` declare the live read and mutations.
* `src/worker.ts` mounts CharDB and application routes.
* `wrangler.toml` binds Catalog, Cdb, Gateway, Resharder, and R2.

Next, read [Ownership](/ownership). It explains the three public ownership factories.
