As asked
Walk me through how you would set up a CI/CD pipeline for a monorepo with a Next.js frontend and a Node.js API service. What does each stage do, how do you handle environment secrets, and how do you do zero-downtime deployments?
Sample answer outline
A typical pipeline: lint/type-check, unit tests, integration tests against a test database, Docker build and push to a registry, then deploy. Secrets management means storing them in GitHub Actions secrets or Vault and injecting them as environment variables at build and deploy time, never in the image layer. Zero-downtime deployment uses blue-green or rolling updates: spin up the new container, run health checks, then shift traffic. On Kubernetes this is a rolling update by default. On single-server setups you can use Docker Compose with a reverse proxy health check.
Expect these follow-ups
- How do you handle database migrations in a zero-downtime deployment where the old and new code must both work against the same schema during the transition?