Ship metered billing to a live SaaS.
Plans the work, edits real files, and runs the tests — then leaves you a working revenue dashboard, so one operator ships like an engineering team.
import { stripe } from "../lib/stripe";export async function POST(req: Request) { const sig = req.headers.get("stripe-signature"); const evt = stripe.webhooks.constructEvent(body, sig, SECRET); if (evt.type === "invoice.paid") await recordUsage(evt);export function aggregate(events: UsageEvent[]) { return events.reduce((acc, e) => acc + e.units, 0);}export const rollupHourly = (orgId: string) => meter.flush(orgId);export const TIERS = [ { id: "solo", base: 0, perUnit: 0.004 }, { id: "scale", base: 49, perUnit: 0.002 },];export function MrrCard({ series }: Props) { const mrr = series.at(-1) ?? 0; return <Card title="MRR">{format(mrr)}</Card>;}const plan = "flat";const plan = resolveTier(org.usage);await meter.record(org.id, units);plan: text("plan").default("flat"),usageEvents: many(usageEvent),meteredAt: timestamp("metered_at"),Monthly recurring revenue
illustrative · redraws in-browser on toggle
Usage this period
1.24M / 2.0M metered events
how it works
Pre-recorded transcript and a static diff — no live AI calls, no keys, nothing to break. The dashboard chart on the Preview tab is the one genuinely live piece: real numbers, redrawn in your browser when you switch 6M / 12M.