✦ Stack

Next.js + Supabase + Stripe

The complete SaaS stack — auth, database, billing, deploy — wired in days, not months.

The full SaaS stack in one combo

Next.js + Supabase covers the app. Stripe covers the money. Together, they deliver everything a subscription SaaS needs: auth, multi-tenancy, billing, prorating, dunning, refunds, customer-managed cancellations.

How the billing wiring actually works

The naive integration is "redirect to Stripe Checkout, hope for the best." The production-grade pattern:

  1. Customer hits the upgrade button — server action creates a Stripe Checkout session with metadata containing the workspace ID.
  2. Customer pays — Stripe redirects them back to a success page with a polling check.
  3. In parallel, Stripe sends a checkout.session.completed webhook to /api/stripe/webhook.
  4. The webhook handler verifies the signature, looks up the workspace ID from the metadata, and writes a row to the workspace_subscriptions table.
  5. The Supabase realtime channel notifies the success page that the subscription is active. Page redirects to dashboard.

Idempotency keys on every Stripe call prevent double-billing if a webhook is retried. The subscription table is the source of truth — never trust the user's session claim of "I'm on Pro," always check the database.

What I include by default

  • 3-tier pricing page (Solo / Team / Enterprise) — easy to add more.
  • Free trial logic — configurable per tier, automatic conversion or downgrade.
  • Customer Portal integration — users self-serve cancellations, downgrades, payment method updates.
  • Dunning flow — failed-payment retry logic, customer notification emails, automatic suspension after N retries.
  • Annual + monthly cycles with proration on tier changes.
✦ Good for
  • Subscription SaaS
  • Multi-tier pricing
  • Free trial → paid conversion flows
  • B2B with team plans
✦ Skip if
  • One-time payment products (Stripe Checkout works but is overkill)
  • Marketplaces (use Stripe Connect — different stack)
  • Crypto/web3 payments
✦ Built with this stack

Masevo

Social media advertising platform built for churches. Multi-tenant, scheduled posts, AI content drafts — the whole thing.

Read the case study →
✦ Keep reading

Build on Next.js + Supabase + Stripe?

See pricing