Setup

Supabase setup

Configure the public environment, hosted project settings, migrations, and login callbacks for this static Cloudflare Pages starter.

Checklist

In Supabase Dashboard > Project Settings > API, use these settings before applying migrations.

Supabase API settings

[YES] Enable Data API
[NO] Automatically expose new tables
[YES] Enable automatic RLS

Command

cp .env.example .env.local

Copy the hosted project URL and anon public key from Supabase Project Settings > API.

.env.local

NEXT_PUBLIC_SUPABASE_URL=https://your-project-ref.supabase.co
NEXT_PUBLIC_SUPABASE_ANON_KEY=your-supabase-anon-key
NEXT_PUBLIC_SITE_URL=http://localhost:3000

In Workers & Pages > your Pages project > Settings > Variables and Secrets, add each key for Production and Preview as needed. NEXT_PUBLIC_* values are bundled into the static browser build, so never add service-role or private API keys.

Cloudflare Pages variables

Use the deployed Pages or custom domain for NEXT_PUBLIC_SITE_URL.

NEXT_PUBLIC_SUPABASE_URL=https://your-project-ref.supabase.co
NEXT_PUBLIC_SUPABASE_ANON_KEY=your-supabase-anon-key
NEXT_PUBLIC_SITE_URL=https://your-production-domain.example

Google login is controlled in src/lib/auth-config.ts. If enabled, configure Google in Supabase provider settings.

Login callback URLs

http://localhost:3000/auth/callback
https://your-production-domain.example/auth/callback
https://your-preview-domain.pages.dev/auth/callback

Google OAuth client

Authorized redirect URI:
https://your-project-ref.supabase.co/auth/v1/callback

Authorized JavaScript origins:
http://localhost:3000
https://your-production-domain.example
https://your-preview-domain.pages.dev

Checklist summary

0%

0 of 7 steps complete. 7 steps remaining.

Completed

0

Remaining

7

Security checks

RLS and public keys

Migration path
Choose one path after API settings are set.

Supabase CLI for a remote project

Run from the repo root. The dry run previews unapplied migrations before db push applies them.

Remote CLI commands

supabase login
supabase link
supabase db push --dry-run
supabase db push

Migration order

supabase/migrations/0001_profiles.sql
supabase/migrations/0002_usernames.sql
supabase/migrations/0003_public_rpc_hardening.sql

Final verification

Run npm run dev, continue with Google or request a magic link, then save profile fields.