# Examples

Every template is a complete capsule with the layout your app should use, plus `AGENTS.md`, `CLAUDE.md`, `README.md`, `tsconfig.json`, `fuast-env.d.ts`, `.gitignore`, and a `favicon.svg`.

```sh
bunx @revnu/fuast new my-app --template <name>
```

| Template | Shows |
| --- | --- |
| [`todo`](https://fuast.com/docs/examples/todo.md) | Per-user rows, ownership checks, indexes, WebMCP tool tags, client routes, a `GET` endpoint, a shared helper. The default. |
| [`guestbook`](https://fuast.com/docs/examples/guestbook.md) | An intentionally shared feed, author snapshots taken from `ctx.auth`, guests on a public app. |
| [`signature`](https://fuast.com/docs/examples/signature.md) | Sign-in required, file attachments with `client.storage`, `ctx.storage` cleanup, summary counters, email on each signature. |
| [`approvals`](https://fuast.com/docs/examples/approvals.md) | Team features: `ctx.workspace.members()`, email on submit and decision, a weekday digest schedule, env-configured approvers. |
| [`live-demo`](https://fuast.com/docs/examples/live-demo.md) | Realtime sync between windows: one live query per board, optimistic updates, a typing indicator, room-scoped data for guests, caps, a per-visitor write budget, and a cleanup schedule. The board embedded on the fuast.com homepage. |

## Start from the dashboard

No terminal needed: **New app** in the dashboard opens the same templates as a gallery. Pick one, name it, and fuast deploys it to your workspace as a private app in a few seconds. Share it from the Sharing tab, and read or change its code in the app's Source tab, which type-checks and redeploys from the browser. To keep working on it with an agent or your own editor, scaffold the same template with `fuast new` and deploy over the app.

## What to copy

- Schema, queries, mutations, endpoints, and schedules in `server/index.ts`.
- Validation and constants in `shared/`, used by both sides.
- One `createClient<typeof app>()` per app, with `import type app from "../server/index"`.
- `ctx.auth.requireIdentity()` or `requireSignedIn()` at the top of every handler that touches user data. Never trust identity from arguments.
- `userId()` for user references, with owner filters in queries and ownership checks in mutations.
- An index for every filter, read with `withIndex`, `order`, and one awaited terminal.
- Render nothing while a query is `undefined`, fade in loaded data, and give empty lists their own message.
- Keep form input on error, and clear it on success only if it still matches what was submitted.
- Complete Tailwind class names written in the client files, with `dark:` variants. No component kit.

## Test as several people

```txt
http://localhost:3000/?fuast_user=alice
http://localhost:3000/?fuast_user=bob
http://localhost:3000/?fuast_guest=1
```

Then check the data:

```sh
bunx @revnu/fuast db dump --port 3000
bunx @revnu/fuast logs --port 3000
```
