Deploying Your Website
From your laptop to the world
| You built | Deploy to | How |
|---|---|---|
| Plain HTML/CSS/JS | GitHub Pages, Netlify, Vercel, Cloudflare Pages | push to GitHub, connect the repo |
| React/Vite app | Netlify, Vercel, Cloudflare Pages | build command npm run build, output folder dist |
| Next.js app | Vercel (or any Node host) | connect the repo |
| Node/Express API | Render, Railway, Fly.io | start command node index.js, set env vars |
| Database + auth | Supabase | already hosted |
The usual flow
- Push your code to GitHub.
- In the hosting dashboard, import the repository.
- Set the build command and output directory.
- Add environment variables (never commit them).
- Deploy. After that, every push to
maindeploys again automatically, and Pull Requests get preview links.
Custom domains
Buy a domain, then add the DNS records your host gives you (usually an A record or a CNAME). HTTPS certificates are created automatically.
Single-page apps and routing
For React Router apps on static hosts, add a rewrite so every path serves index.html (Netlify: _redirects with /* /index.html 200), or refreshing a sub-page gives a 404.
After launch
- Check the live site on a real phone.
- Run Lighthouse.
- Add error monitoring (Sentry) and analytics.
Example
# Deploy a Vite/React site to Netlify with the CLI
npm install -g netlify-cli
npm run build
netlify deploy --prod --dir=dist
# Or Vercel
npm install -g vercel
vercel --prod
# React Router fix for Netlify (public/_redirects):
# /* /index.html 200
# Express API on Render:
# Build command: npm install
# Start command: node index.js
# Environment: DATABASE_URL, JWT_SECRET, FRONTEND_URL
# 💻 Run on a computer