r/javascript • u/Nefzaoui • 8d 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 wroteOne 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 arm64dockerode, 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 cookieServer-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.
1
1
u/Ronin-s_Spirit 1d ago
I'm confused, what is Docker doing here if all you have is an admin panel website?
1
u/Nefzaoui 1d ago
the panel is the website, but every minecraft server it manages runs as its own docker container (the itzg image), and the panel starts, stops and reads them through the docker api. the panel itself can run in docker too, or straight from node
1
1
u/Plastic_Koala2044 2d ago
Plain JS with node:sqlite and no build step is a good fit for a panel like this. Nice writeup.
0
u/fracturetrey 7d ago
I've been using this for a few weeks now and it's been perfect for me. I was new to MC server administration altogether so there was a bit of a learning curve, but in the end I found the panel helped me make sense of the game's data model. Thanks for putting the project together!
0
u/Nefzaoui 7d ago
this made my day, thank you so much 🙏 and that's exactly the kind of thing i hoped for, that the panel makes the game's moving parts easier to follow instead of hiding them. if anything ever confuses you or breaks, open an issue on GitHub and i'll look at it.
1
u/gianluca_caruso-6 6d ago
Do slow tabs get bounded queues, so one backed-up WebSocket can't delay log delivery to every subscriber?