CLI and observability

Deploy from the CLI

Create a Preview deployment by default, promote only with an explicit production command, and verify the exact URL returned by each operation.

8 minute lesson

~~~

Running vercel or vercel deploy creates a Preview deployment by default. Adding --prod targets Production.

The CLI is useful for repositories without a supported Git integration, experiments, and controlled automation. It can also build locally before upload when needed. Do not add --prod by habit: preview the artifact, inspect it, and promote deliberately. A CLI deployment does not replace source control or documentation of what was shipped.

npx vercel@latest deploy
# verify the returned preview URL
npx vercel@latest deploy --prod

The CLI deploys the source state in the current directory, which may include changes that are not in Git. Check git status, record the commit and any intentional local difference, and verify the linked account and project before uploading. Automation should pin or deliberately update its CLI version rather than silently changing behavior mid-release.

Keep the immutable Preview URL and deployment ID returned by the command. Test that artifact before using an explicit Production operation, then verify the production domain points to the expected deployment. If the release fails, move traffic back to the recorded known-good deployment and commit or discard the local source difference so a later Git deployment cannot surprise you.

Change a visible build label, create a Preview deployment through the CLI, verify it, then decide whether to make the same source a Production deployment.

Lesson completed

Take this course offline

Get every free book and course as PDF and EPUB files.

Get the download library →