env.kv
Free, Creator, Pro
Scoped key-value storage for counters, caches, idempotency keys, and lightweight state between runs.
Backing: Cloudflare KV
Usage: Each key is automatically prefixed per pulse at runtime, so your code uses clean keys while storage stays isolated.
const count = Number((await env.kv.get("visits")) ?? "0");
await env.kv.put("visits", String(count + 1), { expirationTtl: 300 });
return { visits: count + 1 };
env.secrets
Creator, Pro
Call external APIs without exposing secret values in your pulse memory (zero-gap protection model).
Backing: Dispatch proxy + encrypted secret storage
Usage: Use env.secrets.get() + env.fetch() for natural code, or env.secrets.fetch() for explicit injection rules.
if (!env.secrets.has("OPENAI_API_KEY")) {
return { error: "Configure OPENAI_API_KEY first" };
}
const token = env.secrets.get("OPENAI_API_KEY");
const response = await env.fetch("https://api.openai.com/v1/models", {
headers: { Authorization: "Bearer " + token },
});
return await response.json();
env.connections
Free (1), Creator (3), Pro (unlimited)
Use OAuth-connected provider accounts without manually storing provider access tokens in your code.
Backing: OAuth connection tokens via dispatch
Usage: Get an opaque provider token handle and pass it through env.fetch().
const githubToken = env.connections.get("github");
const me = await env.fetch("https://api.github.com/user", {
headers: {
Authorization: "Bearer " + githubToken,
"User-Agent": "vibecodr-pulse",
},
});
return await me.json();
env.db / env.Pro_User_Binding
Pro only
Run SQL queries against your per-user D1 database for relational and transactional workflows.
Backing: Native Cloudflare D1 binding
Usage: The binding is added at deploy time when your pulse uses env.db and the owner is on Pro.
if (!env.db) {
return { error: "This pulse needs Pro for env.db" };
}
await env.db.query(
"CREATE TABLE IF NOT EXISTS Pulse_orders (id TEXT PRIMARY KEY, total_cents INTEGER)"
);
await env.db.query(
"INSERT INTO Pulse_orders (id, total_cents) VALUES (?, ?)",
[crypto.randomUUID(), 1999]
);
const { results } = await env.db.query("SELECT COUNT(*) AS total FROM Pulse_orders");
return results[0];
env.fetch
Free, Creator, Pro
Perform outbound HTTP requests with SSRF and infrastructure block protections.
Backing: Safe fetch wrapper + Outbound/dispatch policy checks
Usage: Use env.fetch for normal outbound calls; it is also token-aware for env.secrets/env.connections patterns.
const res = await env.fetch("https://api.weather.com/v1/forecast?city=SF");
if (!res.ok) {
throw wrapAsVibeError(new Error("Upstream error: " + res.status), "proxy.storageFailed");
}
return await res.json();
env.env + env.log + env.waitUntil
Free, Creator, Pro
Access pulse identifiers/version, write request-scoped logs, and schedule non-blocking background work.
Backing: Runtime metadata + execution context
Usage: Use env.env for metadata, env.log for traceability, and env.waitUntil() for async follow-up after response.
env.log.info("pulse metadata", env.env);
env.waitUntil(env.kv.put("last-run-at", new Date().toISOString()));
return { pulseId: env.env.pulseId, version: env.env.version };