# wwwhat for AI Agents

wwhat is designed to be the fastest way for an LLM or coding agent to build and ship a real web app. An app is just `.html` files plus one `wwhat.toml` — no build step, no bundler, no separate API or client framework to wire up. Generate HTML, run one command, and it's live.

## The machine-readable reference

A complete, terse reference for generating wwwhat code lives at [`/static/llms.txt`](/content/static/llms.txt). Point your agent at it — it covers the full template syntax, the `<what>` block, the three state scopes, every client attribute, deploy flows, copy-paste app recipes, and the common mistakes to avoid.

**One instruction that works:** “Read `https://getwhatnow.com/static/llms.txt`, then build a <app> as wwwhat `.html` files.”

## Why agents build faster here

- **No build step.** You write HTML; the server renders it. There is nothing to compile, hydrate, or bundle.
- **One mental model.** A request returns HTML, the page swaps it in. State lives on the server in three clear scopes: `session` (per user), `wired` (shared live), and per-request data.
- **Almost no client JavaScript.** A small set of `w-*` attributes covers interactivity. There is no DOM library to learn and no client state to keep in sync.
- **Batteries included.** Routing, database (SQLite / Cloudflare D1), auth, forms, validation, uploads, and email are built in — no packages to choose or configure.
- **One-command deploy.** The same source runs locally on SQLite, on Cloudflare with D1 + R2, or self-hosted.

## The workflow

```
run-what new myapp && cd myapp     # scaffold
# write pages under site/ (file path = URL), components under components/
run-what dev                         # hot-reload preview at http://localhost:8085
run-what build                       # static output in dist/   (or)
run-what deploy                      # ship to Cloudflare
```

## Which tool for the job

| Need | Use |
| --- | --- |
| Show server data in a page | `fetch.x = "local:collection"` \+ `<loop>` |
| Per-user state (cart, wizard step) | `session.*` \+ `w-set` |
| State shared live across clients | `wired.*` \+ `w-set` (WebSocket is automatic) |
| Persisted records / CRUD | a collection + `<form action="/w-action/<collection>">` |
| Update part of a page on click | `w-get`/`w-post` \+ `w-target` |
| Tabs / accordion / modal | `.tab-group` / `<details>` / `w-modal-trigger` — no JS |

## Example: a contact form that stores submissions

```
<!-- site/contact.html -->
<form method="post" action="/w-action/messages" w-boost w-reset>
  <input name="name" class="form-input" w-required placeholder="Your name">
  <input name="email" type="email" class="form-input" w-required w-type="email">
  <textarea name="body" class="form-textarea" w-required></textarea>
  <button class="btn btn-primary" type="submit">Send</button>
</form>
```

That's the whole feature. Submissions are stored in the `messages` collection. More recipes (mini CMS, live poll) are in [`/static/llms.txt`](/content/static/llms.txt).
