Skip to main content
This guide covers all configuration steps needed to connect your application to Supabase, Dodo Payments, and Google OAuth.

Environment Variables Setup

1

Create Environment File

Copy the example environment file to create your local configuration:
cp .env.example .env.local
The .env.local file will contain all your sensitive configuration values.
2

Configure Variables

Open .env.local and fill in the following variables:
NEXT_PUBLIC_SUPABASE_URL=
NEXT_PUBLIC_SUPABASE_ANON_KEY=
DATABASE_URL=
DODO_PAYMENTS_API_KEY=
DODO_WEBHOOK_SECRET=
DODO_PAYMENTS_ENVIRONMENT=

Supabase Configuration

1

Create Supabase Project

  1. Go to Supabase and sign in
  2. Click New Project
  3. Choose your organization
  4. Enter a project name and database password
  5. Select a region close to your users
  6. Click Create new project
Project provisioning takes 2-3 minutes. Wait for it to complete before proceeding.
2

Get API Credentials

Navigate to SettingsAPI in your Supabase project:
NEXT_PUBLIC_SUPABASE_URL=https://your-project-ref.supabase.co
NEXT_PUBLIC_SUPABASE_ANON_KEY=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9...
Copy:
  • Project URLNEXT_PUBLIC_SUPABASE_URL
  • Anon/Public KeyNEXT_PUBLIC_SUPABASE_ANON_KEY
The anon key is safe to use in client-side code. Never expose the service role key in your frontend.
3

Get Database Connection String

Navigate to SettingsDatabase in your Supabase project:
DATABASE_URL=postgresql://postgres:[YOUR-PASSWORD]@db.[PROJECT-REF].supabase.co:5432/postgres
Copy the Connection String and replace [YOUR-PASSWORD] with your database password.

Google OAuth Setup

1

Create Google Cloud Project

  1. Go to Google Cloud Console
  2. Click Select a projectNew Project
  3. Enter a project name and click Create
2

Enable Google+ API

  1. In your Google Cloud project, go to APIs & ServicesLibrary
  2. Search for “Google+ API”
  3. Click on it and press Enable
3

Create OAuth Credentials

  1. Go to APIs & ServicesCredentials
  2. Click Create CredentialsOAuth client ID
  3. If prompted, configure the OAuth consent screen first:
    • Choose External user type
    • Fill in required app information
    • Add your email as a test user
  4. For Application type, select Web application
  5. Add authorized redirect URI:
    https://[your-project-ref].supabase.co/auth/v1/callback
    
  6. Click Create
  7. Copy the Client ID and Client Secret
4

Configure Google Provider in Supabase

  1. In your Supabase project, go to AuthenticationProviders
  2. Find Google and click to expand
  3. Toggle Enable Google Provider
  4. Paste your Client ID and Client Secret
  5. Click Save

Dodo Payments Configuration

1

Create Dodo Payments Account

  1. Sign up at Dodo Payments
  2. Complete the onboarding process
  3. Verify your email address
2

Get API Key

  1. Navigate to SettingsAPI Keys
  2. Copy your API key:
DODO_PAYMENTS_API_KEY=dodo_sk_test_...
Keep your API key secure. Never commit it to version control or expose it in client-side code.
3

Get Webhook Secret

  1. Navigate to SettingsWebhooks
  2. Copy your webhook signing secret:
DODO_WEBHOOK_SECRET=whsec_...
4

Set Environment Mode

Set the payment environment to test mode during development:
DODO_PAYMENTS_ENVIRONMENT=test_mode
Change this to live_mode when deploying to production.

Final Environment File

Your complete .env.local should look like this:
# Supabase Configuration
NEXT_PUBLIC_SUPABASE_URL=https://your-project-ref.supabase.co
NEXT_PUBLIC_SUPABASE_ANON_KEY=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9...

# Database URL (from Supabase Settings → Database)
DATABASE_URL=postgresql://postgres:[password]@db.[project-ref].supabase.co:5432/postgres

# Dodo Payments Configuration
DODO_PAYMENTS_API_KEY=dodo_sk_test_...
DODO_WEBHOOK_SECRET=whsec_...
DODO_PAYMENTS_ENVIRONMENT=test_mode

Initialize Database Schema

With your environment variables configured, push the database schema to Supabase:
npm run db:push
This creates three tables in your database:
  • users - Stores user account information
  • subscriptions - Tracks active and past subscriptions
  • payments - Records payment history and invoices
Your application is now configured and ready for deployment!

Next Steps

Proceed to Deployment to deploy the webhook handler and run your application for the first time.

Build docs developers (and LLMs) love