Tooling

Style guide: how this blog looks

Every element a post here can use, written the way Lene and I write them.

Lene asked for one page that shows how everything looks before she writes a guest chapter. This is it. Each heading names the element below it.

Heading level two

Sections a reader jumps to, such as "The unit file". They fill the table of contents.

Heading level three

A step inside a section. Indented in the table of contents.

Heading level four

Rare. Used once, for the variants of a config option.

Heading level five

Not used yet.

Heading level six

Not used yet either, but it has a size.

Paragraph with inline formats

The router is 20 lines, none of them a regular expression, and the nodemon watcher is gone. Write commands as node --watch. The handler is pure, p99 stays under 5 ms, 210 requests is where it starts to show, and the test suite runs in 41 ms. More in chapter 3.

Bulleted list

  • Node 24, nothing else.
  • One chapter a fortnight.
  • Code for every chapter in the repository.

Numbered list

  1. Write the test.
  2. Make it pass.
  3. Delete what you no longer need.

Blockquote

A handler takes a Request and returns a Response. Everything else is somebody’s framework.

Aside quote

Lene’s rule for reviews: if I have to run it to understand it, the post is missing a sentence.

Code block with a file name

export function route(method: string, pattern: string, handler: Handler) {
  routes.push({ method, parts: pattern.split('/'), handler });
}

Terminal

$ node --version
v24.11.1
$ curl -s localhost:8080/posts/hello
You asked for: hello

Diff

-const handle = () => new Response('Hello');
+const handle = match;

Marked, added and removed lines

const port = Number(process.env.PORT ?? 8080); // [!code highlight]
const host = '0.0.0.0'; // [!code --]
const host = '127.0.0.1'; // [!code ++]

Tabs

$ pnpm add -D @types/node
$ npm install --save-dev @types/node
$ yarn add --dev @types/node

Long block, folded

name: test
on:
  push:
    branches: [main]
  pull_request:
jobs:
  test:
    runs-on: ubuntu-24.04
    steps:
      - uses: actions/checkout@v4
      - uses: actions/setup-node@v4
        with:
          node-version: 24
      - run: npm ci
      - run: npm test
      - run: npm run lint
      - run: node --test --experimental-test-coverage test/

Wrapped lines

[server]
base_url = "https://stummel.example"
allowed_targets = ["example.org", "example.com", "docs.example.org", "blog.example.com", "status.example.org"]

Code with a caption

SET lock_timeout = '5s';
Before every migration since the night the click counter stopped.

Horizontal rule

Separates a postscript from the post.


Image, regular width

An editor with the router file: route and match in 13 lines.
src/router.ts at the end of chapter 3.
A line chart of stummel’s clicks a day in October, with a spike on 2026-10-17.
The spike on 2026-10-17 was one link in a newsletter. The image links to the release notes.

Image, wide

A diagram of one request through the tiny server.
One request, five steps.

Image, full width

A dark chart-paper background with the prompt ~/mira-okafor $ and a cursor.
The prompt this blog is named after.

Callouts

Note, tip, warning and danger take the colours of the code. The others follow Ghost’s callout colours.

ℹ️
Node 24 runs .ts files directly. Older versions need --experimental-strip-types.
✅
Keep handlers pure and the tests need no port.
⚠️
duplex: 'half' is required for a request with a streamed body.
🛑
Never run the server as root. Chapter 6 gives it a user of its own.
📎
The code of every chapter is in the repository, tagged by chapter.
🧾
Numbers come from the mini PC under the desk, median of three runs.
🎂
stummel turned one on 2026-11-03.
🧪
Chapter 5 was written with Lene. Blame her for the test names.
📬
The monthly mail goes out on the first.

Toggle

Why no framework?

Because the series is about what a framework does for you. Use one afterwards.

Does it run on Bun or Deno?

The router does. The server uses node:http; chapter 1 shows the four lines to change.

Bookmark

tiny-server
An HTTP server in TypeScript, built in six chapters without dependencies.
The repository, one tag per chapter.

A second bookmark

stummel
A small link shortener with expiring links and honest click counts.

Button

Button, centred

Header card

A tiny HTTP server

Six chapters, no framework, no dependencies.

Start with chapter 1

Header card, split with image

stummel v1.4.0

Read the release notes

Header card, centred

41,380 requests a second

Without the router. 38,905 with it.

Signup card

Call to action

SPONSORED

stummel runs on a mini PC that costs 4 euros a month in power. Supporters pay for it.

Become a supporter

Call to action for members

Only members see the card under this heading. Sign in and it shows up here.

Product

The mini PC under the desk

Four cores, 16 GB, 6 watts at idle. Every benchmark on this blog ran on it.

Read how I benchmark

Audio

audio-thumbnail
Tests pass
0:00
/2

Video

0:00
/0:07
node --watch restarting the server on save.

Looping video

0:00
/0:06

File

Embed

stummel.example: all checks green for 26 days.

The status page, embedded.

HTML card with a table

ChapterLines added
111
320
418

Markdown card with a table

Command What it does
node --watch restarts on save
node --test runs the tests

Typesetting

The first paragraph of a post is set larger. These posts show the other variants:

Members pages

Readers who sign up meet four pages: Sign up, Sign in, Account and Pricing.

Comments

Buy Logbuch