Production Deployment
This guide covers deploying the André Ruperto Portfolio to production. The application consists of a React frontend and Express backend that can be deployed together or separately.Pre-deployment Checklist
Environment variables
Ensure all production environment variables are configured:
Never use development credentials in production!
Deployment Options
Option 1: Traditional VPS (DigitalOcean, Linode, etc.)
Configure Nginx
Set up Nginx as a reverse proxy:Enable the site:
/etc/nginx/sites-available/portfolio
Option 2: Vercel (Frontend) + Railway (Backend)
Deploy backend to Railway
- Sign up at railway.app
- Create a new project
- Add PostgreSQL database
- Deploy from GitHub:
- Connect repository
- Set root directory to
backend/ - Add environment variables
- Note the backend URL
Deploy frontend to Vercel
- Sign up at vercel.com
- Import project from GitHub
- Configure build settings:
- Build Command:
npm run build:prod - Output Directory:
backend/dist
- Build Command:
- Add environment variables (if needed)
- Update API proxy to point to Railway backend
Option 3: Docker Deployment
Build Scripts
The project provides optimized build scripts:Production Build
- Copies images to build directory
- Cleans previous build artifacts
- Runs Vite build with production optimizations
- Outputs to
backend/dist/
Development Build
- Builds with source maps
- Less aggressive optimizations
- Easier debugging
Post-Deployment
CI/CD with GitHub Actions
Automate deployments with GitHub Actions:.github/workflows/deploy.yml
Updating Production
To update your production deployment:Performance Optimization
- Enable gzip compression in Nginx
- Set up CDN for static assets
- Configure browser caching
- Enable HTTP/2
- Optimize images before deployment
- Use PostgreSQL connection pooling
Security Checklist
- HTTPS enabled with valid SSL certificate
- Strong, unique passwords and secrets
- CORS properly configured
- Rate limiting enabled on API
- Database not publicly accessible
- Environment variables properly secured
- Regular security updates
- Firewall configured (UFW, iptables)
Support
For deployment issues:- Check server logs
- Verify environment variables
- Ensure PostgreSQL is accessible
- Test API endpoints individually
- Review Nginx configuration
