# The CLI handbook

> Everything npx vibes-diy can do, organized by task: ship apps from the shell, script your data, tail changes live, manage secrets and versions, read build transcripts, and mount your vibes into any AI agent over MCP.

Source: https://good.vibes.diy/docs/cli

Everything you can do in the Vibes DIY web UI — and a good deal you can't —
is scriptable from the shell. There's nothing to install: every command runs
as `npx vibes-diy <command>`. This page is the tour by task; the
[command reference](https://good.vibes.diy/docs/cli/reference) is the complete flag-level contract,
generated from the CLI's own help output. For the story of building whole
sites with one command, see [the generate case study](https://good.vibes.diy/generate).

## Sign in once (or never, in CI)

```sh
npx vibes-diy login
```

Login is free and easy. It opens an approval page in your browser. Compare the
confirmation code on the page with the code in your terminal, and press
**Approve sign-in** only when they match. To see the code in your terminal, run
the newest CLI: `npx vibes-diy@latest login`. This machine is then enrolled with a **device certificate** —
that cert is the credential for everything below; there are no API keys. For
headless environments (CI, containers), export the enrollment's keybag file
via the `VIBES_DEVICE_ID` env var instead — the exact recipe, including why
it's the keybag JSON and not a bare id, is in the
[CI lane pattern](https://good.vibes.diy/docs/patterns/ci-lane-device-certs).

## Agents and sandboxes

You can sign in from an agent sandbox, a remote dev box, or a container behind
a proxy. `vibes-diy login` finishes by itself wherever you approve it: open the
sign-in URL on any device — your phone works — and once you approve, the CLI
picks the certificate up from vibes.diy within a few seconds. On the same
machine, the browser also hands it straight back at `http://localhost:<port>/cert`;
whichever arrives first wins.

**You approve every sign-in.** Opening the sign-in URL signs nothing in by
itself. The page names the handle you're signing the CLI in as and shows a
short confirmation code, and the terminal prints the same code under the URL:

```text
Confirmation code: 3F9A-C21B
The approval page shows this same code. Check that they match, then approve.
```

Compare the code on the page with the code in your terminal, and press
**Approve sign-in** only when they match: a match means the request on screen
is the one your terminal made. For a link you didn't start, or a code that
differs, press **This wasn't me** and your account stays exactly as it was. The certificate goes back by pickup, or to a
loopback address on the same machine (`localhost`, `127.0.0.1` or `[::1]`),
never to another host.

**Check who approves.** To make the CLI refuse any account but yours, pass the
handle you expect:

```sh
npx vibes-diy login --expect-handle <your-handle>
```

If a browser signed in to a different account approves, the CLI stores nothing,
names the account that signed, and exits non-zero. `--expect-user <userId>`
checks the account id instead, and works with `--cert` too.

**Finish a login by hand with `--cert`.** If the login ever doesn't finish by
itself (an older CLI, say), the certificate page
shows the certificate and a ready-to-paste command. Press **Copy command** and
run it in the terminal where `vibes-diy login` is waiting:

```sh
npx vibes-diy login --cert '<certificate>'
```

`--cert` also accepts the whole callback URL. If the browser already went on to
a `localhost` error page, copy the address bar (or just its `cert=` value) and
paste that in.

**Headless machines get a link.** When the CLI sees no display to open a
browser on (or you pass `--no-browser`), it prints the sign-in URL. Open it on
any device you're signed in on, and the login completes by itself. Login waits up to an hour, the same lifetime as the signing request, and
prints a heartbeat while it waits, so a quiet terminal is still listening.

**Proxy-only egress works too.** The CLI's connection to Vibes DIY honors the
standard `HTTPS_PROXY`, `HTTP_PROXY`, `ALL_PROXY` and `NO_PROXY` variables. To
pick a proxy for this CLI alone, pass `--proxy <url>` or set `VIBES_PROXY`;
the value `direct` connects without one. Then check the result:

```sh
npx vibes-diy doctor
```

`doctor` only reads. It shows the CLI version, this device's fingerprint, when
its certificate expires, the keybag path, the API URL it resolved, the proxy
decision, and whether the handshake succeeded. If the sandbox can reach the web
but not the CLI's connection, use the [hosted MCP connector](https://good.vibes.diy/docs/claude-connector)
at `https://mcp.vibes.diy/mcp`. It needs no local credential.

**Skip the browser with `VIBES_DEVICE_ID`.** Set `VIBES_DEVICE_ID` to the
contents of an enrolled keybag file, as raw or base64-encoded JSON, and the CLI
authenticates with no login step. A login already in the keybag takes
precedence. The [CI lane pattern](https://good.vibes.diy/docs/patterns/ci-lane-device-certs) has the
full recipe.

**The keybag lives at `~/.fireproof/keybag/<id>.json`.** It holds this
device's private key and certificate. To start fresh, run
`npx vibes-diy login --force`, which re-enrolls this machine, or delete the
keybag file and sign in again. Pointing the CLI at another server with
`--api-url` (or `VIBES_API_URL`) keeps a certificate for that server beside
your vibes.diy one, so you can sign in to both and switch freely; `doctor
--api-url <url>` names the one a command there uses.

**Running several at once? Install once.** Parallel agents can each call the
CLI at the same moment. Install it once, then run the binary directly, and every
run gets the same finished copy:

```sh
npm install --prefix "$HOME/.vibes-cli" vibes-diy@latest
"$HOME/.vibes-cli/node_modules/.bin/vibes-diy" pull you/potluck --published --dir ./potluck
```

Several `npx vibes-diy` runs started together share one npx cache folder and
can trip over each other while it updates (`ENOTEMPTY`, or
`ERR_MODULE_NOT_FOUND` naming `cli/main.ts`). The install above sidesteps that,
and so does giving one run a cache of its own:
`npm_config_cache="$(mktemp -d)" npx -y vibes-diy@latest <command>`.

## Claim your handle

Signing in gets you an account; it does not get you a **handle**. Your handle
is the public name your apps are published under — `vibes.diy/<handle>/<app>` —
and nothing picks one for you, so the first `push`, `publish`, `generate` or
`edit` on a brand-new account stops and asks for one:

```sh
npx vibes-diy claim-handle              # see suggestions — claims nothing
npx vibes-diy claim-handle potluck-pat  # claim that name, and make it your default
npx vibes-diy claim-handle potluck-ci --no-default  # claim it, leave your default alone
```

Run with no name and you get a list of available handles (names derived from
your profile first, random three-word slugs after) plus the command to claim
one. Nothing is reserved until you type a name back — that's the point: the
name is public and permanent-feeling, so it's worth choosing on purpose. If
the name is already taken you're told so, and can just try another.

Claiming also sets the handle as your **default**, so every later command acts
as it without any extra flag. `--no-default` claims the name and leaves your
default where it was — the form a script or CI job uses to mint a handle of its
own.

## Name the app in full: `handle/app-slug`

Every command that touches an app takes it as `handle/app-slug` —
`you/potluck`, `og/pickathon-picker` — and every example on this page is
written that way. A bare `potluck` also works at a terminal: it resolves
through your default handle. That default is per-account state, though, and a
script or an agent can't see what it is at the moment it runs, so **scripts and
agents always name the handle**: `handle/app-slug` on commands that address an
app, `--handle` (or `--vibe handle/app-slug`) on `push` and `generate`, and
`--to handle/app-slug` on `remix`. Each of those commands prints the full
`handle/app-slug` it acted on, so a run can check it landed where it meant to.

## Act as a specific handle (`--handle`)

One account can hold several **handles** (your public `you/…` names). One is
your default — the identity every command uses when you don't say otherwise.
To act as a different one of your handles for a **single command**, pass
`--handle <slug>`:

```sh
npx vibes-diy db put --vibe you/potluck --db signups --handle you-bot '{"rsvp":"yes"}'
npx vibes-diy push --handle you-bot          # publish under you-bot this once
```

`--handle` is **stateless**: it overrides the acting handle for that one
invocation only and never changes your saved default. (To change the default
itself — a persistent switch — use `npx vibes-diy user-settings
--set-default-handle <slug>`.) The handle you pass must already be **bound to
your account**; you can't act as someone else's handle.

Every command that acts as an identity accepts it — `push`, `edit`, `pull`,
`generate`, `put-asset`, `versions`, `publish`, `unpublish`, and all `db`,
`secrets`, `developer`, and `members` subcommands. It's the clean primitive for CI or a
shared device that should write as a dedicated bot handle without disturbing
whoever's default is set on that machine.

## Ship apps from the shell

```sh
npx vibes-diy system > RULES.md     # the coding rules the generator follows
# write App.jsx (and optionally access.js, backend.js) …
npx vibes-diy push --vibe you/potluck   # deploy — prints you/potluck and its live HTTPS URL
```

A pushed `access.js` exports each rule as a function, the same check a chat
edit runs. When the file holds no function the push can bind (an empty file, a
CommonJS export, a plain value), the push stops with a note naming what it
found and the app keeps the rules it already has. To run an app on its sharing
settings alone, delete `access.js` and push.

Or skip the writing part entirely:

```sh
npx vibes-diy generate --handle you "a potluck signup with dish categories"
npx vibes-diy edit you/potluck "add a vegetarian filter"
```

`generate` opens a chat on the same lane as a first prompt on the web: the
server names the app and builds it. Then, by default, `generate` publishes it
the way a website publish does — **reachable by anyone**, or **gated** when the
app is one the build judged privacy-sensitive, with the app's own access rules
governing its documents either way. When your prompt names a real person
alongside their details (an address, a trust or LLC, an account, money matters,
or a whole pasted personal document), the app is published **private** instead,
so those details stay with you; open it up yourself whenever you like. A build that has no `access.js` yet stays
**private** with a note, since nothing would govern what visitors may do with
its data; add an `access.js` and push, or pass `--no-access-fn` to open it
anyway. `--private` publishes it **private** instead — reachable only by you and
the people you approve — whether or not the app already existed. Let those
people in from the shell with `npx vibes-diy members add <handle-or-email>
--vibe you/potluck`: a handle gets access at once, an email gets the invite
link by mail, and `members ls` shows who's in. It then
stays in that conversation, printing the build's progress and writing each version of the
files to disk; in a terminal you can type a follow-up (`/exit` or Ctrl-D to
leave), and under `--json` it returns as soon as the build is done.
It exits **0** when the app is live, and **1** when the run failed. It exits
**3** when an earlier build in the run went live and the last build's version
is unconfirmed: the app is live, so there is no need to build it again. Check
`npx vibes-diy versions you/potluck` and release the newest with
`npx vibes-diy publish you/potluck --fsId <fsId>` if it is newer.
`--record <dir>` keeps a raw transcript of the run for debugging.
A new app's first build runs on our fastest builder (the Lightning build);
`--careful` has the agent plan the whole app first and build it on our most
capable model. `edit` sends
a follow-up prompt to an existing vibe, writes the changed files to disk, and
pushes live. When the new version would crash as the app opens, `edit` keeps it
as a draft instead: the files are on disk, the live link keeps showing your last
release, and the command names the line to fix and exits **1**. Round-trip an app you already have with `pull` / `push`:

```sh
npx vibes-diy pull you/potluck --dir ./potluck   # draft by default; --published for the live release
npx vibes-diy push --vibe you/potluck             # from that directory
```

## Versions, publish, unpublish

```sh
npx vibes-diy versions you/potluck   # every release: fsId, mode, seq — ● marks published
npx vibes-diy pull you/potluck --fsId <id>   # retrieve any historical version
npx vibes-diy publish you/potluck    # promote the latest draft to production
npx vibes-diy unpublish you/potluck  # reversible takedown — code, data, grants all kept
```

Publishing only ever mints a new production release; it never destroys
history, and `unpublish` is a tombstone you can lift with `publish`. While
a vibe is down, its link and its app address stop showing it: visitors and
members get a calm "This app isn't available right now" page within about a
minute, and you still see your app on its page. A link to one specific
version keeps working, and so does a copy someone's browser already holds.
One
caveat that matters when testing: `access.js` and `backend.js` always run
the **live release** — old fsIds serve pinned pages, not pinned backends —
so stage risky backend changes under a secondary slug.

### Pulling a specific version

`versions` prints the release list, and the version menu on your app's page
labels the same releases `v1`, `v2`, `v3`… `pull --version` speaks that label,
so the CLI and the web UI agree about which one is "v3" by construction:

```sh
npx vibes-diy pull you/potluck --version v3   # the version the menu calls v3
npx vibes-diy pull you/potluck --version 3    # the bare number works too
npx vibes-diy pull you/potluck --fsId <id>    # an exact version, by id
npx vibes-diy pull you/potluck --published    # the live production release
```

With no selector at all you get **your latest draft** — the newest thing you
pushed, released or not.

Name a version that doesn't exist and the error tells you what does, instead of
leaving you to guess:

```
Error: No version v9 of you/potluck. Available: v1 (v1 is the published head).
```

And two selectors together is an error, never a silent winner — the flag whose
version you *didn't* want would otherwise be the file you start editing:

```
Error: Pick one version selector, not 2: --version and --published
```

(There is also a `--draft` selector. For your own vibes it does nothing you
don't already get, since the latest draft is the default; it exists so a
platform administrator doing support work on someone else's app has to opt in
explicitly to their unreleased work, because a bare `pull` of a foreign app
serves the published release.)

### Suggestion chips on your app's card

The suggestion chips a visitor sees on your app's edit card are part of that
published release — they're whatever your app last offered when you published,
not whatever your chat said a minute ago. Set them yourself when you want
specific invitations in front of strangers:

```sh
npx vibes-diy app chips you/potluck "Add a signup sheet" "Track who brings what"
npx vibes-diy app chips you/potluck --clear   # show visitors no chips at all
```

Up to three chips (extras are trimmed). This changes what visitors see, not
your own edit card, which keeps following your latest chat turn.

One thing to know: publishing the vibe again re-derives the chips from your
chat and overwrites whatever you set by hand. Set your chips after you
publish, and set them again after your next publish.

## Changing an app's look after it is built

Two different things make up how an app looks, and they change at two different
speeds.

**Colours change now.** A theme (and the style tweaks on top of it) is served
with the app, so saving one is the whole job — nothing is rebuilt. Visitors pick
it up on the next cache beat, within about ten minutes; add `?cb=1` to the app's
URL to see it at once.

**Layout changes on the next build.** Every app is also built with a **layout
archetype** — the shape of the page — and three **flourishes**, the small
touches on its controls and headings. Those live in the app's own code, so
choosing new ones doesn't rearrange anything by itself: it tells the builder what
to use next time. The very next edit you ask for restructures the app onto them,
keeping your data and how the app works.

In the web editor, the **Style** tab starts with whole-style **Presets** and a
**Font** dropdown, followed by colors and a spacing pad. Preview your changes,
then use **Publish style** at the top to make them public; the same button reads
**Published** once the draft matches the published style. **Revert to saved**
restores that published style.

Below those controls, pick an archetype and exactly
three flourishes, press **Save layout**, and then press **Rebuild layout** when
you want the app rearranged right away rather than on your next edit. Some
flourishes are greyed out — an app wearing a house look only offers the ones that
look sits well with, and the one that rules it out is named. The theme picker is
in **Settings**.

From the shell:

```sh
npx vibes-diy app look get you/potluck     # theme, look, style, archetype + flourishes

npx vibes-diy app look set you/potluck --theme slab
npx vibes-diy app look set you/potluck --look newsprint   # same screens in another look, served now
npx vibes-diy app look set you/potluck --variety "card-grid:hover-lift,accent-rule,tint-wash"
npx vibes-diy app look set you/potluck --variety none      # back to no chosen layout
npx vibes-diy app look set you/potluck --variety "list-feed:hover-lift,accent-rule,tint-wash" --relayout
```

Everything the **Look** tab offers has a flag too: the room, the
font, the room's four colour swatches (Lead, Accent, Good, Alert), the spacing pad and
its per-token pins, and draft/publish. Each one changes only what it names:

```sh
npx vibes-diy app look set you/potluck --theme pouf --style rose   # pick a room; keeps font and pad
npx vibes-diy app look set you/potluck --style rose-bold                  # the Bold Rose chip from the Look tab
npx vibes-diy app look set you/potluck --font lora
npx vibes-diy app look set you/potluck --hue-lead 20 --hue-up 140 --hue-down 30
npx vibes-diy app look set you/potluck --pin-gap 200               # or --pin-gap off
npx vibes-diy app look set you/potluck --pad 0.5,-0.25 --pin radius=4px
npx vibes-diy app look set you/potluck --font inter --draft         # save without serving
npx vibes-diy app look set you/potluck --publish                    # serve the draft
npx vibes-diy app look set you/potluck --revert-draft               # drop the draft
```

`--hue-up` and `--hue-down` set the Good and Alert swatches, and `--pin-gap`
locks the Accent swatch at a hue. Good and Alert take the hue the Look tab
shows, and each one moves at most 15°
either side of where the room puts it; a hue past that tells you the range it
can reach. The pad runs −1 to 1 on both axes. `app look get` shows the font,
dials, pad and pins, and marks the colourway "(edited)" once you have turned a
dial. `app look get --json` includes the whole style as `styleBlob`, and
`app look set --style-json '<styleBlob>'` puts it back exactly.

`app look get` also tells you where the current layout came from: drawn for you
when the app was built, chosen at build time, or changed since. `--relayout`
is the one flag that builds something — it asks for the rearrangement
immediately, which spends a build the way any other edit does. Without it,
saving only arms the next one. `npx vibes-diy variety` prints the archetype and
flourish names with what each one does, and a name that isn't one of them is
refused before anything is written, with the valid names listed.

## Your app's data is scriptable

```sh
npx vibes-diy list                                    # your vibes
npx vibes-diy db list  --vibe you/potluck             # its databases
npx vibes-diy db query _id --vibe you/potluck --db dishes # docs by id
npx vibes-diy db get   --vibe you/potluck --db dishes <docId>
npx vibes-diy db put   --vibe you/potluck --db dishes '{"kind":"dish","name":"chili"}'
npx vibes-diy db del   --vibe you/potluck --db dishes <docId>
npx vibes-diy db subscribe --vibe you/potluck --db dishes   # live change tail
```

### Attaching files to a document

`db put` can carry files along with the document. Each `--file` names a file or
a glob, and every match lands on the document as `_files.<filename>` — the same
attachments an app saves from the browser, with a URL your app can show:

```sh
npx vibes-diy db put --vibe you/potluck --db dishes \
  '{"_id":"dish:chili","kind":"dish","name":"chili"}' --file chili.png
npx vibes-diy db put --vibe you/potluck --db dishes \
  '{"_id":"dish:menu","kind":"menu"}' --file 'photos/*.jpg'
```

`--files` is the same flag spelled the other way. Anyone who can write the
app's data can attach files this way, not only its owner. Run it again and
files that haven't changed stay as they are — only new or edited files upload
— and attachments already on the document that you didn't name are kept. Each
file prints `uploaded <name>` or `unchanged <name>` as it goes. Images, text
and JSON attach on any account; other file types ask for a card on file first.

`subscribe` streams document changes as they commit — a real-time tail you
can pipe into anything. These commands are also how external workers join an
app's workflow — see
[doc-status state machines](https://good.vibes.diy/docs/patterns/doc-state-machines).

### Sample data

An app can ship sample records in a `seed.json` beside its code. They land in
the app's real databases when you ask for them — the same thing the **Add
sample data** button in the Data tab does, and what the builder can do for you
in chat:

```sh
npx vibes-diy db seed add    you/potluck   # add the live version's sample records
npx vibes-diy db seed remove you/potluck   # take them out again
```

`add` keeps every record already there, including sample records you edited,
and adds the ones that are missing. `remove` takes the sample records out and
keeps them out until you add sample data again; records people added stay.
Both print what they did per database. Only the app's owner can run them.

### Calling your app's own routes

When your app has a [backend](https://good.vibes.diy/docs/your-app-has-a-backend), `app call` presses
one of its routes as you, signed in — the same call your app's own buttons make:

```sh
npx vibes-diy app call you/shop /go-live                    # POST by default
npx vibes-diy app call you/potluck /rsvp --body '{"name":"Ada"}'
npx vibes-diy app call you/potluck /stats --method GET
```

It prints the status and the route's answer, and exits 0 when the route says
yes (a 2xx), so a script or an agent can carry on from there.

### Running your app's tools

When your backend declares [tools](https://good.vibes.diy/docs/your-app-has-a-backend#tools-the-verbs-a-person-can-ask-for),
`app tools` lists the ones the app offers you, with the input each takes, and
`app call` runs one by name, as you, under the app's own rules:

```sh
npx vibes-diy app tools you/meetup
npx vibes-diy app call you/meetup vote --input '{"place":"Tap Room"}'
npx vibes-diy app call someone/booker book_slot --input '{"day":"Thu"}'
```

A tool name is a bare word in lower snake case; a route starts with `/`. The
listing is yours: a tool for members or the owner shows only to them, on any
app you can open. A tool its maker marked `consequential` asks you at the
terminal first and runs when you answer `y`. From a script or a coding
agent's shell, where nobody is at the terminal to answer, it answers
`needs-confirm` and leaves the app as it was, so you run that one yourself.
`app call` exits 0 when the tool answered ok (or you said no).

### Reading your own vibes, and reading someone else's

The read commands (`get`/`query`/`list`) behave differently depending on whose
vibe you name, and the split is worth knowing before it surprises you.

**Your own vibes** — including any vibe owned by any handle on your account —
read with the owner's admin-mode override applied for you. That's why the CLI
can show you a document your browser session can't: it takes the override lane
your ownership already entitles you to. You never type a flag for this.

**Someone else's vibe** is read as you, with their app's access rules applied
to you like any other visitor. If those rules don't let you see it, the read
is refused:

```
$ npx vibes-diy db list --vibe mike/clone-arrange-luck-soft
Error: Access denied
(reading another owner's vibe: retry with --admin to request platform-admin elevation)
```

That hint is honest about what `--admin` is: a **request**, not a grant.
Adding it asks the server for platform-admin elevation, and the server honors
that only for the short, verified allowlist of platform administrators who do
support work. For everyone else the flag changes nothing — the same read is
refused with or without it. It is not a way to see more of somebody else's
app than they've shared with you.

Writes are honest by default, and `db put --admin` and `db del --admin` are
**not** the same override. Both bypass the older per-database ACL, but only
`del` will proceed past an access function that refuses the operation; a `put`
the access function refuses stays refused, `--admin` or not. That asymmetry is
deliberate rather than an oversight: a delete removes something, while a forced
write would put words in another person's mouth — a document attributed to them
that they never wrote. Every forced delete is audited.

The same allowlist can `push` to an app that already exists under someone
else's handle: that is a support enhancement, audited, and it shows in the
owner's chat as "Automatically enhanced by Vibes DIY".

The full story is in [the access model](https://good.vibes.diy/docs/access-model).

## Secrets, assets, transcripts

```sh
npx vibes-diy secrets set STRIPE_KEY --vibe you/potluck   # backend-only, write-only
npx vibes-diy secrets ls  --vibe you/potluck              # names + last4, never values
npx vibes-diy secrets rm  STRIPE_KEY --vibe you/potluck

npx vibes-diy put-asset ./hero.jpg --vibe you/potluck  # content-addressed upload — prints CID + public URL

npx vibes-diy codegen-log you/potluck # the builder↔LLM transcript that generated the app
npx vibes-diy app-chats  you/potluck  # the app's own runtime AI conversations
```

Secrets surface as `ctx.secrets` in [backend.js](https://good.vibes.diy/docs/your-app-has-a-backend).
`put-asset` returns an immutable, publicly served URL — handy for images your
vibes or blog posts reference. The two transcript commands answer different
questions: `codegen-log` is *how this app got built*, `app-chats` is *what
the app's users asked its AI*.

## The CLI teaches you the platform

```sh
npx vibes-diy skills            # list the codegen skill docs
npx vibes-diy skills backend    # dump one — the same doc rendered at /docs/reference/
npx vibes-diy themes            # the design themes
npx vibes-diy system            # the base system prompt itself
```

These dump the exact documents the code generator reads — the same corpus
published as [the generator's reference](https://good.vibes.diy/docs/reference/), available offline
in your terminal.

## Mount your vibes into any AI agent

```sh
npx vibes-diy mcp --app-slug potluck --handle you
```

starts an MCP server (stdio transport) bound to `you/potluck`, exposing list/get/put/query/delete
over your vibes' data, plus adding and removing an app's sample data — so Claude Code, Cursor, or any MCP-capable agent can
read and write your apps' databases with your device credential and your
access rules. `npx vibes-diy mcp --help` prints the client setup snippet.

## Run your vibe anywhere

<!-- bare-slug: interactive example -->
```sh
npx vibes-diy run jchris/todo          # pull a published vibe, then run it
npx vibes-diy run --dir ./my-app       # run a folder you already have
```

`run` serves a vibe from your own machine or server: its page, its data and
its access rules, all from one folder you own. The first command pulls the
published files into `./todo/` and starts the app; a folder with an
`App.jsx` runs as it is. It prints three things:

- the address to share, `http://localhost:8790/`;
- the app's own origin, `http://todo--jchris.localhost:8790/` (Chrome and
  Firefox resolve every `*.localhost` name to your machine);
- a private **owner link**. Open it once in your browser and you use the app
  as its owner. Everyone else who opens the address is a visitor, with
  exactly what your `access.js` grants a signed-out visitor on vibes.diy. An
  app without `access.js` runs private, for the owner link only. Add an
  `access.js` and restart to open it to visitors.

Everything the app keeps lives in `<dir>/.vibes-run/`: a sqlite database, the
files people upload, the keys this run made for itself, and a cache of the
runtime packages the page loads. Stop the process and start it again and every
document is still there. Point `--state-dir` somewhere else to keep the data
apart from the code.

To run it in production, put it behind a reverse proxy with wildcard DNS and
tell it its public address:

```sh
npx vibes-diy run jchris/todo --dir /srv/todo --state-dir /var/lib/todo \
  --port 8790 --base-url https://vibes.example.com
```

Send both `vibes.example.com` and `*.vibes.example.com` to the port, keeping
the `Host` header, and run it under systemd like any other service.

`callAI` and image generation use your own model backend: set
`LLM_BACKEND_URL` and `LLM_BACKEND_KEY` before you start. Making and changing
vibes stays on vibes.diy, so edit the files (or `pull` a new version) and
restart to pick up a change.

A vibe with a `backend.js` gets its backend too. Its `fetch` handler answers
at the app's own origin under `/_api/`, and its `ctx.db` writes go through
the same `access.js` and land in the same database as the page's. It runs in
Cloudflare's own runtime, `workerd`, which `vibes-diy` brings along as the
optional `miniflare` package. If your install skipped optional packages, `run`
still serves the page, the data and the access rules, and its `/_api/` answers
with how to add the backend. Its `scheduled` handler starts ticking when
`run` starts, and its `onChange` handler wakes after each write, the same as
on vibes.diy.

When your backend calls `ctx.notify`, or someone comments on your app or asks
to join it, a bell lights up in the corner of the page you opened with the owner
link. Click it to read what's new. Notifications are kept with the rest of the
app's data, so they're still there after a restart. Email and phone pushes come
from vibes.diy.

## Updated CLIs keep working as settings grow

Current CLI builds read the user-settings fields they understand and skip
fields a newer server adds, so a server upgrade doesn't break settings
commands. If a settings command fails right after a server upgrade, update
the CLI first — builds older than this tolerance fix still hard-fail on
fields they have never heard of.

## Where to go next

- [CLI command reference](https://good.vibes.diy/docs/cli/reference) — every command and flag,
  generated from `--help`.
- [Generate: one sentence per app](https://good.vibes.diy/generate) — the case study.
- [Patterns cookbook](https://good.vibes.diy/docs/patterns/) — the CLI as the glue in production
  workflows.
