Chuyển đến nội dung chính

GitHub Repository

Minimal Next.js + Supabase + Dodo Payments subscription boilerplate

Live Demo

Explore the deployed demo

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

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

Never commit secrets. Use environment variables in deployment environments.
6

Provision database schema

Tables created: users, subscriptions, payments.
7

Deploy webhook function

cURL
8

Add webhook in Dodo Payments

Set endpoint URL to:
Select payment and subscription events.
9

Create products and features

In Dodo dashboard → Products → Create Product. Optionally add metadata:
The pricing UI reads this features array and renders it dynamically.
10

Run the dev server

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

Environment variables

Verification and troubleshooting

  • Ensure DODO_WEBHOOK_SECRET matches the value from Dodo dashboard
  • Confirm you deployed the latest dodo-webhook function
  • Verify the header name is correct in your function (Dodo-Signature)
  • Check DATABASE_URL syntax and Supabase network egress
  • Wait ~2–3 minutes after project creation before first push
  • Redirect URI must be https://[ref].supabase.co/auth/v1/callback
  • Ensure the same in Google Cloud and Supabase Auth provider
You now have a working subscription SaaS scaffolded with Supabase and Dodo Payments.
Original repository and detailed steps: dodo-supabase-subscription-starter.
Lần sửa đổi cuối 1 tháng 4, 2026