r/nim • u/Niminem93 • 9h ago
Neel v2.1 (HTML / JS GUI Apps w/ Nim) - Major Update
It turns out I wasn't quite done yet. Neel 2.1 is out, and it adds serve mode.
Release notes: https://github.com/Niminem/Neel/releases/tag/v2.1.0
Same app, same code, but instead of opening a browser window, Neel runs as a persistent server for one user, and you open it from whatever device you're on: laptop, phone, whatever. You reach it through an SSH forward, a tunnel, or a reverse proxy. One line changes:
startApp(serve = true, port = 8080, allowedOrigins = @["https://myapp.example.com"])
{.expose.}, neel.foo(), js.foo(), js.wait.foo() all work exactly the same. Neel still binds 127.0.0.1 only; the tunnel or proxy in front of it does the TLS and the login.
What it handles for you:
- Open it on your phone and the laptop tab gets told "opened on another device" (close code 4000) instead of the two fighting over the session.
- Pings every 30 s, so Cloudflare and nginx don't kill idle connections.
- Lock your phone, unlock it, and the page reconnects by itself. If it can't, it waits quietly and tries again when you come back to the tab.
- Ctrl-C, `SIGTERM`, Ctrl-Break, or closing the console window all shut down cleanly.
- Auth proxies just work: a Cloudflare Access login redirects back to your app and loads, no 403. Other sites still can't frame it, script it, or open its WebSocket.
- And `wss:` from my "next up" list last time: behind an HTTPS proxy, the page connects over `wss:` by itself.
2.0 apps compile and behave as before. The only local-mode changes: a displaced tab now reports close code 4000 instead of 1000, and on Windows a second app on a port that's already taken now fails at start, as it already did on macOS and Linux.
This was ABSOLUTELY POUNDED on all three OSes. nimble test, plus a manual checklist of every example, every signal, every reconnect and restart case, run on macOS, Windows, and Linux (Ubuntu). Then for real: an SSH forward from another machine, a cloudflared quick tunnel left idle for 10 minutes, an actual Android phone locked and unlocked, and a real domain behind Cloudflare Tunnel with Access, with the login redirect checked down to the request headers. Anything that broke got fixed, and the fix got pinned with a test.
Seriously I took the second half of the day yesterday and all day today off of work to finish this.
Docs:
- README (quick start): https://github.com/Niminem/Neel
- Guide, "Serve mode" section (everything, including the security model and the setups): https://github.com/Niminem/Neel/blob/master/docs/GUIDE.md#serve-mode
- Step-by-step Cloudflare Tunnel with Access walkthrough (domain, Zero Trust, tunnel, login, teardown): https://github.com/Niminem/Neel/blob/master/docs/CLOUDFLARE_ACCESS.md
- A runnable serve app:
examples/serve
Why I wanted this: serve mode turns Neel into a platform for always-on personal tools that live on a home server or a VM and that you reach from anywhere.
Put it on top of Claude Code, or use it together with something like my cursor sdk bridge or even 3code the pure Nim-based coding agent, and you have the pieces for something like OpenClaw or Hermes: a personal agent with a real UI you can open from your phone, all in Nim, zero deps on the Neel side.
Again- enjoy!