Appearance
Supabase Setup Guide
This guide explains how to connect Supabase with this project for both database (PostgreSQL) and storage.
Prerequisites
- A Supabase account
Database Setup (PostgreSQL with Prisma)
Step 1: Create a Supabase Project
- Go to Supabase Dashboard
- Click "New Project"
- Select your organization (or create one)
- Fill in:
- Project name: Your project name (e.g.,
saaspilot) - Database Password: Generate a strong password and save it securely
- Region: Choose the closest region to your users
- Project name: Your project name (e.g.,
- Click "Create new project"
- Wait for the project to be provisioned (takes 1-2 minutes)
Step 2: Get Database Connection URLs
- In your Supabase project dashboard, click the Connect button at the top.
- A window will pop up with several connection options—select the ORMs tab.
- You’ll now see two codes:
DATABASE_URLandDIRECT_URL. Copy both. - Open your project’s
.envfile and paste each code on its own line. - Make sure the database password section matches the password you set when creating your Supabase project.
Step 3: Run Migrations
sh
npm run db:generate
npm run db:pushStorage Setup
Step 1: Create a Supabase Project
- Go to your Supabase project dashboard
- Click on Project Settings (gear icon)
- Click on Data API in the left menu
- Under Project URL, copy the URL
(https://[PROJECT_REF].supabase.co). This is yourSUPABASE_URL - Paste it in the
.envfileSUPABASE_URL="https://[PROJECT_REF].supabase.co"
Step 2: Get Supabase Secret Key
- In the same project settings page
- Click on API keys in the left menu
- You'll see two keys (Publishable key and Secret keys)
- Copy the secret key. This is your
SUPABASE_SECRET_KEY - Paste it in the
.envfileSUPABASE_SECRET_KEY="sb_secret_-----------"
Step 3: Create a Storage Bucket
- In your Supabase dashboard, click on Storage in the sidebar
- Click "New bucket"
- Enter a bucket name (e.g., saaspilot)
- Configure bucket settings:
- Public bucket: Toggle ON
- File size limit: Set as needed (e.g., 50MB)
- MIME types: Leave empty for all types, or specify (e.g., image/*)
- Click "Create bucket", this bucket name is your
SUPABASE_BUCKET_NAME - Set this in the
.envfileSUPABASE_BUCKET_NAME="sasspilot"
