From localhost to a live public URL in 5 minutes — then automatic forever after
Vercel is a cloud platform for deploying web applications. It was built by the same team that created Next.js, so the integration is seamless — zero configuration required. You push code to GitHub, and Vercel automatically builds and deploys it to a global CDN.
For this course, Vercel is how you turn your local project into a live URL that anyone can visit. Every assignment submission will be a Vercel deployment link.
npm run buildGo to vercel.com and click Sign Up. Choose Continue with GitHub to link your GitHub account. This connection allows Vercel to access your repositories and set up automatic deployments.
After signing in, click Add New → Project. Vercel will show a list of your GitHub repositories. Select your project repository and configure these settings:
./ unless your project is in a monorepo subfoldernpm run build (default).env.local file (more on this below)Click Deploy. Vercel will clone your repo, install dependencies, run the build, and deploy the result. This takes 1-3 minutes.
After deployment, Vercel assigns your project a URL:
# Default format
https://your-project-name.vercel.app
# With custom subdomain
https://my-design-system.vercel.app
# Preview deployments (per branch/commit)
https://your-project-name-git-feature-branch-username.vercel.appOnce connected, every push to your main branch triggers a production deployment automatically. You never need to manually deploy again.
# Your workflow becomes:
git add .
git commit -m "update hero section"
git push origin main
# Vercel automatically:
# 1. Detects the push
# 2. Installs dependencies
# 3. Runs npm run build
# 4. Deploys to production
# 5. Your live URL is updated in ~60 secondsWhen you push to a branch other than main, Vercel creates a preview deployment — a unique URL for that branch. This is incredibly useful for reviewing changes before merging.
# Create a feature branch
git checkout -b feature/new-hero
# Make changes and push
git add .
git commit -m "redesign hero section"
git push origin feature/new-hero
# Vercel creates a preview URL:
# https://your-project-git-feature-new-hero-username.vercel.app
# Share this URL with your team for review
# When you merge to main, production updates automaticallyIn local development, environment variables live in a .env.local file at the root of your project:
# .env.local
DATABASE_URL=postgresql://localhost:5432/mydb
NEXT_PUBLIC_API_URL=https://api.example.com
FIGMA_ACCESS_TOKEN=figd_xxxxxxxxxxxxxVariables prefixed with NEXT_PUBLIC_ are exposed to the browser. All other variables are server-side only and never sent to the client. This is important for security — never put secret keys in NEXT_PUBLIC_ variables.
For production, add environment variables through the Vercel dashboard:
If your deployment fails, Vercel shows the build logs in the dashboard. Common build errors include:
package.json. Run npm install and push again.npm run dev but will fail the production build.next.config.js to ignore them (not recommended).<img> instead of Next.js <Image> component triggers warnings that can become errors.Warning:
npm run devandnpm run buildbehave differently.devskips many checks for speed.buildenforces strict TypeScript, ESLint, and optimization rules. Always runnpm run buildlocally before pushing to catch errors early.
You can connect a custom domain to your Vercel project:
mydesignsystem.com)For advanced users, the Vercel CLI lets you deploy from the terminal without pushing to GitHub.
# Install the CLI globally
npm install -g vercel
# Log in to your account
vercel login
# Deploy from your project directory
vercel
# Deploy to production
vercel --prodThe CLI is useful for quick previews or debugging, but the GitHub integration is recommended for production workflows.
Run through this checklist before submitting any assignment:
npm run build and fix all errorsIf you want to deploy your Storybook alongside your main application, create a separate Vercel project for the Storybook build.
// vercel.json (in project root, for Storybook project)
{
"buildCommand": "npm run build-storybook",
"outputDirectory": "storybook-static",
"framework": null
}This tells Vercel to run the Storybook build instead of the Next.js build and serve the resulting static files. Deploy this as a separate Vercel project pointing to the same GitHub repository but with this custom configuration.
You will end up with two URLs:
your-project.vercel.app — your main Next.js applicationyour-project-storybook.vercel.app — your Storybook component library