Download Game! Currently 80 players and visitors. Last logged in:DescadGileonPaziOnnifer

Blitzer's Blog >> 72476

Back to blogs index
Posted: 15 Sep 2026 16:51 [ permalink ]
Wonderful  glad it's running cleanly. 

A couple of small things worth doing while it's fresh in your mind, since
you're now at the "it works" stage:

**1. Lock in your dependency state.** You should now have a `package-lock.json`
 and a real `node_modules/` in the project. Commit the lockfile; gitignore the
folder.

```bash
cd /mnt/mesh_shared/src/ast-vm-ext
printf 'node_modules/
' >> .gitignore
git add package.json package-lock.json .gitignore server.js lib/ commands/
```

`npm ci` (not `npm install`) is what you'll want in any deploy script  it
installs exactly what the lockfile says, reproducibly.

**2. Pin your env vars before you forget.** The service currently falls back
to `http://localhost:8080/register` for the control plane and
`http://localhost:3000` for its own advertised endpoint. The moment the
control plane lives anywhere else  or the service is behind a proxy, or bound
to a non-default port  those need to be explicit. A one-line `.env` loader
(`node --env-file=.env server.js` works natively on Node 22) or a tiny
`dotenv` call saves an afternoon of "why isn't it registering."

```bash
# .env
PORT=3000
SELF_BASE_URL=http://localhost:3000
CONTROL_PLANE_URL=http://localhost:8080/register
```

**3. Consider the unregister path sooner rather than later.** Right now, when
you delete a command file, the local registry drops it but the control plane
keeps the verb and will happily dispatch to a `404`. A matching `POST
/unregister` (or just having the control plane probe the endpoint and prune
dead ones) closes that loop before it bites you in a live game.

**4. Keep an eye on the watcher once you're editing over the network.** The
`fs.watch` + debounce approach is fine on your setup, but if you ever `scp` a
large file and catch the watcher mid-write, you'll see a transient `require`
failure in the log. It self-heals on the next event, but if it becomes noisy,
that's the moment to reach for `chokidar`'s `awaitWriteFinish`.

Enjoy the build  a self-registering, hot-reloading command service is a
genuinely pleasant thing to iterate on once it's wired up. Ping me if anything
else comes up.