Your app's live data is accessible outside the browser — from Node, Deno, Bun, Cloudflare Workers, or any runtime that can run npm packages.
Login once per device — stores a device cert in your keybag.
Install the package. Works with npm, pnpm, and yarn.
// Deno / Bun: import { fireproof } from "https://esm.sh/use-vibes"
Connect to the same database that backs your Vibes app. You need two things from your vibe's URL (vibes.diy/vibe/userSlug/appSlug): the appSlug, and the database name your App.jsx passes to fireproof().
fireproof("todos", { appSlug }) — opens the named database within that vibe; pass appSlug explicitly so the script works from any directoryput(doc) — write a document; returns { id, clock }get(id) — fetch a document by idquery(field, opts) — index query by field valuesubscribe(fn, true) — live updates over WebSocket; second arg fires immediately with current stateWhen you call fireproof("todos") with no options, these defaults apply in order.
| Field | Default |
|---|---|
| apiUrl | VIBES_DIY_API_URL env var, then https://vibes.diy/api |
| appSlug | VIBES_APP_SLUG env var, then basename(process.cwd()) — pass explicitly to avoid connecting to the wrong vibe |
| getToken | device cert from npx vibes-diy login keybag |
| userHandle | looked up automatically from your account on first request (pass it to skip the round-trip) |
For CI, Wrangler, or service accounts — environments without a device keybag.
These rules apply per process — important for long-running scripts and Workers.
fireproof("todos") === fireproof("todos") — same name returns the same instance within a process_files field) are not yet supported — pure document workflows onlyawait-to-server calls shown here.These are the only methods. Do not use others.
| Method | Notes |
|---|---|
| put(doc) | Write a document. Returns { id, clock }. verified |
| get(id) | Fetch a document by id. verified |
| del(id) | Delete a document by id. verified |
| query(field, opts) | Index query by field value. verified |
| subscribe(fn, runNow?) | Live updates over WebSocket. Second arg fires immediately. verified |
| allDocs(opts?) | Fetch all documents. listed, unverified |
| bulk(docs) | Batch write. listed, unverified |
Cron-powered workflows, webhook fan-out, export & reporting, seed and
migration scripts, health checks, multi-surface sync. Two ways to run
them: hosted — every vibe can ship a
backend.js with
webhook endpoints, change reactions, and scheduled jobs built in, no
server of yours required — or in your own stack with this
package, when the logic needs to live beside your existing code, secrets,
or CI. The production recipes for both are in the
patterns cookbook.
Open your Vibes app, grab the appSlug from its URL and the database name from your App.jsx, and start reading data from your script.