CI/CD & DevOps
What Is CI/CD and Why It Matters
Understand continuous integration and deployment — the automation that lets teams ship confidently every day.
CI/CD Defined
CI (Continuous Integration) — Automatically build, lint, and test code every time a developer pushes changes. The goal: find problems immediately, before they compound.
CD (Continuous Delivery) — Automatically deploy to staging after CI passes. The code is always in a deployable state; deployment to production requires a manual trigger.
CD (Continuous Deployment) — Automatically deploy to production after all tests pass. No human required between commit and production. This requires very high test confidence and is not appropriate for every team.
The Pipeline
A CI/CD pipeline is the sequence of automated steps that code passes through on its way from a developer's commit to running in production:
- Developer pushes code to a branch
- CI pipeline triggers automatically
- Linter runs (catches style and obvious code issues)
- Type checker runs (TypeScript ensures type correctness)
- Unit tests run
- Integration tests run
- Application builds
- Artifact deployed to staging automatically
- (Optional) Manual review of staging
- Deployment to production (manual trigger or automatic)
If any step fails, the pipeline stops. The developer is notified immediately.
Why CI/CD Matters
Catches bugs before production. Without CI/CD, bugs are found by users. With CI/CD, they are found by automated tests seconds after the code is written.
Enforces quality standards. The linter and type checker run on every push — there is no way to merge code that violates the standards.
Eliminates "works on my machine." The CI environment is the same every time. If it passes in CI, it runs in production.
Enables rapid iteration. When deployment is safe and automated, developers can ship multiple times per day. Manual deployment processes create fear and infrequent releases.
The Cultural Shift
CI/CD represents a fundamental change in how teams think about deployment:
Before CI/CD: Deploy on Fridays (so the weekend is a buffer), deploy rarely (each deployment is risky and manual), deployment is the responsibility of one "ops person."
After CI/CD: Deploy whenever code is ready, deploy many times per day, every developer is responsible for the deployability of their own code.
CI/CD Platforms
| Platform | Best For | Free Tier |
|---|---|---|
| GitHub Actions | GitHub repositories | Generous — 2000 min/month |
| Vercel | Next.js / frontend | Free for hobby projects |
| Netlify | Jamstack / static sites | Free for hobby projects |
| GitLab CI | GitLab repositories | Available |
| CircleCI | Complex pipelines | Limited |
For most Next.js projects, the answer is GitHub Actions + Vercel: GitHub Actions for tests, Vercel for deployment.
Key Takeaways
- CI automatically runs tests on every push; CD automatically deploys passing code to staging or production
- A pipeline is the sequence: lint → typecheck → test → build → deploy to staging → deploy to production
- CI/CD shifts deployment from a risky, infrequent event to a safe, routine operation
- CI/CD is only as good as the tests — invest in the Testing pillar to maximize pipeline confidence
- GitHub Actions + Vercel is the practical recommendation for Next.js applications
Example
# Minimal CI/CD pipeline visualization
# .github/workflows/ci.yml
name: CI
on:
push:
branches: [main]
pull_request:
branches: [main]
jobs:
quality:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
node-version: '20'
cache: 'npm'
- run: npm ci
- run: npm run lint # Step 1: Lint
- run: npm run typecheck # Step 2: Type check
- run: npm test # Step 3: Tests
- run: npm run build # Step 4: Build