Overview
The Incidents web dashboard is built with Next.js 16 and can be deployed to various hosting platforms. This guide covers deployment to Vercel, the recommended platform for Next.js applications.Prerequisites
- Node.js 20+ installed
- Git repository for your project
- Vercel account (or alternative hosting platform)
- Supabase project configured
Local Development
Start development server
Building for Production
Test the production build locally before deploying:The build process compiles TypeScript, optimizes assets, and generates static pages where possible.
Deploying to Vercel
Vercel provides zero-configuration deployment for Next.js apps.Method 1: Deploy with Vercel CLI
Method 2: Deploy with GitHub Integration
Import to Vercel
- Visit vercel.com/new
- Import your GitHub repository
- Configure project settings
Configure build settings
Vercel auto-detects Next.js projects. Set the root directory to
web if needed:- Framework Preset: Next.js
- Root Directory:
web - Build Command:
npm run build - Output Directory:
.next
Add environment variables
In Vercel project settings, add:
NEXT_PUBLIC_SUPABASE_URLNEXT_PUBLIC_SUPABASE_ANON_KEY
With GitHub integration, Vercel automatically deploys on every push to your main branch.
Alternative Hosting Platforms
Netlify
Self-Hosted with Docker
Create aDockerfile in the web directory:
web/Dockerfile
For Docker deployment, enable standalone output in
next.config.ts:Environment Configuration
The web app uses environment variables for configuration. All client-side variables must be prefixed withNEXT_PUBLIC_.
Required Variables
Client vs Server Variables
Performance Optimization
Enable Caching
Configure caching headers for static assets:next.config.ts
Image Optimization
Next.js automatically optimizes images. Configure external image domains:next.config.ts
Monitoring and Analytics
Vercel Analytics
Add Vercel Analytics to track performance:app/layout.tsx
Continuous Deployment
With GitHub integration:- Production: Pushes to
mainbranch deploy to production - Preview: Pull requests generate preview deployments
- Rollback: Easily rollback to previous deployments in Vercel dashboard
Branch Deployments
Configure branch-specific environment variables:mainbranch → Production environmentstagingbranch → Staging environment- Feature branches → Preview environments
Troubleshooting
Build Errors
Type errors during build:Runtime Errors
Supabase connection issues:- Verify environment variables are correctly set
- Check Supabase project is not paused
- Ensure anon key has correct permissions
Next Steps
Environment Variables
Configure all required environment variables
Supabase Setup
Set up and configure your Supabase backend