vibes.diy ← Creator Docs
vibes connect · use-vibes

Your app's data,
everywhere it needs to be.

The same Fireproof database that powers your Vibes app is reachable from any JavaScript runtime. Subscribe to live changes, write records from cron jobs, build webhooks, sync to external services — without ever leaving your stack.

Node.js Deno Bun Cloudflare Workers AWS Lambda Any npm runtime
what it is

One package. Every surface.

use-vibes is the bridge between the database inside your Vibes app and the rest of your infrastructure. Install it anywhere npm packages run, point it at your app's appSlug, and you have full read/write access with live WebSocket subscriptions.

Real-time subscriptions

WebSocket-backed subscribe() fires your callback on every change — from any connected writer, anywhere in the world.

Full read/write

put, get, del, query. Write records from scripts, crons, or service workers. Read them back with index queries.

🔒

Same auth, zero config

Reuses the device cert from npx vibes-diy login. No API keys to rotate, no separate service account to manage.

Instance caching

Multiple fireproof() calls in one process share one WebSocket connection. Scale to hundreds of databases without multiplying sockets.

Works in Workers

Deploy to Cloudflare Workers or AWS Lambda. Pass explicit getToken and userSlug for stateless, CI-friendly execution.

ESM-native

Import from npm or directly via esm.sh for Deno / Bun. No build step required for scripting use cases.

quickstart

Up in two commands

Authenticate once per device.

npx vibes-diy login$ npx vibes-diy login

Install the package.

npm install use-vibes$ npm install use-vibes

Then connect to your app's database. You need the appSlug from its URL (vibes.diy/vibe/<userSlug>/appSlug) and the database name your App.jsx passes to fireproof().

import { fireproof } from "use-vibes"; const db = fireproof("todos", { appSlug: "my-todo-app" }); // Read const { docs } = await db.query("status", { key: "open" }); // Write const ok = await db.put({ type: "todo", text: "hello from Node", status: "open" }); // Subscribe to live changes db.subscribe((changes) => { console.log("update:", changes); }, true);import { fireproof } from "use-vibes";

const db = fireproof("todos", { appSlug: "my-todo-app" });

// Read
const { docs } = await db.query("status", { key: "open" });

// Write
const ok = await db.put({ type: "todo", text: "hello from Node", status: "open" });

// Subscribe to live changes
db.subscribe((changes) => {
  console.log("update:", changes);
}, true);
what people build

Connect everything

Once your app's data is reachable from a script, the integration surface is unlimited.

automation

Cron-powered workflows

Write a daily digest, expire old records, or seed fresh data on a schedule. A ten-line Node script + a cron is all it takes.

integration

Webhook fan-out

Subscribe to database changes and forward them to Slack, Discord, email, or any HTTP endpoint — without polling.

backend

Serverless API layer

Wrap your Vibes database in a Cloudflare Worker or Lambda to expose validated REST or GraphQL endpoints to other clients.

data

Export & reporting

Pull records with allDocs() or indexed queries, transform them, and push to a data warehouse, spreadsheet, or BI tool.

devtools

Seed & migration scripts

Batch-write initial data, migrate schema across document versions, or copy records between app slugs during development.

ai

AI pipeline triggers

Subscribe to new user submissions and pipe them into an LLM workflow — summarize, classify, embed, or generate replies automatically.

sync

Multi-surface sync

Keep a mobile app, a dashboard, and a backend script all reading the same live database with zero reconciliation code.

monitoring

Health & alerting

Subscribe to error or event records written by your Vibes app and trigger PagerDuty, SMS, or email when thresholds are crossed.

how it works

Under the hood

01

Login stores a device certificate

npx vibes-diy login authenticates you and stores a long-lived device cert in a local keybag. Every subsequent call to fireproof() picks it up automatically — no tokens to copy, no env vars to set for local use.

02

appSlug routes to your database namespace

Vibes apps live at vibes.diy/vibe/<userSlug>/<appSlug>. When you pass appSlug to fireproof(), the library resolves your userSlug automatically from your logged-in account and opens the matching database namespace.

03

One WebSocket, many databases

All fireproof() instances in a process share one multiplexed WebSocket to the Vibes sync server. Open ten databases — you still have one socket. Subscriptions are demultiplexed automatically.

04

Writes propagate to the browser instantly

Records written from your backend script appear in the Vibes app's UI within milliseconds — the same sync path that handles browser-to-browser collaboration handles script-to-browser too.

ci & serverless

Explicit config for stateless environments

For Cloudflare Workers, AWS Lambda, GitHub Actions, or any environment without a device keybag — pass all options explicitly.

import { fireproof } from "use-vibes"; const db = fireproof("todos", { apiUrl: "https://vibes.diy/api", appSlug: "my-todo-app", userSlug: "alice", getToken: async () => ({ token: process.env.VIBES_TOKEN }), });import { fireproof } from "use-vibes";

const db = fireproof("todos", {
  apiUrl: "https://vibes.diy/api",
  appSlug: "my-todo-app",
  userSlug: "alice",
  getToken: async () => ({ token: process.env.VIBES_TOKEN }),
});

Start connecting today.

Open your Vibes app, copy the appSlug from its URL, find the fireproof() call in App.jsx, and run npx vibes-diy login. You'll have live data in your script in under five minutes.