Skip to main content

Deployment

Client Portal is deployed across two platforms: Netlify for the frontend SPA and Supabase Cloud for the backend (database, auth, edge functions, storage).

Frontend: Netlify

Auto-Deploy

The frontend auto-deploys on every push to the main branch. Netlify watches the GitHub repository and triggers a build automatically.

Build Configuration

From netlify.toml:

[build]
command = "npm run build"
publish = "dist"

[[redirects]]
from = "/*"
to = "/index.html"
status = 200

The redirect rule is critical -- it ensures all routes in the React SPA are handled by index.html (client-side routing via React Router).

Build Command

npm run build

This runs Vite's production build, outputting static assets to dist/.

Environment Variables (Netlify)

These must be set in Netlify's environment variable settings:

VariableDescription
VITE_SUPABASE_URLSupabase project URL (e.g., https://xxxx.supabase.co)
VITE_SUPABASE_ANON_KEYSupabase anonymous/public key
warning

Variables prefixed with VITE_ are embedded in the client bundle at build time. Never put secrets (service role key, API keys) in VITE_ variables. Those are for edge functions only.

Preview Deploys

Netlify creates preview deploys for pull requests. Each PR gets a unique URL for testing before merge.

Backend: Supabase Cloud

Edge Function Deployment

Edge functions are deployed individually using the Supabase CLI:

# Deploy a single function
supabase functions deploy <function-name>

# Deploy all functions
supabase functions deploy
info

Edge functions are not auto-deployed on git push. They must be deployed manually using the Supabase CLI after changes.

Edge Function Secrets

Secrets are set via the Supabase CLI and are available as environment variables inside edge functions:

# Set a secret
supabase secrets set ANTHROPIC_API_KEY=sk-ant-...

# List secrets
supabase secrets list

Current secrets:

SecretUsed By
ANTHROPIC_API_KEYsummarize-sales-call
BLITZ_API_KEYblitz-enrich-attorney-contacts, blitz-update-sparse-attorneys
RESEND_API_KEYsend-booking-notification, send-meeting-reminder, send-onboarding-email
CLOSE_API_KEYcreate-close-lead, close-webhook-handler
SLACK_WEBHOOK_URLsend-slack-notification

Database Migrations

Migrations are applied via the Supabase CLI:

# Apply pending migrations
supabase db push

# Check migration status
supabase migration list

See the Migration Guide for details on creating and managing migrations.

Local Development

# Start local Supabase stack (Postgres + Auth + Edge Functions)
supabase start

# Serve edge functions locally
supabase functions serve

# Stop local stack
supabase stop

Local Dev Server

# Install dependencies
npm install

# Start Vite dev server
npm run dev

# Preview production build locally
npm run preview

Deployment Checklist

When deploying changes that span both frontend and backend:

  1. Database migrations first -- Run supabase db push to apply schema changes before deploying code that depends on them.
  2. Edge functions second -- Deploy any changed edge functions with supabase functions deploy <name>.
  3. Frontend last -- Push to main to trigger Netlify auto-deploy, or the frontend may already be deployed if merged.
Order Matters

If frontend code references a new database column or edge function that does not exist yet, the app will break. Always deploy backend changes before frontend changes that depend on them.

Monitoring

  • Netlify: Build logs and deploy status in the Netlify dashboard
  • Supabase: Edge function logs in the Supabase dashboard under Functions > Logs
  • Database: Query performance and connection metrics in Supabase dashboard under Database

Repository

GitHub: https://github.com/1-Hour-Automation/client-hub.git
Branch: main (production)