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
Create Supabase Project
- 1. Go to supabase.com and sign up
- 2. Click "New Project"
- 3. Choose a name and strong database password
- 4. Select your preferred region
- 5. Wait for the project to provision (~2 minutes)
Get API Credentials
- 1. Go to Settings → API in your Supabase dashboard
- 2. Copy the Project URL
- 3. Copy the anon/public key (publishable key)
- 4. Note your project reference (e.g.,
oomnezdhkmsfjlihkmui)
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
Push Database Schema
# Link to your cloud project supabase link --project-ref your-project-ref # Push migrations to cloud supabase db push
Deploy to Vercel
- 1. Push your code to GitHub
- 2. Connect repository in Vercel dashboard
- 3. Add environment variables in Vercel settings
- 4. Deploy
Environment Variables Reference
| Variable | Required | Description |
|---|---|---|
| NEXT_PUBLIC_SUPABASE_URL | Yes | Supabase project URL |
| NEXT_PUBLIC_SUPABASE_PUBLISHABLE_DEFAULT_KEY | Yes | Supabase publishable (anon) key |
| NEXT_PUBLIC_APP_URL | No | Your deployed app URL |
| UPSTASH_REDIS_REST_URL | No* | Redis URL for rate limiting |
| UPSTASH_REDIS_REST_TOKEN | No* | Redis token for rate limiting |
| ENABLE_RATE_LIMIT | No | Force enable rate limiting |
| LOG_LEVEL | No | Logging 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:
Create Superadmin
Sign up, then visit /superadmin-setup to grant yourself admin privileges
Build Organization
Create departments and roles via Admin → Roles
Invite Team
Team members sign up, you approve via Admin → Pending Users
Set Capacity
Users set weekly availability in their profile
Create Accounts
Add client accounts and start managing projects
Production Security Checklist
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: