Deploying Frontend Apps
Host static and server-rendered apps on Vercel, Netlify or Cloudflare with preview deployments, custom domains, rollbacks and monitoring.
Intermediate · about 4 hours · difficulty 2/5
Learn first: HTTP Caching, Compression and CDNs, Git and GitHub
A project nobody can open is not a portfolio piece. Modern frontend hosting makes deployment almost effortless, but you still need to understand what is being deployed and how it behaves in production.
What you deploy
- Static builds (a Vite SPA, an Astro or SSG site): a folder of HTML, JS, CSS and assets served from a CDN. Configure an SPA fallback so deep links serve
index.html. - Server-rendered apps (Next.js, Nuxt, SvelteKit, React Router): code that also runs on servers, serverless functions or edge runtimes.
Platforms
- Vercel: first-class Next.js support, previews per pull request and edge functions.
- Netlify: great for static and Jamstack sites, forms, functions and redirects files.
- Cloudflare Pages / Workers: a global edge network, generous free tier, edge-first runtime.
- GitHub Pages for purely static projects; containers on any cloud when you need full control.
Everyday features
- Connect the Git repository: every push to
maindeploys production, every pull request gets a preview URL for review. - Custom domains with automatic HTTPS, redirects, rewrites and custom headers (security and caching).
- Instant rollbacks to a previous deployment.
- Monitoring: error tracking (Sentry or similar) with uploaded source maps so stack traces are readable, plus analytics and Core Web Vitals from real users.
Pitfalls
Refreshing a deep link returns 404 (missing SPA fallback); build succeeds locally but fails in CI (different Node version, case-sensitive imports); unreadable production errors (no source maps); and surprise bills from unbounded serverless usage.
Good enough to move on
You have deployed at least one SPA and one server-rendered app with custom domains, previews on pull requests, security and caching headers, and error tracking with source maps.
Key concepts
- Static vs server-rendered deployments
- Vercel
- Netlify
- Cloudflare Pages and Workers
- Preview deployments
- Custom domains, redirects and headers
- SPA fallback routing
- Rollbacks
- Error tracking with source maps
Mini project
Deploy your React app to Vercel or Netlify and a static site to Cloudflare Pages, each with a custom domain, preview deployments on pull requests, caching and security headers, and Sentry error tracking with source maps.
Check yourself
Your SPA works when you navigate from the home page but /settings returns 404 on refresh. Why, and how do you fix it on the host?
Free resources
- Vercel Documentation (Vercel)
- Netlify Docs (Netlify)
- Cloudflare Pages (Cloudflare)
- Deploying a Static Site (Vite)