Deployment Platform
The application is deployed on Vercel, the platform built by the creators of Next.js. Vercel provides:- Zero-config deployments for Next.js applications
- Automatic CI/CD from GitHub
- Preview deployments for every pull request
- Edge network for global performance
- Built-in analytics and monitoring
Vercel automatically detects Next.js projects and configures optimal build settings.
Deployment Workflow
The project follows a Git-based deployment workflow:Branch Strategy
main- Production branch (protected)feature/*- Feature development branchesfix/*- Bug fix branchesrefactor/*- Code refactoring branches
Feature Development Process
Review preview deployment
Vercel automatically creates a preview deployment for your PR. The preview URL will be posted as a comment by the Vercel bot.Share the preview URL with stakeholders for review.
Vercel Configuration
Automatic Deployments
Vercel monitors your GitHub repository:| Branch | Deployment Type | URL Pattern |
|---|---|---|
main | Production | your-app.vercel.app |
| Feature branches | Preview | your-app-git-branch-name.vercel.app |
| Pull requests | Preview | your-app-pr-123.vercel.app |
Build Settings
Vercel automatically detects Next.js and uses optimal settings:Environment Variables
Manage environment variables in Vercel dashboard:Access Vercel dashboard
Navigate to your project settings:
https://vercel.com/your-org/your-app/settingsAdd environment variables
Go to Settings → Environment VariablesAdd variables for different environments:
- Production
- Preview
- Development
Local Environment Variables
For local development, create a.env.local file:
.env.local
.env.local file is automatically ignored by git.
Deployment Commands
Using Vercel CLI
Install Vercel CLI for manual deployments:Checking Deployment Status
GitHub Integration
Pull Request Workflow
When you create a PR, Vercel automatically:- Builds your changes
- Deploys to a preview URL
- Comments on the PR with the preview link
- Runs checks and reports build status
PR Checks
Vercel runs these checks on every PR:- ✓ Build successful
- ✓ Type checking passed
- ✓ No build errors
- ✓ Preview deployment ready
Using GitHub CLI
Manage PRs efficiently with GitHub CLI:Build Optimization
The production build is automatically optimized:Next.js Optimizations
- Code splitting - Automatic per-route code splitting
- Image optimization - Automatic image resizing and WebP conversion
- Font optimization - Self-hosted Google Fonts with zero layout shift
- JavaScript minification - Automatic via SWC compiler
- CSS optimization - PostCSS with Tailwind purging
Build Output
Runbun run build to see build analysis:
Monitoring & Analytics
Vercel Analytics
Enable analytics in Vercel dashboard:- Web Vitals - Core Web Vitals metrics
- Real User Monitoring - Performance data from real users
- Audience insights - Visitor demographics
Error Tracking
Integrate error tracking (optional):app/layout.tsx
Rollback Strategy
If issues occur in production:Instant rollback
In Vercel dashboard:
- Go to Deployments
- Find the last working deployment
- Click ⋯ → Promote to Production
Production Checklist
Before merging to production:- All tests pass locally
- TypeScript compilation succeeds (
bun run typecheck) - Linting passes (
bun run lint) - Code is formatted (
bun run format) - Preview deployment reviewed and approved
- No console errors in browser
- Dark mode tested
- Responsive design verified
- Environment variables configured
- No sensitive data in code
Best Practices
Always use preview deployments
Always use preview deployments
Never push directly to main. Always create a PR and review the preview deployment first.
Keep main branch stable
Keep main branch stable
The main branch should always be deployable. Use feature branches for all changes.
Test before merging
Test before merging
Run all quality checks before creating a PR:
Use conventional commits
Use conventional commits
Follow the commit convention for clear history:
Monitor deployments
Monitor deployments
Keep an eye on Vercel dashboard for build failures and performance metrics.
Troubleshooting
Build Failures
If the Vercel build fails:- Check build logs in Vercel dashboard
- Run
bun run buildlocally to reproduce - Fix errors and push changes
- Vercel automatically retries the build
Preview Deployment Issues
If preview URL doesn’t load:- Wait for build to complete (check status in PR)
- Clear browser cache
- Check Vercel function logs for runtime errors
Environment Variable Issues
If environment variables aren’t working:- Verify variables are set in Vercel dashboard
- Check environment (Production/Preview/Development)
- Client-side variables must start with
NEXT_PUBLIC_ - Redeploy to apply new variables
Next Steps
Development Setup
Set up your local development environment
Vercel Documentation
Explore Vercel platform documentation
