Day 5: Launch
5.3 Final Deployment
Goal: Deploy your application to Vercel, configure custom domains, environment variables, and production database, and verify everything works correctly.
Process: Follow this chat pattern with an AI chat tool such as Claude.ai. Pay attention to the notes in [brackets] and replace the brackets with your own thoughts and ideas.
Timeframe: 60-90 minutes
Table of Contents
- 5.3.1: Creating/Logging into Vercel
- 5.3.2: Connecting Your GitHub Repository
- 5.3.3: Setting Up Your Vercel Project
- 5.3.4: Deployment Options
- 5.3.5: Custom Domain & SSL Configuration
- 5.3.6: Environment Variables Configuration
- 5.3.7: Database Configuration for Production
- 5.3.8: Vercel Deployment Process
- 5.3.9: Production Testing & Verification
- 5.3.10: Deployment Documentation
5.3.1: Creating/Logging into Vercel
I need to deploy my Next.js application to Vercel. Please guide me through:
1. Creating a Vercel account or logging in
2. Best practices for connecting my GitHub repository
3. Optimal project configuration settings
- Go to Vercel and sign up or log in
- If signing up, you can use GitHub, GitLab, or email authentication
5.3.2: Connecting Your GitHub Repository
Now that I have a Vercel account, how do I connect my GitHub repository and what permissions should I grant?
- In the Vercel dashboard, click "Add New..." → "Project"
- Select "Import Git Repository" and authorize Vercel to access your GitHub account
- Select the repository containing your Next.js application
- If needed, click "Configure GitHub App" to grant access to specific repositories
5.3.3: Setting Up Your Vercel Project
What are the optimal build settings for my Next.js project on Vercel? Should I use the default settings or customize them?
- Vercel will automatically detect Next.js and suggest optimal settings
- Verify the framework preset shows "Next.js"
- Configure your project name (this will be used in your deployment URL)
- For build settings, keep the defaults for a standard Next.js project:
- Build Command:
next build - Output Directory:
.next - Install Command:
npm install(oryarn installif using Yarn)
- Build Command:
5.3.4: Deployment Options
What deployment options should I consider for my project? Which branch should I deploy from, and are there any region-specific considerations?
- Choose your preferred deployment branch (usually "main" or "master")
- Select your preferred deployment regions if available
- Click "Deploy" to initiate your first deployment
5.3.5: Custom Domain & SSL Configuration
I want to set up a custom domain for my application. Please guide me through:
1. Adding a custom domain to my Vercel project
2. Setting up the necessary DNS records
3. Verifying domain ownership
4. Ensuring SSL certificates are properly configured
5. Verifying the domain is working correctly
Adding Your Custom Domain
- From the Vercel dashboard, select your project
- Navigate to "Settings" → "Domains"
- Click "Add" and enter your domain name
- Choose the domain configuration type (usually "Primary Domain")
Setting Up DNS Records
- Vercel will provide the necessary DNS records to configure
- Log in to your domain registrar (GoDaddy, Namecheap, etc.)
- Find the DNS management section
- Add the records Vercel suggests:
- For apex domains (example.com): Add an A record pointing to Vercel's IP
- For subdomains (www.example.com): Add a CNAME record pointing to Vercel
Verifying Domain Ownership
- Return to Vercel and click "Verify" next to your domain
- Vercel will check if the DNS records are properly configured
- If verification fails, wait for DNS propagation (can take up to 48 hours) and try again
SSL Certificate Setup
- Vercel automatically provisions SSL certificates for verified domains
- No manual action is required for SSL configuration
- Your certificate will automatically renew before expiration
Verification
- Once DNS propagation is complete, visit your domain to verify it's working
- Check that HTTPS is working correctly (lock icon in browser)
- Test on both desktop and mobile devices
5.3.6: Environment Variables Configuration
I need to configure environment variables for my production deployment. Please advise on:
1. How to add environment variables in Vercel
2. The different types of environment variables
3. Best practices for storing sensitive information
4. Which variables should be configured for production
5. How to verify my environment variables are working correctly
Adding Environment Variables
- In the Vercel dashboard, select your project
- Navigate to "Settings" → "Environment Variables"
- Click "Add New" for each variable you need to add
- Enter the variable name and value
- Select the appropriate environments (Development, Preview, Production)
Environment Variable Types
- Production: Used in your production deployment
- Preview: Used in preview deployments (PR review environments)
- Development: Used in local development with Vercel CLI
Secure Storage of Sensitive Information
- All environment variables in Vercel are encrypted at rest
- Never commit sensitive environment variables to your repository
- Use Vercel's environment variable UI for all sensitive values
- Consider using Vercel's integration with secret management tools for team environments
Recommended Variables to Configure
- API keys for all third-party services
- Database connection strings
- Authentication secrets (JWT tokens, cookie secrets)
- Payment processing keys (Stripe, etc.)
- Feature flags for production environment
Verification
- After deployment, verify your environment variables are working correctly
- Check functionalities that depend on environment variables
- Monitor logs for any environment variable-related errors
5.3.7: Database Configuration for Production
I need to configure my database for production use with Vercel. Please provide guidance on:
1. Connecting to a production database
2. Security best practices for database configuration
3. Handling database migrations in production
4. Setting up monitoring and maintenance procedures
Connecting to Your Production Database
- Ensure your database service is configured for production use
- Set up appropriate firewalls to only allow connections from Vercel's IP ranges
- Create a dedicated production database user with appropriate permissions
- Configure your connection string as an environment variable in Vercel
Security Best Practices
- Enable SSL/TLS for database connections
- Use connection pooling appropriate for serverless environments
- Set appropriate connection limits
- Enable database encryption at rest if available
- Regularly backup your production database
Database Migrations
- Configure your migration strategy for production deployments
- Consider using database migration tools compatible with Vercel
- Test migrations in a staging environment before applying to production
- Have a rollback plan for failed migrations
Monitoring and Maintenance
- Set up database monitoring tools
- Configure alerts for database performance issues
- Establish a regular backup schedule
- Document database schema and relationships
5.3.8: Vercel Deployment Process
I'm ready to deploy my application to production. Please walk me through:
1. Pre-deployment checklist to ensure everything is ready
2. The actual deployment process
3. Post-deployment verification steps
4. Monitoring my deployment for issues
Pre-Deployment Checklist
- Run all tests locally to ensure code quality
- Verify all environment variables are configured
- Test your application with production-like environment variables
- Check your build output locally using
next build - Review your Git repository for any sensitive information
Deployment Process
- Commit and push your final changes to your deployment branch
- Vercel will automatically start building your application
- Monitor the build process in the Vercel dashboard
- If the build fails, review the logs to identify and fix issues
Post-Deployment Verification
- Test critical user flows on the deployed application
- Verify all API endpoints are functioning correctly
- Check that database connections are working
- Test authentication and authorization
- Verify payment processing (if applicable)
- Test on multiple devices and browsers
Monitoring Your Deployment
- Review the deployment details in Vercel dashboard
- Check the deployment logs for any warnings or errors
- Monitor application performance using Vercel Analytics
- Set up alerts for critical errors or performance issues
5.3.9: Production Testing & Verification
Now that my application is deployed, what should I test to ensure everything is working correctly in production? Please provide a comprehensive testing plan.
Critical User Flows to Test
- User registration and login
- Core application functionality
- Payment processing and subscription management
- Account settings and profile management
- Any data import/export features
Cross-Browser and Device Testing
- Test on Chrome, Firefox, Safari, and Edge
- Verify mobile responsiveness on iOS and Android devices
- Check tablet displays and orientation changes
- Verify desktop experience at different screen resolutions
Performance Testing
- Run Lighthouse tests on key pages
- Check Core Web Vitals in Vercel Analytics
- Verify API response times under load
- Test database query performance with real data
Security Verification
- Verify SSL is properly configured
- Check authentication security
- Test authorization rules for different user types
- Verify API endpoints are properly secured
- Test for common security vulnerabilities
5.3.10: Deployment Documentation
I need to create comprehensive deployment documentation for my team. What should this documentation include to ensure smooth operations and maintenance?
Create a comprehensive document containing:
Vercel Configuration
- Project name and ID
- Deployment branch and settings
- Build and development settings
- Team access (if applicable)
Environment Variables
- List of all environment variables (excluding actual values of secrets)
- Purpose of each variable
- Which services depend on each variable
Domain Configuration
- Domain names and DNS records
- SSL certificate details
- Custom domain settings
Database Configuration
- Database type and version
- Connection details (excluding passwords)
- Migration process
- Backup procedures
Monitoring Setup
- Analytics configuration
- Error tracking tools
- Performance monitoring
- Alerting configuration
Troubleshooting Guide
- Common deployment issues and solutions
- How to roll back to previous deployments
- Contact information for support
- Emergency procedures for critical issues