// the find
jczic/MicroWebSrv2
The last Micro Web Server for IoTs (MicroPython) or large servers (CPython), that supports WebSockets, routes, template engine and with really optimized architecture (mem allocations, async I/Os). Ready for ESP32, STM32 on Pyboard, Pycom's chipsets (WiPy, LoPy, ...). Robust, efficient and documented!
MicroWebSrv2 is a fully async HTTP server written in Python that targets MicroPython on microcontrollers (ESP32, STM32/Pyboard, Pycom) while also running on CPython. It handles routes, WebSockets, SSL, and a basic template engine through its own custom async socket layer (XAsyncSockets) rather than asyncio. For anyone embedding a REST API or WebSocket server into IoT firmware, this is the most capable option in the MicroPython ecosystem.
- Pre-allocated memory buffer pools via configurable slot counts and sizes — critical on microcontrollers where dynamic allocation kills you, and the EmbeddedConfig/LightConfig/NormalConfig presets make this immediately usable without tuning.
- Rolls its own async I/O layer (XAsyncSockets) that works on both CPython and MicroPython, since MicroPython's asyncio support has historically been limited and inconsistent across ports.
- Route system with typed path arguments (e.g. `/users/<id>/profile/<prop>`) and decorator syntax is clean and matches what you'd expect from a modern web framework, remarkable given the target platform.
- Active maintenance — last push August 2025, not an abandoned project, and the author also ships a companion ESP32 IDE (MPY-Jama).
- No `pip install` from PyPI — install is via git URL or zip, and on-device deployment to MicroPython requires manually copying files via ampy/rshell/Thonny, which is friction the README glosses over.
- XAsyncSockets is a homegrown async layer that predates MicroPython's modern asyncio (`uasyncio`) maturation. On CPython you're fighting `asyncio` interop when you need to do anything outside the server; on MicroPython newer firmware versions have better `uasyncio` support that makes this layer feel like legacy debt.
- The PyhtmlTemplate module (`.pyhtml` pages) executes arbitrary Python mixed into HTML files — no sandboxing, no escaping by default, a footgun on any device where the web root isn't 100% trusted.
- Test suite is nonexistent. There are demo files, but no unit or integration tests in the repo, so you're flying blind if you change anything in the core socket handling.