Skip to content
groundworkv0.2

Deployment

Getting code from your laptop to users, reliably and repeatably.

10 min read · Last reviewed November 20, 2026

Deployment

Deployment turns a repo into a running service at a URL. The goal is to make it boring: every merge to main ships automatically, and a bad release can be rolled back in one click.

You'll be able to#

  • Choose a hosting model that fits your app
  • Understand builds, CI/CD, preview deployments and rollbacks
  • Ask an for a deployment setup that holds up in production

The mental model#

Push → CI builds & tests → artifact (bundle or container image) → deploy to an environment → health check → traffic switches over. A means pointing traffic back at the previous artifact.

Key concepts#

  • Hosting models:
    • Platform (PaaS / frontend clouds): Vercel, Netlify, Cloudflare, Render, Railway, Fly.io. Push to git and it's live. The default.
    • functions: Code runs per request, with no servers to manage. Watch for cold starts, time limits and statelessness.
    • Containers: A Docker image packages your app with its runtime, so it runs the same everywhere. Run it on Fly, Railway, Cloud Run, ECS, or a VPS.
    • VPS: A raw virtual machine (Hetzner, DigitalOcean). Cheapest, but every operational task is yours (updates, , firewall).
    • Kubernetes: Container orchestration at scale. You almost certainly don't need it yet.
  • Build: Compile and bundle your code into what actually runs.
  • CI/CD: Continuous Integration (test every push) and Continuous Delivery/Deployment (ship automatically). GitHub Actions is the common choice.
  • Environments: Local → preview (per-PR) → staging → production.
  • Preview deployments: A live URL for every PR. Very useful for reviewing agent work.
  • Zero-downtime / blue-green / rolling: The new version starts before the old one stops.
  • Health check: An endpoint (/health) the platform checks before sending traffic.
  • Infrastructure as Code (IaC): Infrastructure defined in files (Terraform, Pulumi, SST) instead of clicked together in a console.
  • Edge vs region: Edge functions run near users. Your database sits in one region, so place compute close to it.

Decisions you make (not the agent)#

Your call, not the agent's

DecisionSensible defaultChoose otherwise when…
HostVercel/Netlify (Next.js, static), Railway/Render/Fly (long-running servers, workers)Cost at scale or compliance → containers on a cloud or VPS
PackagingPlatform-native buildMultiple services or portability needed → Dockerfile
CIGitHub Actions: lint, type-check, test on every PR—
Deploy triggerMerge to main → prod; PR → previewRegulated → manual approval gate
RegionSame region as your database—

Not sure? Answer a few questions#

Pick your deployment setup

0 of 3 answered
What are you deploying?
One service or several?
Does your industry require sign-off before a release?
Your defaults

Answer the questions above and your recommended defaults appear here.

These come from the Decisions table above. Treat them as defaults, not rules.

What good output looks like#

  • A pipeline where every PR runs checks, merging deploys, and every PR gets a preview
  • Configuration comes from environment variables per deploy, with secrets in the platform's secret store, never in the repository
  • A rollback path that has been tried, plus a written note of what it does not undo
  • A health check, and compute in the same region as the database
  • Every manual step (clicks, , secrets) listed instead of assumed

Red flags#

  • Deploying from a laptop by hand
  • No way to roll back
  • Secrets baked into a Docker image or committed (see Environments & secrets)
  • Compute running in a different region from the database (slow queries)
  • Kubernetes for a side project
  • Common agent mistakes: a workflow that deploys production from every branch push; long-lived cloud credentials stored as secrets where the provider supports short-lived access through OIDC (GitHub's documentation recommends OIDC for cloud access); a step that leaves the old version of the code unable to run, so rolling back doesn't help; secrets printed in build logs

Worked example#

Task: A release goes out and errors spike. You roll back.

The pipeline the agent set up merges, migrates the database, then deploys. This release's migration dropped a column the old code still reads. You press the platform's rollback button and the site is still broken.

What a good result contains: a rollback that has been rehearsed, migrations written so the previous version of the code still works with the new schema (expand now, contract in a later release), and a short written note of what the rollback does not cover.

The wrong turn: a rollback switches traffic back to an earlier build. That is what the Twelve-Factor App calls a release-management feature: you point at a previous release. It doesn't reverse your database. On Vercel, as of November 2026, an instant rollback points production domains back at an earlier deployment but does not change environment variables, databases or external APIs, and afterwards new pushes don't go live until you promote a deployment again. Here the old code meets a schema it doesn't understand.

How review catches it: before the release, ask what does a rollback not undo? and rehearse it in staging: deploy, migrate, roll back, and check the app. Read every migration with one question: can the previous version of the code run against the new schema? If not, split it using expand/contract (see Schema & migrations).

Sample prompts#

Weak vs strong#

Strong prompt
Set up deployment for this Next.js app on Vercel with a Neon Postgres database.
- GitHub Actions: on PR run install, lint, type-check, tests; block merge on failure
- Vercel preview deploy per PR using a Neon branch database per preview
- Run Drizzle migrations against prod as a step before promoting production
- Document required env vars in .env.example and the README
Explain each piece and what I need to click/configure manually.

Why it works: It names the host and database, the checks that block a merge, preview deployments, the migration step, documentation of environment variables, and asks for the manual steps it can't do.

What changed

  • Host and database are named
  • Checks (lint, type-check, tests) must pass before a merge
  • Previews use a per-PR database branch, so tests don't touch production
  • Migrations run as a step before promotion
  • Manual steps are listed instead of hidden
Prompt
Write a production Dockerfile for this <Node/Python> service: multi-stage build,
minimal base image, non-root user, healthcheck, only production deps, and a
.dockerignore. Then a fly.toml (or railway config) to deploy it in <region> with
zero-downtime rolling deploys.

Why it works: It asks for the specific production practices (multi-stage build, non-root user, health check) rather than "a Dockerfile", so the agent can't stop at one that merely runs.

Write the rollback runbook#

Prompt
Write a rollback runbook for this app on <platform>. Cover: how to roll back the application, exactly what that does and does not undo (database schema, environment variables, external services, scheduled jobs), how to tell whether a migration makes the previous version incompatible, and how to roll forward instead when rollback isn't safe. Include a rehearsal I can run in staging and what a successful rehearsal looks like.

Why it works: It asks for the limits of rollback up front. The rehearsal turns the runbook into something tested.

Audit the pipeline#

Prompt
Audit our CI/CD configuration. List: any step that deploys production from a branch other than main; any manual step that isn't documented; secrets used in workflow files (and whether they are printed, passed as command-line arguments, or available to workflows from forks); long-lived cloud credentials where short-lived access through OIDC is available; whether merges are blocked when checks fail; and whether the app and the database are in the same region. Don't change anything yet.

Why it works: It names the pipeline mistakes agents most often make, so the answer is a short list you can verify.

Explain what each stage does#

Prompt
Walk through the pipeline stage by stage: what triggers it, what it builds, which environment variables each stage reads and where they come from, what failure blocks, and what is deployed at the end. Point out anything that happens only in a person's head or browser, and anything that differs between preview and production.

Why it works: Build, release and run are separate stages. Stating the inputs and the failure behaviour of each shows the gaps.

Check your understanding#

Check your understanding

1/3What does a rollback typically do?
2/3Which migration style keeps a rollback safe?
3/3Where should configuration that differs between deploys live?

Checklist#

  • Every PR runs automated checks
  • Production deploys are automated
  • Rollback is tested and takes one click
  • Health check endpoint exists
  • Compute and database are in the same region
  • I know what a rollback does not undo, and I have rehearsed it
  • Migrations are compatible with the previous version of the code
  • Production deploys come only from main

Go deeper#