Skip to main content

Overview

Supabase provides the authentication, database, and serverless functions infrastructure for your subscription application. This guide walks you through creating a new Supabase project and obtaining the necessary credentials.

Create a Supabase Project

1

Sign up or log in to Supabase

Go to Supabase and create an account or log in to your existing account.
2

Create a new project

Click on New Project and fill in the following details:
  • Project name: Choose a descriptive name for your subscription app
  • Database password: Create a strong password (save this - you’ll need it later)
  • Region: Select the region closest to your users
  • Pricing plan: Choose the Free tier to start
Project provisioning typically takes 2-3 minutes. Wait for the project status to show as “Active” before proceeding.
3

Get your API credentials

Once your project is active, navigate to SettingsAPI.Copy the following values - you’ll need them for your .env.local file:
  • Project URL: This is your NEXT_PUBLIC_SUPABASE_URL
  • Anon/Public Key: This is your NEXT_PUBLIC_SUPABASE_ANON_KEY
  • Service Role Key: This is your SUPABASE_SERVICE_ROLE_KEY (used for webhook functions)
The Service Role Key has admin privileges and should never be exposed in client-side code or committed to version control. Only use it in secure server environments like Supabase Functions.
4

Get your database connection string

Navigate to SettingsDatabase.Scroll down to the Connection String section and select the URI tab.Copy the connection string and replace [YOUR-PASSWORD] with the database password you created in Step 2.This is your DATABASE_URL:
postgresql://postgres:[YOUR-PASSWORD]@db.[project-ref].supabase.co:5432/postgres
5

Save your project reference

Your project reference ID is visible in your project URL:
https://[your-project-ref].supabase.co
Save this project reference - you’ll need it when deploying webhook functions.

Environment Variables

Add these values to your .env.local file:
# Supabase Configuration
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-key

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

Next Steps

Google OAuth

Configure Google authentication for user sign-in

Database Setup

Set up your database schema with Drizzle

Build docs developers (and LLMs) love