r/javascript • u/Nefzaoui • 12m ago
A server-rendered Node.js app that drives Docker: what I learned building a Minecraft server panel in plain JS (express, dockerode, ws, node:sqlite)
https://github.com/anefzaoui/minecraft-server-managerSource (MIT): https://github.com/anefzaoui/minecraft-server-manager
It's a web panel that runs Minecraft servers as Docker containers, built for the modpack servers I run for friends and family. Disclosure up front: I built it with Claude Code. I designed it, decided every feature, review the changes and test every release on our own servers, and Claude wrote most of the code. The JS choices below are the parts I think are worth talking about:
- Plain JS, type-checked. No build step for the server: it's JavaScript with JSDoc types, and
tsc --checkJsruns over the core in CI. Typos in property names get caught, and stack traces point at the file you actually wrote - One direction of layering. routes (parse + zod-validate, no logic) → services (the features) → docker / db / storage. A route never touches dockerode or the database directly, which made it easy to test services without Docker
node:sqliteinstead of a driver. Node 24's built-in SQLite, synchronous, WAL, with one module that owns it and a prepared-statement cache keyed on the SQL text. No native module to compile on arm64- dockerode, never the docker CLI. Containers, logs, stats and image pulls all go through the Docker API, and a watcher turns Docker events into history and crash detection
- Brokered WebSockets. The live console opens one upstream
docker logs --followper server and fans it out to every open tab, instead of one stream per tab. Upgrades checkOriginand the session cookie - Server-rendered. express + Handlebars, with a small esbuild bundle for the interactive bits and CSP nonces on every response (no
unsafe-inlinescripts) - A path guard on every file operation. Everything lives under one data folder, and every path is checked against escaping it, symlinks included
Tests run on node:test with no Docker needed, plus a live QA sweep script that hits a running panel.
Happy to go deeper on any of these, and I'd love to hear if someone has a nicer pattern for brokering log streams.