A local development server

For a long time, I used Vercel’s serve for local development. It’s simple, and I like that it prints both local and network addresses. But recently I was developing gitmal, which generates relative links like ../../ for navigation, and Vercel’s server didn’t behave properly. It strips / and .html parts from URLs.

Obviously, PHP and Python both have built‑in servers. But I like the npx approach, so I decided to check how serve works. I discovered it has a tremendous number of dependencies—hundreds. So I looked for an alternative. One popular option is http-server, but it also pulls in a long tail of dependencies.

So I wrote my own, with zero dependencies: srf.

Serving public/

    - Local:    http://0.0.0.0:8080
    - Network:  http://192.168.1.42:8080

[2025-12-03T20:00:42.007Z] GET /index.html -> 200

Single file, no dependencies, and twice as fast as the solutions above.

Srf also has a built-in directory listing. It’s pretty simple and generates minimal HTML. Nowadays, it’s super simple to create a nice-looking HTML page with as little as this:

html { 
  color-scheme: light dark; 
  font: 16px system-ui; 
}

This gives you light and dark themes, plus a nicer font. Nothing else is needed.

Why is it called srf? Because I was looking for a short, free npm package name so I can do this:

npx srf
0
188

Comments

big fan
2025-12-08 21:45:06
Super awesome that you reduced the bloat so much on your local developement server! How much of your website traffic comes from bitplanes? You should add ranked multiplayer matchmaking with p2p networking, its really a simple addition.
Avatar
antonmedv
Thanks! Adding p2p is very complex. Expecially for a game designed to be playing locally.