AgileFlow

/setup-deployment

PreviousNext

Set up automated deployment pipeline

/setup-deployment

Automatically detect your project type and configure a complete deployment pipeline with platform-specific configurations, CI/CD workflows, and environment management.

Quick Start

/agileflow:setup-deployment PLATFORM=auto ENV=both AUTO_DEPLOY=no

Purpose

This command intelligently sets up deployment infrastructure by:

  • Auto-detecting your project type (static, full-stack, serverless, mobile, containers)
  • Recommending the optimal deployment platform
  • Generating platform-specific configuration files
  • Creating GitHub Actions deployment workflows
  • Setting up environment variable templates and secrets management
  • Providing clear next steps for deployment

Parameters

ParameterRequiredDefaultDescription
PLATFORMNoautoauto, vercel, netlify, heroku, aws, gcp, docker, eas
ENVNobothstaging, production, or both
AUTO_DEPLOYNonoyes or no - trigger deployment automatically on push

Examples

Auto-Detect Everything

/agileflow:setup-deployment

Detects project type and recommends the best platform automatically.

Specify Platform Explicitly

/agileflow:setup-deployment PLATFORM=vercel ENV=both

Sets up Vercel deployment for both staging and production.

Docker Deployment to Fly.io

/agileflow:setup-deployment PLATFORM=docker ENV=production

Configures Docker-based deployment (works with Fly.io, AWS, GCP).

Mobile App with EAS

/agileflow:setup-deployment PLATFORM=eas ENV=production

Sets up Expo Application Services for React Native/Expo deployment.

Project Detection

The command analyzes your project to recommend platforms:

Static Sites

Detected By: HTML/CSS/JS, React/Vue/Angular SPA (no backend)

  • Recommended: Vercel or Netlify
  • Ideal for: Marketing sites, SPAs, documentation

Full-Stack Web Apps

Detected By: Node.js server, Express/Fastify/Next.js API routes

  • Recommended: Vercel (Next.js) or Railway
  • Ideal for: Web apps with backend logic

Mobile Apps (React Native / Expo)

Detected By: expo config, react-native dependency

  • Recommended: EAS (Expo Application Services)
  • Ideal for: iOS/Android mobile apps

Container-Based Apps

Detected By: Dockerfile present

  • Recommended: Fly.io
  • Ideal for: Custom Docker deployments, microservices

Serverless Functions

Detected By: Lambda functions, API Gateway config

  • Recommended: AWS Lambda or Vercel Functions
  • Ideal for: Event-driven, pay-per-execution workloads

Output Files

The command creates several configuration files:

Platform Configuration

  • Vercel: vercel.json
  • Netlify: netlify.toml
  • Heroku: Procfile, app.json
  • Docker: Dockerfile, .dockerignore, fly.toml
  • EAS: eas.json
  • AWS Lambda: serverless.yml

CI/CD Workflow

  • .github/workflows/deploy.yml - Automated deployment workflow
  • Supports staging → production promotion
  • Runs on push to staging/main branches

Environment Management

  • .env.example - Template for environment variables (safe to commit)
  • docs/02-practices/secrets-management.md - Secrets management guide
  • docs/02-practices/deployment.md - Deployment documentation

Platforms

Best for: Next.js, React, SPA deployments

  • Automatic builds on git push
  • Global CDN
  • Built-in serverless functions
  • Environment management UI
  • Preview deployments on PRs

Next Steps:

vercel link              # Connect your GitHub repo
vercel env add DATABASE_URL production
git push origin main     # Trigger deployment

Best for: Static sites, JAMstack, general SPAs

  • Automatic builds from git
  • Built-in analytics and forms
  • Serverless functions
  • Netlify CMS integration
  • Custom domain management

Heroku (Node.js/Python Servers)

Best for: Traditional server applications

  • Simple slug-based deployment
  • PostgreSQL, Redis add-ons
  • Environment variable management
  • Team collaboration features

Next Steps:

heroku login
heroku create my-app
heroku addons:create heroku-postgresql:hobby-dev
git push heroku main

Fly.io (Docker Deployment)

Best for: Docker containers, microservices, custom runtimes

  • Global deployment with anycast routing
  • IPv6 support
  • Auto-scaling
  • Persistent volumes
  • PostgreSQL included

Next Steps:

fly auth login
fly launch
fly deploy

AWS (Lambda/ECS/Elastic Beanstalk)

Best for: Scalable applications, microservices

  • Multiple deployment options (Lambda, ECS, Beanstalk)
  • Cost-effective at scale
  • Integration with AWS ecosystem
  • Fine-grained access control

EAS (Expo/React Native)

Best for: Mobile apps (iOS/Android)

  • Native builds in the cloud
  • App Store/Play Store submissions
  • OTA updates
  • Development client builds

Workflow

The setup follows a consistent process:

  1. Detect Project Type - Analyzes dependencies and files
  2. Recommend Platform - Suggests optimal hosting
  3. Generate Configuration - Creates platform-specific files
  4. Create Workflow - Sets up GitHub Actions for deployment
  5. Environment Setup - Creates .env.example and docs
  6. Show Preview - Displays all files for review
  7. Create Files - Writes to disk after YES/NO confirmation
  8. Display Next Steps - Guides setup completion

Environment Management

Staging vs Production

The command can set up either or both environments:

# Example: Two-branch deployment
Staging:
  - Branch: staging
  - URL: staging.example.com
  - Environment: development-like
 
Production:
  - Branch: main
  - URL: example.com
  - Environment: live

Secrets Management

Never commit secrets to git. Instead:

  1. Use .env.example as a template
  2. Store actual secrets in platform (Vercel, Heroku, etc.)
  3. GitHub Actions provides ${{ secrets.NAME }}
  4. Read docs/02-practices/secrets-management.md for details

Common Secrets:

  • Database connection strings
  • API keys (Stripe, SendGrid, etc.)
  • AWS credentials
  • Third-party service tokens

Examples by Platform

Vercel Deployment

/agileflow:setup-deployment PLATFORM=vercel

Creates:

  • vercel.json with build config
  • .github/workflows/deploy.yml for auto-deploy
  • .env.example with Vercel variable names
  • Deployment docs

Heroku with PostgreSQL

/agileflow:setup-deployment PLATFORM=heroku ENV=production

Creates:

  • Procfile (web: npm start)
  • app.json with buildpack config
  • PostgreSQL setup docs
  • Deployment workflow

Docker to Fly.io

/agileflow:setup-deployment PLATFORM=docker

Creates:

  • Dockerfile with multi-stage build
  • .dockerignore for clean image
  • fly.toml with region and volume config
  • Deployment workflow

Auto-Deploy Option

By default, deployments require manual triggering. To enable automatic deployment on every push:

/agileflow:setup-deployment AUTO_DEPLOY=yes

Important: Use with caution in production. Consider:

  • Always require CI to pass first
  • Use staging → main promotion process
  • Implement feature flags for gradual rollouts
  • Monitor error tracking after deployments

Next Steps After Setup

  1. Add Platform Connection

    vercel link
    # or
    fly auth login
    fly launch
  2. Configure Secrets

    vercel env add DATABASE_URL production
    # or
    fly secrets set DATABASE_URL=postgresql://...
  3. Test Deployment

    git push origin staging
    # Check deployment logs on platform dashboard
  4. Set Custom Domain (Optional)

    vercel domains add example.com
    # Follow platform-specific DNS setup
  5. Enable Auto-Deploy (Optional)

    • After testing staging, enable production auto-deploy
    • Configure branch protection rules