Overview

A production-ready boilerplate for subscriptions using Next.js 15, React 19, Supabase, Drizzle ORM, and Dodo Payments. It ships with Google OAuth, subscription checkout, webhook handling, database schema, and a basic dashboard.
If you need only route handlers for an existing app, see the dedicated adaptors: Next.js Adaptor and Express Adaptor.

Prerequisites

  • Node.js 18+ (or Bun 1.0+)
  • Supabase project (URL, Anon key, Service role key, Database URL)
  • Dodo Payments account (API key, Webhook secret)
  • Google Cloud OAuth client (Client ID and Secret)

Quickstart

1

Clone and install

git clone https://github.com/dodopayments/dodo-supabase-subscription-starter.git
cd dodo-supabase-subscription-starter
# choose one
bun install
# or
npm install
# or
pnpm install
2

Create Supabase project

Create a Supabase project and copy:
  • NEXT_PUBLIC_SUPABASE_URL
  • NEXT_PUBLIC_SUPABASE_ANON_KEY
  • SUPABASE_SERVICE_ROLE_KEY
  • DATABASE_URL (Connection string)
3

Configure Google OAuth

Set the redirect URI to: https://[your-project-ref].supabase.co/auth/v1/callback in Google Cloud, then enable Google provider in Supabase Auth using your Client ID and Secret.
4

Configure Dodo Payments

Generate an API key and Webhook secret from the Dodo dashboard. Set environment to test_mode while developing.
5

Create .env.local

# Supabase
NEXT_PUBLIC_SUPABASE_URL=https://your-project-ref.supabase.co
NEXT_PUBLIC_SUPABASE_ANON_KEY=your-anon-key
SUPABASE_SERVICE_ROLE_KEY=your-service-role

# Database
DATABASE_URL=postgresql://postgres:[password]@db.[project-ref].supabase.co:5432/postgres

# Dodo Payments
DODO_PAYMENTS_API_KEY=your-dodo-api-key
DODO_WEBHOOK_SECRET=your-webhook-secret
DODO_PAYMENTS_ENVIRONMENT=test_mode
Never commit secrets. Use environment variables in deployment environments.
6

Provision database schema

bun run db:push
# or
npm run db:push
# or
pnpm run db:push
Tables created: users, subscriptions, payments.
7

Deploy webhook function

# login (one-time)
bunx supabase login
# or
npx supabase login

# deploy the edge function
bun run deploy:webhook --project-ref [your-project-ref]
# or
npm run deploy:webhook -- --project-ref [your-project-ref]
# or
pnpm run deploy:webhook --project-ref [your-project-ref]
cURL
curl -X POST \
  'https://[your-project-ref].supabase.co/functions/v1/dodo-webhook' \
  -H 'Content-Type: application/json' \
  -H 'Dodo-Signature: <signature>' \
  -d '{"type":"payment.succeeded","data":{}}'
8

Add webhook in Dodo Payments

Set endpoint URL to:
https://[your-project-ref].supabase.co/functions/v1/dodo-webhook
Select payment and subscription events.
9

Create products and features

In Dodo dashboard → Products → Create Product. Optionally add metadata:
{
  "features": ["Feature 1", "Feature 2", "Feature 3"]
}
The pricing UI reads this features array and renders it dynamically.
10

Run the dev server

bun run dev
# or
npm run dev
# or
pnpm run dev
Open http://localhost:3000.

What’s included

  • Authentication via Supabase (Google OAuth configured)
  • Subscription checkout via Dodo Payments
  • Supabase Edge Function for webhooks (dodo-webhook)
  • Drizzle ORM schema and migrations
  • Dashboard with invoices, subscription status, and plan features
Keep DODO_PAYMENTS_ENVIRONMENT as test_mode until you complete end-to-end tests.

Key files and paths

supabase/functions/dodo-webhook/
  index.ts            # webhook handler verifying signatures
  deno.json           # permissions

Environment variables

Verification and troubleshooting

You now have a working subscription SaaS scaffolded with Supabase and Dodo Payments.
Original repository and detailed steps: dodo-supabase-subscription-starter.