Back to Documentation

Production Deployment

Deploy MovaLab to production with cloud Supabase and your preferred hosting platform.

Deployment Modes

Local Docker

Fully offline development using Supabase Local Stack. Zero cloud costs, complete data privacy.

  • - API: localhost:54321
  • - Studio: localhost:54323
  • - No internet required

Cloud Supabase

Production-ready hosting with automatic backups, real-time collaboration, and managed infrastructure.

  • - Free tier available
  • - Automatic backups
  • - Managed PostgreSQL

Cloud Supabase Setup

1

Create Supabase Project

  1. 1. Go to supabase.com and sign up
  2. 2. Click "New Project"
  3. 3. Choose a name and strong database password
  4. 4. Select your preferred region
  5. 5. Wait for the project to provision (~2 minutes)
2

Get API Credentials

  1. 1. Go to Settings → API in your Supabase dashboard
  2. 2. Copy the Project URL
  3. 3. Copy the anon/public key (publishable key)
  4. 4. Note your project reference (e.g., oomnezdhkmsfjlihkmui)
3

Configure Environment

Create or update your .env.local file:

# Supabase Configuration
NEXT_PUBLIC_SUPABASE_URL=https://your-project-ref.supabase.co
NEXT_PUBLIC_SUPABASE_PUBLISHABLE_DEFAULT_KEY=your-publishable-key

# Optional: Production URL
NEXT_PUBLIC_APP_URL=https://your-app.vercel.app

# Optional: Rate Limiting (Recommended)
UPSTASH_REDIS_REST_URL=https://your-redis.upstash.io
UPSTASH_REDIS_REST_TOKEN=your-token
ENABLE_RATE_LIMIT=true
4

Push Database Schema

# Link to your cloud project
supabase link --project-ref your-project-ref

# Push migrations to cloud
supabase db push
5

Deploy to Vercel

  1. 1. Push your code to GitHub
  2. 2. Connect repository in Vercel dashboard
  3. 3. Add environment variables in Vercel settings
  4. 4. Deploy

Environment Variables Reference

VariableRequiredDescription
NEXT_PUBLIC_SUPABASE_URLYesSupabase project URL
NEXT_PUBLIC_SUPABASE_PUBLISHABLE_DEFAULT_KEYYesSupabase publishable (anon) key
NEXT_PUBLIC_APP_URLNoYour deployed app URL
UPSTASH_REDIS_REST_URLNo*Redis URL for rate limiting
UPSTASH_REDIS_REST_TOKENNo*Redis token for rate limiting
ENABLE_RATE_LIMITNoForce enable rate limiting
LOG_LEVELNoLogging level (error, warn, info, debug)

* Recommended for production to prevent abuse

Switching Environments

Easily switch between local Docker and cloud Supabase by changing environment variables.

Quick Switch Method

Create separate environment files:

# Create environment files
# .env.local.docker - Local development
# .env.local.cloud - Cloud production

# Switch with one command:
cp .env.local.docker .env.local   # Switch to local
cp .env.local.cloud .env.local    # Switch to cloud

# Then restart dev server
npm run dev

Important: Keys Must Match Environment

Local Docker keys only work with localhost URLs. Cloud keys only work with cloud URLs. Mismatched keys will cause authentication failures.

Initial Production Setup

After deploying, complete these steps to set up your organization:

1

Create Superadmin

Sign up, then visit /superadmin-setup to grant yourself admin privileges

2

Build Organization

Create departments and roles via Admin → Roles

3

Invite Team

Team members sign up, you approve via Admin → Pending Users

4

Set Capacity

Users set weekly availability in their profile

5

Create Accounts

Add client accounts and start managing projects

Production Security Checklist

Environment variables configured and not committed to git
Upstash Redis configured for rate limiting
LOG_LEVEL set to 'error' or 'warn'
SUPABASE_SERVICE_ROLE_KEY secured (server-only, never exposed)
All API routes have permission checks
RLS policies tested and verified
Security headers verified (CSP, HSTS)
HTTPS enforced (automatic on Vercel)

Rate Limiting (Recommended)

MovaLab uses Upstash Redis for rate limiting. This prevents abuse and brute force attacks.

# 1. Sign up at https://upstash.com
# 2. Create a Redis database
# 3. Add to your environment:

UPSTASH_REDIS_REST_URL=https://xxx.upstash.io
UPSTASH_REDIS_REST_TOKEN=xxx
ENABLE_RATE_LIMIT=true

Limits: 100 requests/15min for API, 5 requests/15min for auth endpoints.

Additional Resources

For more detailed deployment guides and troubleshooting: