Next.js · Supabase · Stripe

Stop rebuilding billing for every AI app.

CreditKit ships the part nobody else does. A real credits system, usage metering, and a worker that refunds the user when a job fails.

One time. Full source, yours forever.

Why credits are hard

The three bugs it kills by default

AI features cost you real money per call, so a flat price falls apart the first time a heavy user shows up. You have to sell credits. And credits bite you every time.

Overselling

Two requests land at once and the balance goes negative. You gave work away for free.

Double-charging

Stripe retries a webhook and the same purchase grants credits twice.

No refund on failure

A job dies after you charged, and the user is out money and emailing you.

How it works

How CreditKit handles credits

1

User buys credits

Stripe credit packs or subscriptions.

2

Atomic spend

One Postgres update that can't go negative, even under load.

3

Worker runs the job

A background queue picks it up and processes it.

4

Done, or refunded

If the job fails, the credits go back automatically.

What you get

Everything in the box

Not a demo. The code that already runs my own paying apps.

Credits engine

Atomic and idempotent. Every change logged.

Stripe billing

Credit packs and subscriptions, webhook-driven.

Auto-refund worker

Job dies, credits come back.

Passwordless auth

Email-code login, no resets.

Row-level security

Every row locked to its owner.

Usage dashboard

Balance, history, packs.

Email, built in

Resend, already wired.

Full source, in TS

Next.js 15, Supabase, Stripe, Tailwind.

Who made it
"I didn't build this once to sell it. I shipped 10+ real, paying apps on this exact code, then pulled it out and cleaned it up. You're buying something that already survived real users and real Stripe webhooks at 2am."
Algy · youngalgy.com

Skip the week of plumbing.

$129

One time. Full source, yours forever.

Get CreditKit
Next.js 15 · Supabase · Stripe · TypeScript · Tailwind · Resend · passwordless auth · row-level security · dashboard