Skip to main content Skip to navigation

Documentation

Everything you need to build irresistible applications

Deployment

Deploy your Irresistible applications with confidence using our powerful deployment platform.

Overview

Irresistible provides seamless deployment with:

  • One-click deployment from CLI or dashboard
  • Automatic SSL certificates via Let’s Encrypt
  • Global CDN for fast content delivery
  • Auto-scaling based on traffic
  • Zero-downtime deployments with rolling updates
  • Multiple environments (staging, production)

Quick Deploy

From CLI

# Deploy to production
irresistible deploy

# Deploy to staging
irresistible deploy --env staging

# Deploy with custom domain
irresistible deploy --domain myapp.com

From Dashboard

  1. Navigate to your project
  2. Click “Deploy” button
  3. Select environment
  4. Review changes
  5. Click “Deploy Now”

From Builder

Press Cmd/Ctrl + Shift + D or click the deploy button in the toolbar.

Deployment Configuration

Basic Configuration

Create irresistible.config.js in your project root:

export default {
  name: 'my-app',
  
  deploy: {
    // Production environment
    production: {
      url: 'https://myapp.com',
      region: 'us-east-1',
      instances: {
        min: 2,
        max: 10
      }
    },
    
    // Staging environment
    staging: {
      url: 'https://staging.myapp.com',
      region: 'us-west-2',
      instances: {
        min: 1,
        max: 3
      }
    }
  }
}

Advanced Configuration

export default {
  deploy: {
    production: {
      // Domain settings
      domains: ['myapp.com', 'www.myapp.com'],
      
      // SSL configuration
      ssl: {
        provider: 'letsencrypt',
        email: 'admin@myapp.com'
      },
      
      // Scaling configuration
      scaling: {
        cpu: 80,        // Scale up at 80% CPU
        memory: 85,     // Scale up at 85% memory
        requests: 1000  // Scale up at 1000 req/min
      },
      
      // Health checks
      healthCheck: {
        path: '/health',
        interval: 30,
        timeout: 5,
        healthy: 2,
        unhealthy: 3
      },
      
      // Environment variables
      env: {
        NODE_ENV: 'production',
        API_URL: 'https://api.myapp.com'
      }
    }
  }
}

Build Configuration

Build Settings

export default {
  build: {
    // Output directory
    output: 'dist',
    
    // Build command (optional)
    command: 'npm run build',
    
    // Node version
    node: '20',
    
    // Build environment variables
    env: {
      VITE_API_URL: process.env.API_URL
    }
  }
}

Framework-Specific Builds

SvelteKit

build: {
  adapter: '@sveltejs/adapter-node',
  target: 'node18'
}

Next.js

build: {
  output: 'standalone',
  experimental: {
    outputFileTracingRoot: path.join(__dirname, '../')
  }
}

Nuxt

build: {
  preset: 'node-server',
  nitro: {
    preset: 'node-server'
  }
}

Environment Variables

Setting Variables

Via CLI

# Set a single variable
irresistible env set API_KEY=secret123

# Set multiple variables
irresistible env set API_KEY=secret123 DB_URL=postgres://...

# From .env file
irresistible env import .env.production

Via Dashboard

  1. Go to Project Settings
  2. Click “Environment Variables”
  3. Add variables for each environment
  4. Click “Save”

Using Variables

// In your application
const apiKey = process.env.API_KEY;
const dbUrl = process.env.DATABASE_URL;

// In build config
export default {
  build: {
    env: {
      VITE_API_URL: process.env.API_URL,
      PUBLIC_SITE_URL: process.env.SITE_URL
    }
  }
}

Secret Management

Sensitive variables are encrypted at rest:

# Mark as secret
irresistible env set DB_PASSWORD=secret --secret

# List secrets (values hidden)
irresistible env list --secrets

Custom Domains

Adding a Domain

Via CLI

# Add domain
irresistible domain add myapp.com

# Add with automatic DNS
irresistible domain add myapp.com --configure-dns

Via Dashboard

  1. Go to Project Settings
  2. Click “Domains”
  3. Enter your domain
  4. Follow DNS configuration steps

DNS Configuration

Add these records to your domain:

Type  Name    Value
A     @       76.76.21.21
A     www     76.76.21.21

Or for CNAME:

Type  Name    Value
CNAME @       myapp.irresistible.app
CNAME www     myapp.irresistible.app

SSL Certificates

SSL certificates are automatically provisioned:

deploy: {
  ssl: {
    // Automatic Let's Encrypt (default)
    provider: 'letsencrypt',
    
    // Or bring your own
    provider: 'custom',
    cert: './certs/cert.pem',
    key: './certs/key.pem'
  }
}

Deployment Process

Build Pipeline

  1. Code Push - Changes detected
  2. Build - Application built
  3. Test - Tests run (if configured)
  4. Package - Docker image created
  5. Deploy - Rolling deployment
  6. Health Check - Verify deployment
  7. Go Live - Traffic routed

Zero-Downtime Deployment

deploy: {
  strategy: 'rolling', // default
  
  rolling: {
    maxSurge: 2,       // Extra instances during deploy
    maxUnavailable: 0  // No downtime
  }
}

Rollback

Instant Rollback

# Rollback to previous version
irresistible rollback

# Rollback to specific version
irresistible rollback v1.2.3

# List versions
irresistible versions

Monitoring & Logs

Viewing Logs

CLI

# Stream logs
irresistible logs

# Filter logs
irresistible logs --filter error

# Specific time range
irresistible logs --since 1h

Dashboard

  • Real-time log streaming
  • Search and filter
  • Download logs
  • Set up alerts

Metrics

Monitor your application:

  • Response time
  • Error rate
  • CPU/Memory usage
  • Request count
  • Active users
# View metrics
irresistible metrics

# Specific metric
irresistible metrics cpu --period 24h

Advanced Features

Edge Functions

Deploy serverless functions at the edge:

// api/hello.edge.js
export default function handler(request) {
  return new Response('Hello from the edge!');
}

// Configure in irresistible.config.js
export default {
  edge: {
    functions: './api/*.edge.js',
    routes: {
      '/api/*': 'edge'
    }
  }
}

Static Assets

Configure CDN for static assets:

deploy: {
  static: {
    // Cache static assets
    cache: {
      '*.js': '1y',
      '*.css': '1y',
      '*.jpg': '30d',
      '*.png': '30d'
    },
    
    // Compression
    compress: ['js', 'css', 'svg'],
    
    // Image optimization
    images: {
      formats: ['webp', 'avif'],
      sizes: [640, 750, 1080, 1200]
    }
  }
}

Database Migrations

Run migrations during deployment:

deploy: {
  hooks: {
    beforeDeploy: 'npm run migrate',
    afterDeploy: 'npm run seed'
  }
}

Deployment Hooks

deploy: {
  hooks: {
    // Run before build
    preBuild: 'npm run test',
    
    // Run after build
    postBuild: 'npm run analyze',
    
    // Run before deploy
    beforeDeploy: async (context) => {
      console.log('Deploying version:', context.version);
    },
    
    // Run after deploy
    afterDeploy: async (context) => {
      // Send notification
      await notify('Deployment complete!');
    }
  }
}

Deployment Strategies

Blue-Green Deployment

deploy: {
  strategy: 'blue-green',
  blueGreen: {
    // Time before switching
    warmupTime: 300,
    // Percentage of traffic to test
    testTraffic: 10
  }
}

Canary Deployment

deploy: {
  strategy: 'canary',
  canary: {
    // Initial traffic percentage
    initial: 5,
    // Increment
    increment: 10,
    // Interval
    interval: 300
  }
}

A/B Testing

deploy: {
  experiments: {
    'new-homepage': {
      traffic: 50,
      cookie: 'experiment-id'
    }
  }
}

Troubleshooting

Common Issues

Build Failures

# View build logs
irresistible logs --build

# Clear cache and rebuild
irresistible deploy --no-cache

Domain Not Working

# Check DNS propagation
irresistible domain check myapp.com

# Force SSL renewal
irresistible ssl renew myapp.com

Performance Issues

# Check metrics
irresistible metrics --detailed

# Scale manually
irresistible scale 5

Debug Mode

# Deploy with verbose logging
irresistible deploy --debug

# Dry run (no actual deployment)
irresistible deploy --dry-run

Best Practices

1. Use Environment Variables

Never hardcode sensitive data:

// Bad
const apiKey = 'sk_live_abc123';

// Good
const apiKey = process.env.API_KEY;

2. Configure Health Checks

// pages/api/health.js
export default function handler(req, res) {
  // Check database
  // Check external services
  res.status(200).json({ status: 'healthy' });
}

3. Optimize Assets

  • Compress images
  • Minify CSS/JS
  • Use CDN for static files
  • Enable caching headers

4. Monitor Everything

  • Set up alerts
  • Track key metrics
  • Monitor error rates
  • Review logs regularly

5. Test Deployments

# Deploy to staging first
irresistible deploy --env staging

# Run tests
npm run test:e2e

# Then deploy to production
irresistible deploy --env production

Next Steps