Deployment Options Overview
Thalyson’s Portfolio is a Next.js application that can be deployed to various platforms. This guide covers multiple deployment strategies, from the recommended Vercel deployment to self-hosted options.Platform Comparison
| Platform | Best For | Difficulty | Next.js Support |
|---|---|---|---|
| Vercel | Production apps | Easy | Excellent |
| Netlify | Static sites | Easy | Good |
| AWS Amplify | AWS ecosystem | Medium | Good |
| Docker | Self-hosted | Advanced | Excellent |
| VPS/Cloud | Full control | Advanced | Excellent |
Vercel Deployment (Recommended)
Vercel is the company behind Next.js and provides the best deployment experience with zero configuration.Prerequisites
- GitHub/GitLab/Bitbucket account with your repository
- Vercel account (free tier available)
- Project built successfully locally (
npm run build)
Step-by-Step Vercel Deployment
Create Vercel Account
Visit vercel.com and sign up with your GitHub, GitLab, or Bitbucket account.
Import Repository
- Click “Add New Project”
- Select “Import Git Repository”
- Choose your portfolio repository
- Grant Vercel access if prompted
Vercel automatically detects Next.js projects and configures build settings.
Configure Project Settings
Vercel auto-detects the following from
package.json:5-11:- Framework Preset: Next.js
- Build Command:
npm run build - Output Directory:
.next(automatic) - Install Command:
npm install - Development Command:
npm run dev
Configure Environment Variables
If your project uses environment variables, add them in the Vercel dashboard:
- Go to Project Settings → Environment Variables
- Add each variable:
- Key:
NEXT_PUBLIC_API_URL - Value:
https://api.example.com - Environment: Production, Preview, Development
- Key:
Deploy
Click “Deploy” and wait for the build to complete (usually 1-3 minutes).Vercel will:
- Install dependencies
- Run
npm run build - Deploy to global CDN
- Generate a unique preview URL
Environment Variables Configuration
How to Add Environment Variables in Vercel
How to Add Environment Variables in Vercel
Add Variables
- Enter variable name (e.g.,
NEXT_PUBLIC_API_URL) - Enter value
- Select environments: Production, Preview, Development
Custom Domain Setup
Add Domain in Vercel
- Go to Project Settings → Domains
- Enter your domain (e.g.,
thalyson.dev) - Click “Add”
Configure DNS Records
Add these records to your domain registrar:For apex domain (For www subdomain (
thalyson.dev):www.thalyson.dev):Wait for DNS Propagation
DNS changes can take 24-48 hours to propagate. Vercel automatically provisions SSL certificates once DNS is configured.
Vercel automatically redirects HTTP to HTTPS and handles SSL certificate renewal.
Preview Deployments
Vercel creates automatic preview deployments for:- Every commit: Pushed to any branch
- Every pull request: With unique URL
- Every branch: Continuous deployment
your-project-git-branch-name.vercel.app
Alternative Deployment Platforms
Netlify Deployment
Netlify is another popular platform for deploying Next.js applications.AWS Amplify Deployment
Deploy to AWS Amplify for integration with AWS services.Docker Deployment
For containerized deployments, use Docker with the official Next.js example.Self-Hosted (VPS/Cloud) Deployment
Deploy to your own server with PM2 or systemd.Environment Variables for Production
Required Variables
Depending on your features, you may need:Performance Monitoring
Vercel Analytics
Vercel provides built-in analytics:Core Web Vitals Monitoring
Monitor Performance Metrics
Monitor Performance Metrics
Track Core Web Vitals in production:This tracks:
- LCP (Largest Contentful Paint)
- FID (First Input Delay)
- CLS (Cumulative Layout Shift)
- FCP (First Contentful Paint)
- TTFB (Time to First Byte)
Third-Party Monitoring
Post-Deployment Checklist
After deploying, verify everything works:Functional Testing
- All pages load correctly
- Navigation works across all routes
- Forms submit successfully
- Images load and are optimized
- Links work (internal and external)
- Contact form sends emails
Performance Testing
- Run Lighthouse audit (target: 90+ scores)
- Check Core Web Vitals
- Verify image optimization (WebP/AVIF served)
- Test mobile performance
- Check First Contentful Paint < 1.8s
- Verify Time to Interactive < 3.8s
SEO Verification
- Meta tags are correct
- Open Graph images display
- Sitemap is accessible (
/sitemap.xml) - Robots.txt is configured
- Structured data is valid
- Social media cards render correctly
Security Checks
- HTTPS is enforced
- Security headers are set
- No sensitive data exposed
- API keys are in environment variables
- CORS is properly configured
- Rate limiting is in place
Continuous Deployment Setup
Automated Deployments
With Vercel, deployments are automatic:- Push to Git: Every push triggers a build
- Pull Requests: Get preview deployments
- Main Branch: Automatically deploys to production
GitHub Actions (Alternative CI/CD)
Custom GitHub Actions Workflow
Custom GitHub Actions Workflow
Create
.github/workflows/deploy.yml:Rollback Procedures
Vercel Rollback
Rollbacks are instant on Vercel. Your site reverts to the selected deployment immediately.
Manual Rollback
For self-hosted deployments:Troubleshooting Common Deployment Issues
Build Fails in Production but Works Locally
Build Fails in Production but Works Locally
Possible causes:
- Environment variables not set
- Different Node.js versions
- Missing dependencies
Images Not Loading
Images Not Loading
Cause: Remote image domains not configuredSolution: Verify
next.config.ts:9-16 includes all image domains:API Routes Return 404
API Routes Return 404
Cause: Routes not properly configuredSolution: Ensure API routes are in
app/api/ directory and properly exportedEnvironment Variables Undefined
Environment Variables Undefined
Cause: Variables not set in deployment platformSolution:
- Add variables in platform dashboard
- Redeploy after adding variables
- Verify variable names match exactly (case-sensitive)
Next Steps
After successful deployment:- Monitor Performance: Set up analytics and error tracking
- SEO Optimization: Submit sitemap to Google Search Console
- Social Media: Test Open Graph cards on social platforms
- CDN: Verify global CDN distribution
- Backups: Set up automated backups if self-hosted
- Documentation: Keep deployment docs updated