Scrawn is a self-hostable usage-based billing backend that replaces 60+ lines of billing boilerplate with a single function call. It ingests billable events, evaluates your pricing logic, and hooks into Dodo Payments for collection — no cron jobs, no manual gRPC plumbing.
Built on Bun, Fastify, gRPC, and PostgreSQL / ClickHouse.
- Bun
- Docker
- A Dodo Payments account
The Scrawn CLI automates the entire local stack — just run:
bunx scrawn@latest init
bunx scrawn@latest startThis generates the docker-compose config and starts PostgreSQL, ClickHouse, the gRPC server, and the dashboard — all in the background.
bunx scrawn@latest stop # Graceful stop, preserves data
bunx scrawn@latest reset # Wipes all data volumesimport { scrawn } from "@scrawn/core";
const biller = scrawn({
apiKey: process.env.SCRAWN_KEY,
baseURL: process.env.SCRAWN_BASE_URL,
httpUrl: process.env.SCRAWN_HTTP_URL,
});
// Track usage in one line
await biller.basicUsageEventConsumer({
userId: "cus_123",
debit: 4500,
});Complete API reference and integration guides: scrawn.vercel.app/docs