CodePilot
Deployment

CI/CD

Continuous integration and deployment pipeline for CodePilot.

CodePilot's CI/CD pipeline ensures code quality and enables automated deployment.

Pipeline Overview

Push/PR → Lint → Type Check → Build → Deploy (main branch only)
StageToolPurpose
LintESLintCode style and quality
Type CheckTypeScriptType safety
BuildTurborepoVerify compilation
DeployDocker / RailwayShip to production

Workflow

On Pull Requests

Every pull request triggers:

  1. Lint — ESLint runs across all packages
  2. Type Check — TypeScript validates all types (requires Prisma client generation first)
  3. Build — All apps and packages are compiled

All three must pass before merging.

On Push to Main

Pushes to main trigger the same checks plus deployment:

  1. CI checks (lint, typecheck, build)
  2. Deploy — Build Docker images and deploy to production

Turborepo Integration

Turborepo optimizes the CI pipeline by:

  • Caching — Build outputs are cached, so unchanged packages skip rebuilding
  • Parallel execution — Independent tasks run concurrently
  • Dependency graph — Tasks respect package dependencies
turbo.json
{
  "tasks": {
    "build": {
      "dependsOn": ["^build"],
      "outputs": [".next/**", "dist/**"]
    },
    "lint": {
      "dependsOn": ["^build"]
    },
    "typecheck": {
      "dependsOn": ["^build"]
    }
  }
}

Deployment Strategy

For self-hosted production:

# Build and deploy
docker compose -f docker-compose.prod.yml up -d --build

# Run migrations
pnpm --filter @repo/db run db:deploy

Railway handles deployment automatically:

  1. Link your GitHub repository to Railway
  2. Configure Dockerfile paths for each service
  3. Push to main to trigger automatic deployment

Best Practices

  • Never skip CI — All changes should go through the pipeline
  • Keep main green — Fix broken builds immediately
  • Use conventional commitsfeat:, fix:, chore: for clear changelogs
  • Run locally first — Use pnpm lint && pnpm typecheck && pnpm build before pushing
  • Database migrations — Always run db:deploy before deploying new code that requires schema changes

On this page