What happens when you hit Deploy
4 min read
deploy on vercel looks simple from the outside:
- push to git
- wait for the build
- open the url
under that, vercel turns a code snapshot into a versioned deployment: isolated build, split artifacts, global routing metadata, and compute at the edge. the platform strategy is not "copy my repo to a server." it is framework-defined infrastructure.
a deploy is not
vercel's strategy in one line
vercel reads your framework output and provisions infrastructure from it. routes, static pages, server handlers, middleware, env config, and cache rules become a object. the global network serves that blueprint, not your raw git tree.
that is why the same next.js repo on vercel behaves differently than dropping files on a vps. the platform owns build, routing, and rollout.
step 1: what triggers a build
a build starts when vercel receives new code:
- git push to a connected repo (github, gitlab, bitbucket)
vercel deployfrom the cli- dashboard deploy or rest api call
git push
-> git provider stores commit
-> webhook to vercel
-> isolated build machine provisioned
-> shallow clone at that commit
each build runs in its own virtual machine. dedicated resources, no shared node_modules from your laptop. dependencies install from the lockfile, often with cache from prior builds on the same project.
step 2: the build machine
vercel detects the framework (next.js, nuxt, sveltekit, and dozens more) or accepts a prebuilt output via the .
then it runs your build command. typical pipeline:
- install dependencies
- run
buildscript (compile, bundle, prerender) - split output into static assets and compute artifacts
- capture routing config from
vercel.jsonor framework config
static assets are html, js, css, fonts, images. compute artifacts are and optional edge runtimes for middleware.
monorepos add another layer: vercel can skip builds for unchanged packages or cancel stale queued builds when new commits land on the same branch.
step 3: what actually ships
vercel does not deploy your repo. it deploys build outputs:
- static files to globally distributed storage (cdn)
- function bundles to compute regions
- routing metadata replicated to every edge pop
- build cache kept for the next deploy
preview deployments get a unique url per commit or pr. production is an alias swap to the latest approved deployment. old versions stay available for instant rollback.
build succeeds
-> upload artifacts
-> propagate routing metadata globally
-> assign preview or production url
-> alias production domain to new deployment id
step 4: how traffic enters the network
when a user opens your app, dns resolves to vercel's anycast network. traffic lands at the nearest , not a single origin server.
user request
-> dns + tls
-> nearest edge POP
-> security checks
-> application-aware proxy reads deployment metadata
the proxy knows which deployment is live, which paths are static, which need compute, and what middleware runs first. this is framework-aware routing, not dumb file serving.
step 5: static vs dynamic at the edge
most apps mix both.
cacheable / static path:
- proxy serves from vercel cache or cdn
- browser fetches js and css chunks
- client framework hydrates if needed
- no function invocation for the document itself
dynamic path:
- proxy forwards to the compute layer
- picks an instance (warm, pre-warmed, or new)
- runtime env vars injected
- handler returns html or json
- response may be cached if headers allow it
cold starts still exist on idle functions, but fluid compute reduces them by reusing in-flight instances and pre-warming.
you control your handler code. edge distance and third-party apis (db, payments, storage) add their own latency.
step 6: preview, production, and rollback
every deployment is immutable.
- preview - one url per branch, pr, or cli deploy. safe to share before merge.
- production - domain alias points at one deployment id.
- rollback - repoint the alias to an older deployment. seconds, no rebuild.
you can also use vercel build in your own ci and vercel deploy --prebuilt to ship only artifacts, not source. same global routing, different build location.
step 7: environment and runtime contracts
process.env.DATABASE_URL
process.env.API_SECRET
secrets live in project settings, not git. preview and production can differ. edge vs node runtimes differ too. same code, different contract, different outcome.
deploy ships code into a runtime with injected config. missing env vars and wrong runtime choice are deploy problems, not just code problems.
the whole trip
what i keep forgetting
- build time is not request time. prerendering, bundling, and content generation happen before traffic arrives.
- vercel deploys artifacts, not repos. source code is input. output is what the network serves.
- routing is part of the deploy. rewrites, middleware, and headers travel as metadata, not as afterthoughts.
- production is a pointer. rollback is swapping aliases, not restoring servers.
- external services are a second hop. your function returning fast still waits on the database behind it.
when a deploy finishes and the ui looks unchanged, the global network still picked up a new blueprint. static files moved closer to users, functions landed in compute regions, and every edge pop learned how to route the next request.