← All work

Open source · Creator · design and engineering · 2026 · MIT

billing-kit: open-source billing that gets the money right

Stripe + Paystack

one codebase, a ledger that balances by construction

  • Next.js 15
  • TypeScript
  • Postgres
  • Drizzle
  • Stripe
  • Paystack
  • Vitest
  • Playwright
billing-kit admin ledger showing accounts and balances

Challenge

Every SaaS rebuilds the same four things badly: a provider integration, a ledger that is really a balance column, webhook handlers that double-charge on retry, and a dunning flow made of cron jobs and hope. Teams charging in naira and dollars build it twice.

Approach

I designed and built billing-kit as one opinionated starter on Next.js 15 and Postgres. Money is bigint minor units, never floats. The ledger is append-only double entry with the zero-sum rule enforced by a Postgres trigger, so an unbalanced entry cannot exist. Webhooks are verified on the raw body, deduplicated by event id, and processed in savepoints so a failure retries instead of vanishing. Subscriptions run on an explicit state machine with daily proration, a day 0, 3, 5, 7 dunning schedule, and idempotent cron jobs. A magic-link portal and an operator admin let anyone trace a kobo from settlement to revenue.

Outcome

Version 1.0 shipped in September 2026 with 255 unit tests against a real Postgres, 16 end-to-end tests, and CI on every push. It is the reference implementation for my writing on ledgers, edge experiments, and event tracking, and the starting point for every billing project I take on.