Stop 14 · Deployment & PerformanceTopics · 1/9

Static vs Dynamic Hosting

Part of the Web Development Roadmap

In short

Before you deploy anything, ask one question: does this project only serve files, or does it run code for each request? The answer decides where it goes, how much it costs and how fast it is.

Static hosting serves ready-made files like HTML, CSS, JavaScript and images, which is cheap and fast. Dynamic hosting runs server code like an Express API that builds responses on each request.

The jaadu stands between a station kiosk stacked with ready-packed sandwiches and a sizzling dosa counter where a fresh dosa is being spread on a hot griddle.

Think of it like this

Packed sandwiches versus a live counter

A railway station kiosk sells packed sandwiches made in the morning. Grab one and go, instantly, and the kiosk can serve hundreds of people. A live dosa counter cooks each order fresh, so it can make exactly what you ask for, but it needs a cook, a stove and more time. Static hosting is the packed sandwich. Dynamic hosting is the live counter.

Watch it happen

Two kinds of hosting

Static

  • Serves ready-made HTML, CSS, JS, images
  • A React build (dist folder) counts
  • Cached on a CDN close to users
  • Free tiers: GitHub Pages, Netlify, Vercel

Dynamic

  • Runs server code like an Express API
  • Builds a response for each request
  • Can use a database and secrets
  • Render, Railway, or a cloud VM

Most full-stack apps use both: the React frontend on a static host, and the API on a dynamic host.

The big ideas

What you need to know

Static is just files

The server sends the same file to everyone. No code runs on the server, so it's cheap, fast and hard to break.

Dynamic runs code

Each request runs your code: check the login, query the database, build a response. It needs a running process.

React apps are static

npm run build makes plain files. All the logic runs in the visitor's browser, so a static host is enough for the frontend.

Free dynamic tiers sleep

Many free backend plans pause your server when idle, so the first request after a while is slow. That's normal on free plans.

How it works

Which host for which project?

  1. 1

    Portfolio, landing page

    Static only. Free and instant.

  2. 2

    React app using a public API

    Static. The browser calls the API directly.

  3. 3

    App with login or a database

    Frontend on static hosting, backend on a dynamic host.

  4. 4

    Secret API keys involved

    Must be dynamic, because secrets can't live in browser code.

Save yourself the pain

Common mistakes

Oops

Trying to run an Express server on GitHub Pages.

Do this instead

GitHub Pages only serves files. Put the API on a platform that runs Node.js.

Oops

Hiding a secret API key in a React app because it's 'deployed'.

Do this instead

The built JavaScript is downloaded by every visitor and can be read. Keep secrets on a backend.

Your mission

Sort your projects

~15 min

Quick check

Your React weather app calls a free public API with no secret key. What hosting does it need?

Go deeper

  1. 1Decide which of your projects are static and which need a running server.
  2. 2Compare the free tiers of a static host and a backend hosting platform.
  3. 3Learn that a React app built with Vite is static once it is built.

More topics at this stop

Stuck on this topic? Ask an Insider

Get 1:1 guidance from people who've walked this exact path — on the InsideEdge app.

Download
InsideEdge