Learn

Navigate through learn topics

Deployment & Getting Started

Complete deployment checklist and step-by-step guide for your first application deployment

Last updated: 8/15/2025

Deployment is the moment your application goes from development to production - from your local machine to the internet where users can access it. This guide covers everything you need to know for successful deployments.

Deployment Checklist

Pre-deployment Preparation

Code Quality:

  • Code review completed and approved
  • All tests passing (unit, integration, e2e)
  • Security scan completed with no critical issues
  • Documentation updated and accurate
  • Database migrations tested and ready
  • Environment variables documented

Infrastructure:

  • Hosting platform selected and configured
  • Domain name purchased and DNS configured
  • SSL certificates obtained and installed
  • Database backups created and tested
  • Monitoring and logging configured
  • CI/CD pipeline tested

Business Readiness:

  • Stakeholders notified of deployment
  • Rollback plan documented
  • Support team briefed
  • Status page updated
  • Communication plan ready

Deployment Process

Staging Deployment:

  • Deploy to staging environment
  • Run comprehensive smoke tests
  • Verify all functionality works
  • Check performance metrics
  • Validate security measures
  • Test rollback procedures

Production Deployment:

  • Deploy to production environment
  • Verify deployment success
  • Run post-deployment tests
  • Monitor error rates and performance
  • Check external service integrations
  • Validate user authentication flows

Post-deployment Verification:

  • Update status page to "operational"
  • Notify stakeholders of successful deployment
  • Monitor application for 24-48 hours
  • Document any issues encountered
  • Plan improvements for next deployment
  • Schedule post-mortem if needed

Your First Deployment

Step 1: Choose Your Platform

Static Sites (HTML, CSS, JavaScript):

  • Vercel: Excellent for Next.js, React, Vue
  • Netlify: Great for static sites, JAMstack
  • GitHub Pages: Free hosting for open source
  • Cloudflare Pages: Fast global CDN

Full-Stack Applications:

  • Railway: Simple deployment for Node.js, Python, Ruby
  • Render: Easy deployment with auto-scaling
  • Heroku: Mature platform with extensive add-ons
  • DigitalOcean App Platform: Developer-friendly

Enterprise Applications:

  • AWS: Comprehensive but complex
  • Azure: Strong Microsoft ecosystem integration
  • Google Cloud: Excellent for AI/ML applications
  • Kubernetes: For complex microservices

Step 2: Prepare Your Application

Package Configuration:

// package.json
{
  "scripts": {
    "start": "node server.js",
    "build": "webpack --mode production",
    "test": "jest",
    "lint": "eslint src/",
    "type-check": "tsc --noEmit"
  },
  "engines": {
    "node": "18.x",
    "npm": "9.x"
  },
  "dependencies": {
    "express": "^4.18.0",
    "dotenv": "^16.0.0"
  },
  "devDependencies": {
    "jest": "^29.0.0",
    "eslint": "^8.0.0"
  }
}

Build Configuration:

// webpack.config.js
module.exports = {
  mode: 'production',
  entry: './src/index.js',
  output: {
    path: path.resolve(__dirname, 'dist'),
    filename: 'bundle.[contenthash].js'
  },
  optimization: {
    minimize: true,
    splitChunks: {
      chunks: 'all'
    }
  }
};

Step 3: Environment Configuration

Environment Variables:

# .env.production
NODE_ENV=production
PORT=3000
DATABASE_URL=postgresql://user:pass@host:5432/db
REDIS_URL=redis://host:6379
API_KEY=sk_live_...
JWT_SECRET=your-super-secret-jwt-key
CORS_ORIGIN=https://yourdomain.com

Platform-Specific Config:

# vercel.json
{
  "version": 2,
  "builds": [
    {
      "src": "server.js",
      "use": "@vercel/node"
    }
  ],
  "routes": [
    {
      "src": "/(.*)",
      "dest": "/server.js"
    }
  ]
}

Step 4: Deploy Your Application

Vercel Deployment:

# Install Vercel CLI
npm i -g vercel

# Deploy to production
vercel --prod

# Or deploy from Git
vercel --prod --force

Heroku Deployment:

# Add Heroku remote
heroku git:remote -a your-app-name

# Deploy to production
git push heroku main

# Run database migrations
heroku run npm run migrate

Docker Deployment:

# Build and push image
docker build -t yourapp:latest .
docker tag yourapp:latest registry.com/yourapp:latest
docker push registry.com/yourapp:latest

# Deploy to Kubernetes
kubectl apply -f deployment.yaml
kubectl rollout status deployment/yourapp

Deployment Strategies

Blue-Green Deployment

How it works:

  1. Blue environment: Currently running production
  2. Green environment: New version deployed and tested
  3. Switch traffic: Redirect all traffic to green
  4. Monitor: Ensure green is stable
  5. Cleanup: Remove blue environment

Benefits:

  • Zero downtime deployments
  • Instant rollback capability
  • No performance impact during deployment

Example with Load Balancer:

# AWS Application Load Balancer
TargetGroup1: Blue (current)
TargetGroup2: Green (new)

# Switch traffic
aws elbv2 modify-listener \
  --listener-arn arn:aws:elasticloadbalancing:... \
  --default-actions Type=forward,TargetGroupArn=green-arn

Rolling Deployment

How it works:

  1. Deploy new version to subset of instances
  2. Gradually increase traffic to new instances
  3. Monitor health and performance
  4. Continue until all instances are updated

Benefits:

  • Gradual risk mitigation
  • Resource efficient
  • Easy to pause and rollback

Kubernetes Example:

apiVersion: apps/v1
kind: Deployment
metadata:
  name: yourapp
spec:
  replicas: 5
  strategy:
    type: RollingUpdate
    rollingUpdate:
      maxSurge: 1
      maxUnavailable: 0

Canary Deployment

How it works:

  1. Deploy new version to small percentage of users
  2. Monitor metrics and user feedback
  3. Gradually increase percentage if successful
  4. Full rollout or rollback based on results

Benefits:

  • Risk mitigation with real user testing
  • Data-driven deployment decisions
  • Easy rollback for problematic releases

Implementation:

// Feature flag for canary deployment
const isCanaryUser = (userId) => {
  const hash = crypto.createHash('md5').update(userId).digest('hex');
  const percentage = parseInt(hash.substring(0, 2), 16);
  return percentage < 10; // 10% of users
};

// Route to appropriate version
if (isCanaryUser(user.id)) {
  // Serve new version
  app.use('/api', newVersionRouter);
} else {
  // Serve stable version
  app.use('/api', stableVersionRouter);
}

Monitoring and Observability

Health Checks

Application Health:

// Health check endpoint
app.get('/health', (req, res) => {
  const health = {
    status: 'healthy',
    timestamp: new Date().toISOString(),
    uptime: process.uptime(),
    memory: process.memoryUsage(),
    database: await checkDatabaseConnection(),
    redis: await checkRedisConnection()
  };
  
  const isHealthy = health.database && health.redis;
  res.status(isHealthy ? 200 : 503).json(health);
});

Load Balancer Health Check:

# AWS Target Group health check
HealthCheckPath: /health
HealthCheckPort: 3000
HealthCheckProtocol: HTTP
HealthyThresholdCount: 2
UnhealthyThresholdCount: 3
HealthCheckTimeoutSeconds: 5
HealthCheckIntervalSeconds: 30

Metrics and Logging

Key Metrics to Monitor:

  • Response time (p50, p95, p99)
  • Error rate (4xx, 5xx responses)
  • Throughput (requests per second)
  • Resource utilisation (CPU, memory, disk)
  • Database connection pool status
  • External API response times

Structured Logging:

const winston = require('winston');

const logger = winston.createLogger({
  level: 'info',
  format: winston.format.combine(
    winston.format.timestamp(),
    winston.format.errors({ stack: true }),
    winston.format.json()
  ),
  defaultMeta: { service: 'yourapp' },
  transports: [
    new winston.transports.File({ filename: 'error.log', level: 'error' }),
    new winston.transports.File({ filename: 'combined.log' })
  ]
});

// Log deployment events
logger.info('Deployment started', {
  version: process.env.VERSION,
  environment: process.env.NODE_ENV,
  timestamp: new Date().toISOString()
});

Rollback Procedures

Automatic Rollback

Health Check Failures:

# Kubernetes deployment with auto-rollback
apiVersion: apps/v1
kind: Deployment
spec:
  strategy:
    type: RollingUpdate
    rollingUpdate:
      maxUnavailable: 25%
      maxSurge: 25%
  minReadySeconds: 30
  progressDeadlineSeconds: 600
  revisionHistoryLimit: 10

Load Balancer Failures:

# AWS CLI rollback
aws elbv2 modify-listener \
  --listener-arn arn:aws:elasticloadbalancing:... \
  --default-actions Type=forward,TargetGroupArn=previous-version-arn

Manual Rollback

Database Rollback:

# PostgreSQL rollback
pg_restore --clean --if-exists --no-owner --no-privileges \
  --host=localhost --port=5432 --username=user \
  --dbname=database backup_file.dump

# MongoDB rollback
mongorestore --host localhost --port 27017 \
  --db database backup_directory/

Application Rollback:

# Docker rollback
docker tag registry.com/yourapp:previous registry.com/yourapp:latest
docker push registry.com/yourapp:latest

# Kubernetes rollback
kubectl rollout undo deployment/yourapp
kubectl rollout status deployment/yourapp

Best Practices

Security

Secrets Management:

  • Never commit secrets to version control
  • Use environment variables or secret management services
  • Rotate secrets regularly
  • Limit secret access to necessary services only

Network Security:

  • Use HTTPS everywhere
  • Implement proper CORS policies
  • Rate limiting on public endpoints
  • Network segmentation for different environments

Performance

Optimisation:

  • Enable gzip compression
  • Use CDN for static assets
  • Implement caching strategies
  • Optimise database queries
  • Use connection pooling

Monitoring:

  • Set up alerting for critical metrics
  • Monitor resource utilisation
  • Track user experience metrics
  • Regular performance testing

Reliability

High Availability:

  • Deploy across multiple availability zones
  • Use auto-scaling groups
  • Implement circuit breakers
  • Regular backup testing
  • Disaster recovery planning

Testing:

  • Automated testing in CI/CD
  • Load testing before deployment
  • Chaos engineering for resilience
  • Regular security testing

Common Deployment Issues

Environment Mismatches

Problem: App works locally but fails in production.
Solution: Use Docker containers, environment-specific configs and thorough testing.

Database Connection Issues

Problem: Can't connect to production database.
Solution: Check network security groups, connection strings and database availability.

Memory Leaks

Problem: App crashes after running for a while.
Solution: Monitor memory usage, implement proper cleanup and use memory profiling tools.

Slow Performance

Problem: App is slow in production.
Solution: Enable caching, optimise database queries and use performance monitoring tools.

Next Steps

After your first successful deployment:

  1. Set up monitoring and alerting for production
  2. Implement automated testing in your CI/CD pipeline
  3. Learn about advanced deployment strategies like blue-green and canary
  4. Explore infrastructure as code with Terraform or CloudFormation
  5. Implement proper logging and tracing for debugging
  6. Plan for scaling as your application grows

Remember: Deployment is not the end - it's the beginning of production operations. Good deployment practices set the foundation for reliable, maintainable applications.

Related Topics

Continue building your deployment knowledge: