How nodets.com is built
A static site generator, zero JavaScript and one rule: every change is a new build. Notes on how this site stays fast.
This site is a small Node.js program that turns markdown into plain HTML. There is no framework, no client-side rendering and no JavaScript shipped to your browser.
One rule: every change is a new build
Nothing on the live site is assembled at request time. A page changes only when I run a build and deploy the result:
npm run deployThat command fetches the documentation of each project from its GitHub repository, renders every page to HTML with the CSS inlined, compresses it, and syncs the result to the web server. Articles like this one work the same way: a markdown file in the repository becomes a finished HTML page at build time.
Why prebuilt HTML
- Speed. The server only sends files that already exist. Each page is also precompressed, so nginx never compresses anything on the fly.
- Nothing to break. No database, no runtime, no scripts to fail. If the file exists, the page works.
- Easy to check. Syntax highlighting happens at build time, so code blocks cost zero bytes of JavaScript.
What it costs
The price is that a typo fix needs a rebuild. For a site like this, that is a good trade: a build takes seconds, and the result is the same for every visitor.