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.jsWhen 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:
- Remember? Must something a visitor did survive for later, or show up on another device?
- Personal? Must different visitors see different data?
- 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).