GitHub Repository
Boilerplate subscription Next.js + Supabase + Dodo Payments minimal
Live Demo
Lihat demo yang telah di-deploy
Ringkasan
Boilerplate siap produksi untuk subscription menggunakan Next.js 15, React 19, Supabase, Drizzle ORM, dan Dodo Payments. Paket ini mencakup Google OAuth, checkout subscription, penanganan webhook, skema database, dan dashboard dasar.Jika Anda hanya memerlukan route handler untuk aplikasi yang sudah ada, lihat adaptor khusus berikut: Adaptor Next.js dan Adaptor Express.
Prasyarat
- Node.js 18+ (atau Bun 1.0+)
- Project Supabase (URL, Anon key, Service role key, Database URL)
- Akun Dodo Payments (API key, Webhook secret)
- Client OAuth Google Cloud (Client ID dan Secret)
Mulai cepat
1
Clone and install
2
Create Supabase project
Buat project Supabase dan salin:
- NEXT_PUBLIC_SUPABASE_URL
- NEXT_PUBLIC_SUPABASE_ANON_KEY
- SUPABASE_SERVICE_ROLE_KEY
- DATABASE_URL (Connection string)
3
Configure Google OAuth
Atur redirect URI ke:
https://[your-project-ref].supabase.co/auth/v1/callback di Google Cloud, lalu aktifkan provider Google di Supabase Auth menggunakan Client ID dan Secret Anda.4
Configure Dodo Payments
Buat API key dan Webhook secret dari dashboard Dodo. Atur environment ke
test_mode selama pengembangan.5
Create .env.local
6
Provision database schema
Tabel yang dibuat:
users, subscriptions, payments.7
Deploy webhook function
cURL
8
Add webhook in Dodo Payments
Atur endpoint URL ke:Pilih event pembayaran dan subscription.
9
Create products and features
Di dashboard Dodo → Products → Create Product. Tambahkan metadata jika diperlukan:UI harga membaca array
features ini dan merendernya secara dinamis.10
Run the dev server
Yang disertakan
- Autentikasi melalui Supabase (Google OAuth telah dikonfigurasi)
- Checkout subscription melalui Dodo Payments
- Supabase Edge Function untuk webhook (
dodo-webhook) - Skema dan migrasi Drizzle ORM
- Dashboard dengan invoice, status subscription, dan fitur paket
File dan path penting
- Edge Function
- Next.js routes
- Database (Drizzle)
Environment variables
Supabase
Supabase
Dodo Payments
Dodo Payments
Google OAuth
Google OAuth
Verifikasi dan pemecahan masalah
Webhook signature invalid (401)
Webhook signature invalid (401)
- Pastikan
DODO_WEBHOOK_SECRETsesuai dengan nilai dari dashboard Dodo - Pastikan Anda telah men-deploy function
dodo-webhookterbaru - Verifikasi nama header sudah benar di function Anda (Dodo-Signature)
Database push fails
Database push fails
- Periksa sintaks
DATABASE_URLdan network egress Supabase - Tunggu sekitar 2–3 menit setelah pembuatan project sebelum melakukan push pertama
OAuth redirect mismatch
OAuth redirect mismatch
- Redirect URI harus berupa
https://[ref].supabase.co/auth/v1/callback - Pastikan nilainya sama di Google Cloud dan provider Supabase Auth
Sekarang Anda memiliki scaffold SaaS subscription yang berfungsi dengan Supabase dan Dodo Payments.
Repository asli dan langkah-langkah terperinci: dodo-supabase-subscription-starter.