Documentation
Supabase setup
PhyCalcPro uses Supabase for email/password and magic-link sign-in, plus cloud storage of saved projects and calculation history. The site runs in guest mode until you complete this checklist.
1. Create a project
Sign in at supabase.com/dashboard and create a new project (free tier). Save the database password.
2. Apply the schema
Prefer the versioned migrations under supabase/migrations, or open SQL Editor and run scripts/workspace_schema.sql (includes RLS). Optional entitlement/feedback tables: docs/supabase-schema.sql.
3. Configure auth
- Authentication → Providers → Email — enable Email (password + magic link). Require email confirmation for new sign-ups.
- Authentication → URL configuration — set Site URL to your app URL and allow redirects to
/auth/callback,/account, and/auth/reset-passwordon localhost and production. - Full production steps (SMTP, backups, CAPTCHA, Sentry): see
docs/Auth-Security-Operator-Checklist.md.
4. Environment variables
Copy keys from Project Settings → API into .env.local (local) and Vercel Environment Variables (production):
NEXT_PUBLIC_SUPABASE_ENABLED=true NEXT_PUBLIC_SUPABASE_URL=https://xxxx.supabase.co NEXT_PUBLIC_SUPABASE_ANON_KEY=eyJ... SUPABASE_SERVICE_ROLE_KEY=eyJ... NEXT_PUBLIC_APP_URL=https://your-domain.com NEXT_PUBLIC_FREE_LAUNCH=true
NEXT_PUBLIC_SUPABASE_ENABLED must be exactly true. Keep NEXT_PUBLIC_FREE_LAUNCH=true to unlock all calculator features while billing stays hidden.
5. Deploy
Restart npm run dev locally or redeploy on Vercel after saving env vars. Open Account and send a magic link to verify sign-in.
Behavior
- Guest — calculations and history stay in this browser tab until it closes.
- Signed in — saved projects and calculation history sync to Supabase and reload on any device.
Avoid project pause
Free Supabase projects may pause after long inactivity. Log into the dashboard periodically or upgrade to Pro for always-on production use.