Decloak is an AI-powered web security intelligence platform that scans a site's HTTP/TLS posture, JavaScript, and third-party scripts to produce a report anyone can read. This guide is part of Decloak's library of practical, source-backed security guidance.
In this guide
- Key takeaways
- What is Vercel and why should I use it?
- How do I install the Vercel CLI?
- How do I authenticate the CLI with my Vercel account?
- How can I link a local folder to an existing Vercel project?
- How do I deploy a preview versus a production build?
- How can I develop locally with the same environment as Vercel?
- How do I connect a Git repository without using the CLI?
- How do I add a custom domain to my Vercel project?
- How can I set environment variables for different stages?
- How do I configure redirects, rewrites, headers, or cron jobs?
- How do I add serverless functions (API routes) to my Vercel app?
- How can I manage existing deployments?
- What advanced deployment options does Vercel offer?
- What should I do after my first deployment?
Key takeaways
- Install the Vercel CLI with
npm i -g vercel(Node 18+ required). - Authenticate once with
vercel loginand the CLI stores a token. - Link a local folder to a Vercel project using
vercel linkor create a new project withvercel. - Deploy a preview with
verceland a production build withvercel --prod. - Use
vercel devfor local development that mirrors Vercel’s production environment. - Configure custom domains, environment variables, redirects, and cron jobs via the dashboard or
vercel.json. - Add serverless functions by placing files in an
api/(orapp/api/) directory. - Manage deployments from the dashboard or with CLI commands like
vercel redeployandvercel logs.
What is Vercel and why should I use it?
Vercel is a cloud platform that simplifies deploying modern web apps with zero - config builds, automatic preview URLs, and built - in serverless functions. It lets you focus on code while handling scaling, CDN distribution, and TLS automatically.
How do I install the Vercel CLI?
Run npm i -g vercel in a terminal; the command installs the Vercel tool globally and requires Node 18 or newer. After installation you can run vercel --help to see all available commands.
How do I authenticate the CLI with my Vercel account?
Execute vercel login and follow the interactive prompt to open a browser window. After you authorize, the CLI stores a token locally so subsequent commands run without re - authenticating.
How can I link a local folder to an existing Vercel project?
Navigate to your project directory and run vercel link. The CLI asks you to select the Vercel project you want to associate with the folder. If you need a brand - new project, simply run vercel and answer the creation prompts.
How do I deploy a preview versus a production build?
- Preview deployment:
vercelcreates a unique URL (e.g.,my - app - abc123.vercel.app) useful for pull - request testing. - Production deployment:
vercel --prodpublishes to the primary domain you configured (e.g.,my - app.vercel.app). Both commands output the URL in the terminal.
How can I develop locally with the same environment as Vercel?
Run vercel dev inside your project directory. The command starts a local server that uses Vercel’s build output, respects vercel.json settings, and serves serverless functions just like the cloud platform.
How do I connect a Git repository without using the CLI?
- Sign in at vercel.com and click New Project.
- Authorize Vercel to access GitHub, GitLab, or Bitbucket.
- Select the repository; Vercel auto - detects the framework (Next.js, React, etc.).
- Click Deploy. Every push to the linked branch automatically creates a new preview (or production) deployment.
How do I add a custom domain to my Vercel project?
In the dashboard go to Project → Settings → Domains, click Add, and follow the DNS instructions (CNAME for subdomains or A record for apex domains). Vercel automatically provisions TLS certificates for the domain.
How can I set environment variables for different stages?
- Dashboard method: Settings → Environment Variables, then choose Production, Preview, or Development scope.
- CLI method:
vercel env add <NAME> <scope>(e.g.,vercel env add API_KEY production). The values are never exposed in the build logs.
How do I configure redirects, rewrites, headers, or cron jobs?
Create a vercel.json file at the repository root. Example for a permanent redirect:
{
"redirects": [
{ "source": "/old", "destination": "/new", "permanent": true }
]
}
Add a crons array for scheduled functions, e.g., "crons": [{ "path": "/api/cleanup", "schedule": "0 0 * * *" }].
How do I add serverless functions (API routes) to my Vercel app?
Place a file in an api/ directory (or app/api/ for Next 13). Vercel automatically bundles it as a serverless function. Example TypeScript function:
// api/hello.ts
export async function GET(request: Request) {
const res = await fetch('https://api.example.com/data');
const data = await res.json();
return Response.json(data);
}
After deployment the endpoint is reachable at https://<project>.vercel.app/api/hello.
How can I manage existing deployments?
- Dashboard: Filter, delete, or click Redeploy on any previous build.
- CLI:
vercel redeploy <deployment-id>to trigger a new build from the same source, andvercel logs <deployment-id>to view runtime logs.
What advanced deployment options does Vercel offer?
| Option | When to use |
|---|---|
| Vercel Drop | Quick static site upload without Git or CLI |
| Deploy Hooks | Trigger builds from external CI systems via a unique URL |
| REST Deploy API | Fully programmatic deployments from custom scripts |
| Docker/Container Deploy | Use a Dockerfile.vercel to run containerized workloads |
| Services (multi - backend) | Split a monorepo into separate backends with rewrites |
What should I do after my first deployment?
- Add a custom domain.
- Set environment variables for API keys and database URLs.
- Enable Vercel Web Analytics if you need visitor insights.
- Protect preview URLs with password or IP restrictions.
- Create additional serverless functions for backend logic.
- Review CI/CD settings and enable branch protection in your Git provider.
Quick cheat - sheet
npm i -g vercel # install CLI
vercel login # authenticate
cd my-app && vercel link # link or create project
vercel # preview deployment
vercel --prod # production deployment
vercel dev # local development
vercel env add API_KEY production
vercel rm <deployment-id> # delete a deployment
Related guides
How to use `vercel deploy` safely and efficiently
Learn the exact command options, best practices, and automation tips for the Vercel CLI `vercel deploy` command.
Is Vercel free? A detailed look at the Hobby plan and its limits
Vercel offers a free Hobby plan that’s forever available for personal projects, but it comes with strict usage caps and a single - developer limit.
Why is Vercel so popular?
Vercel’s popularity comes from its zero - config preview workflow, deep Next.js integration, global edge network, freemium model and AI - native tooling that together give developers instant, fast, and frictionless deployments.