Skip to content

Supabase Setup Guide

This guide explains how to connect Supabase with this project for both database (PostgreSQL) and storage.

Prerequisites

Database Setup (PostgreSQL with Prisma)

Step 1: Create a Supabase Project

  1. Go to Supabase Dashboard
  2. Click "New Project"
  3. Select your organization (or create one)
  4. 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
  5. Click "Create new project"
  6. Wait for the project to be provisioned (takes 1-2 minutes)

Step 2: Get Database Connection URLs

  1. In your Supabase project dashboard, click the Connect button at the top.
  2. A window will pop up with several connection options—select the ORMs tab.
  3. You’ll now see two codes: DATABASE_URL and DIRECT_URL. Copy both.
  4. Open your project’s .env file and paste each code on its own line.
  5. 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:push

Storage Setup

Step 1: Create a Supabase Project

  1. Go to your Supabase project dashboard
  2. Click on Project Settings (gear icon)
  3. Click on Data API in the left menu
  4. Under Project URL, copy the URL (https://[PROJECT_REF].supabase.co). This is your SUPABASE_URL
  5. Paste it in the .env file SUPABASE_URL="https://[PROJECT_REF].supabase.co"

Step 2: Get Supabase Secret Key

  1. In the same project settings page
  2. Click on API keys in the left menu
  3. You'll see two keys (Publishable key and Secret keys)
  4. Copy the secret key. This is your SUPABASE_SECRET_KEY
  5. Paste it in the .env file SUPABASE_SECRET_KEY="sb_secret_-----------"

Step 3: Create a Storage Bucket

  1. In your Supabase dashboard, click on Storage in the sidebar
  2. Click "New bucket"
  3. Enter a bucket name (e.g., saaspilot)
  4. Configure bucket settings:
    1. Public bucket: Toggle ON
    2. File size limit: Set as needed (e.g., 50MB)
    3. MIME types: Leave empty for all types, or specify (e.g., image/*)
  5. Click "Create bucket", this bucket name is your SUPABASE_BUCKET_NAME
  6. Set this in the .env file SUPABASE_BUCKET_NAME="sasspilot"

Built with SaasPilot