# Patterns cookbook

> Production patterns for building serious apps out of vibe primitives — credential vaults, doc-status state machines, CI lanes, scheduled self-maintenance, scheduled mirrors of outside records, operator consoles, deploy buttons, and notifications.

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

When we asked an agent to build the platform's own social-mention bot, it
[picked a vibe as the production home](https://good.vibes.diy/blog/the-agent-picked-a-vibe) — not a
worker, not a queue, not a cron server. These are the patterns that make that
choice work: each one composes stock primitives (a Fireproof database, an
`access.js` rule, a `backend.js` lane, the CLI) into something you'd
otherwise provision infrastructure for.

Every pattern here runs in production today, in the vibes that operate this
platform's own publishing and growth loops. Most pages end with a live
exemplar you can remix — **remix copies code, never data**, so the whole
security model transfers to you and the original's credentials stay home.

## The patterns

- **[The write-only credential vault](https://good.vibes.diy/docs/patterns/write-only-vault)** — a
  database no browser can read back, holding real API tokens. The secret
  store you'd otherwise pay a cloud provider for.
- **[Doc-status state machines](https://good.vibes.diy/docs/patterns/doc-state-machines)** —
  documents walking `pending → done` as a message bus between your backend,
  your UI, and external workers. The queue you don't have to run.
- **[The CI lane with a device cert](https://good.vibes.diy/docs/patterns/ci-lane-device-certs)** —
  let GitHub Actions (or any script) read and write your app's data with the
  CLI, holding no API tokens at all.
- **[Scheduled self-maintenance](https://good.vibes.diy/docs/patterns/scheduled-self-maintenance)** —
  apps that rotate their own credentials and clean up after themselves on a
  timer.
- **[A scheduled mirror of another system's records](https://good.vibes.diy/docs/patterns/scheduled-mirror)** —
  a shop's orders, a CRM's contacts or a calendar's events copied into your
  app on a timer, one record per outside id, with your people's notes kept
  beside them. An order email can ring a doorbell for the fast path.
- **[The operator console for free](https://good.vibes.diy/docs/patterns/operator-console)** — your
  `App.jsx` *is* the admin dashboard, with the same access control as
  everything else.
- **[The deploy button](https://good.vibes.diy/docs/patterns/deploy-button)** — database ACLs as
  capability grants: who may press the button is who may write the doc.
- **[Telling one person vs. telling everyone](https://good.vibes.diy/docs/patterns/notifications)** —
  `ctx.notify` reaches one participant's bell, inbox, and push; for everyone
  else there's no broadcast API, because the database already is one.

New to backends? Start with the
[backend.js guide](https://good.vibes.diy/docs/your-app-has-a-backend), then come back — most
patterns lean on the `scheduled` lane's identity model.
