Overview
BudgetView is a Next.js application designed for deployment on modern hosting platforms. This guide covers production deployment, environment configuration, and best practices.BudgetView is optimized for serverless deployment with automatic scaling and global CDN distribution.
Deployment Options
Vercel
Recommended platform with zero-config Next.js support and automatic CI/CD
Netlify
Alternative platform with similar features and generous free tier
Self-Hosted
Docker or Node.js deployment on your own infrastructure
Prerequisites
Before deploying, ensure you have:Vercel Deployment (Recommended)
Initial Setup
Connect Repository
- Visit vercel.com and sign in
- Click “Add New Project”
- Import your Git repository
- Select the repository containing BudgetView
Configure Build Settings
Vercel auto-detects Next.js projects. Verify these settings:
- Framework Preset: Next.js
- Build Command:
npm run build - Output Directory:
.next(auto-detected) - Install Command:
npm install - Node Version: 18.x or higher
Set Environment Variables
Add required variables in Vercel dashboard:
| Variable | Value | Source |
|---|---|---|
NEXT_PUBLIC_SUPABASE_URL | https://xxxxx.supabase.co | Supabase → Settings → API |
NEXT_PUBLIC_SUPABASE_PUBLISHABLE_KEY | eyJhbGc... | Supabase → Settings → API → anon public |
Continuous Deployment
Vercel automatically deploys on Git push:mainbranch → Production deployment- Feature branches → Preview deployments with unique URLs
- Pull requests → Automatic preview comments
Custom Domain
Add a custom domain in Vercel:Netlify Deployment
Setup Instructions
Connect Repository
- Visit netlify.com and sign in
- Click “Add new site → Import an existing project”
- Choose your Git provider and repository
Environment Variables
Add in Site settings → Environment variables:
NEXT_PUBLIC_SUPABASE_URLNEXT_PUBLIC_SUPABASE_PUBLISHABLE_KEY
Netlify-Specific Configuration
Create anetlify.toml file in your project root:
Self-Hosted Deployment
Using Node.js
Deploy directly on a VPS or dedicated server:Using Docker
Create aDockerfile:
docker-compose.yml
Environment Variables
Required Variables
| Variable | Required | Description | Example |
|---|---|---|---|
NEXT_PUBLIC_SUPABASE_URL | Yes | Supabase project URL | https://abc123.supabase.co |
NEXT_PUBLIC_SUPABASE_PUBLISHABLE_KEY | Yes | Supabase anon public key | eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9... |
Optional Variables
| Variable | Default | Description |
|---|---|---|
PORT | 3000 | Server port |
NODE_ENV | production | Environment mode |
Validating Configuration
The application checks for required environment variables on startup:app/login/page.tsx
Build Configuration
Next.js Config
Thenext.config.js file can be customized:
next.config.js
Package.json Scripts
Performance Optimization
- Build Time
- Runtime
- Database
- Enable SWC minification (default in Next.js 13+)
- Use
npm ciinstead ofnpm installin CI/CD - Cache
node_modulesbetween builds - Disable source maps in production
Monitoring & Logging
Vercel Analytics
Enable in project settings:- Go to Analytics tab
- Enable Web Analytics
- View real-time metrics: pageviews, unique visitors, top pages
Error Tracking
Integrate Sentry for error monitoring:sentry.client.config.js
Application Logs
For self-hosted deployments, use PM2 logs:Database Migrations
Manage Supabase schema changes:Always test migrations in a development environment before applying to production.
Security Checklist
Environment Variables
✓ Never commit
✓ Use different Supabase projects for dev/prod
✓ Rotate API keys if exposed
.env.local to Git✓ Use different Supabase projects for dev/prod
✓ Rotate API keys if exposed
HTTPS
✓ Enable SSL certificate (automatic on Vercel/Netlify)
✓ Force HTTPS redirects
✓ Use HSTS headers
✓ Force HTTPS redirects
✓ Use HSTS headers
Database Security
✓ Row Level Security enabled on all tables
✓ Service role key never exposed to client
✓ Regular database backups
✓ Service role key never exposed to client
✓ Regular database backups
Troubleshooting
Rollback Strategy
If a deployment causes issues:- Vercel
- Self-Hosted
- Go to Deployments tab
- Find previous working deployment
- Click ⋯ → Promote to Production
- Instant rollback (no rebuild required)
Backup & Disaster Recovery
Database Backups
Supabase Pro plan includes automatic daily backups. For manual backups:Code Backups
- Git repository serves as source code backup
- Tag production releases:
git tag v1.0.0 - Push to multiple remotes for redundancy
Production Checklist
Before going live:- Environment variables configured
- SSL certificate active
- Database RLS policies tested
- Error tracking enabled
- Backup strategy in place
- Custom domain configured (optional)
- Analytics enabled
- Performance tested under load
- Authentication flows verified
- Email templates customized (Supabase)
For architecture details, see the System Architecture page.
