Skip to the workspace
Pebellslearn by building
How a Full-Stack App Fits Together  ›  Lesson

Static Pages and Where They Stop

HTML 12 minA static site sends the same files to every visitor, and a feature needs a server and database as soon as it must remember something, differ per person, or keep a secret.

full stack / Static Pages and Where They Stop

Explore each scene at your own pace.

01 · The rule

The rule

Static Pages and Where They Stop

Throughout this course you will build Sprout, a small app that helps people keep their houseplants alive. Its welcome page needs nothing but HTML and CSS files: upload them to any web host and anyone can open them. Then someone asks, "Can I save my plants?", and a folder of files has no answer. Knowing exactly where a static site stops tells you when you need the rest of the stack.

The rule

A static page is the same file for everyone; personal or changing data needs a server.

A static site is a folder of files:

sprout-site/
  index.html
  guides.html
  styles.css
  calculator.js

When a browser asks for /guides.html, the host finds that file and sends its bytes unchanged. Every visitor gets the identical file. That is not a weakness: static hosting is cheap, fast and hard to break, and it suits a landing page, documentation, a portfolio or a blog that is rebuilt whenever you publish.

JavaScript can still make a static page interactive. Sprout's watering calculator ("every 5 days from today") runs entirely in the browser. But everything the page knows either shipped inside those files or is kept in that one browser.

A static site stops being enough the moment you answer yes to any of three questions:

  1. Remember? Must something a visitor did survive for later, or show up on another device?
  2. Personal? Must different visitors see different data?
  3. Secret or checked? Must something stay hidden from the visitor, or a rule be enforced that they cannot skip?

Any yes means you need code on a machine you control (a server) and somewhere durable to keep data (a database).

Scene 1 of 5
Hover to wake the cannons. Drag to move, or use arrow keys when focused. Press Enter to fire a shot.