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)| Stage | Tool | Purpose |
|---|---|---|
| Lint | ESLint | Code style and quality |
| Type Check | TypeScript | Type safety |
| Build | Turborepo | Verify compilation |
| Deploy | Docker / Railway | Ship to production |
Workflow
On Pull Requests
Every pull request triggers:
- Lint — ESLint runs across all packages
- Type Check — TypeScript validates all types (requires Prisma client generation first)
- 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:
- CI checks (lint, typecheck, build)
- 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
{
"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:deployRailway handles deployment automatically:
- Link your GitHub repository to Railway
- Configure Dockerfile paths for each service
- Push to
mainto trigger automatic deployment
Best Practices
- Never skip CI — All changes should go through the pipeline
- Keep
maingreen — Fix broken builds immediately - Use conventional commits —
feat:,fix:,chore:for clear changelogs - Run locally first — Use
pnpm lint && pnpm typecheck && pnpm buildbefore pushing - Database migrations — Always run
db:deploybefore deploying new code that requires schema changes