How ldijkman/async-esp-fs-webserver works
Project type and purpose
• This is an Arduino-style library for ESP32/ESP8266 devices called “async-esp-fs-webserver.”
• Purpose: embed an asynchronous web server on the ESP, serve and edit files on its filesystem (SPIFFS/LittleFS), manage Wi-Fi credentials, support OTA firmware updates, and expose built-in web pages (/setup and /edit).
File structure
• Top-level
• library.properties, keywords.txt – Arduino library metadata
• platformio.ini – PlatformIO project configuration
• built-in-webpages/ – precompiled HTML/JS/CSS assets for /setup and /edit endpoints
• docs/ – published documentation, examples, and a browser-based flasher/serial monitor
• examples/ – Arduino sketches demonstrating usage (csvLogger, customHTML, remoteOTA, etc.)
• src/ – the actual library source
• src/
• AsyncFsWebServer.cpp/.h – main entrypoint of the library
• CaptivePortal.hpp, SetupConfig.hpp – Wi-Fi provisioning and options management
• edit_htm.h, setup_htm.h – C headers with embedded web page content
• ESPAsyncWebServer/ – vendored copy of the underlying asynchronous web server
• SerialLog.h, version.cpp – utility and version information
README for insights
• Clarifies that the library builds on ESPAsyncWebServer (Async TCP + event callbacks).
• Describes two built-in pages:
• /setup: Wi-Fi scan/selection, generic options, OTA update
• /edit: ACE-based file browser/editor for live editing of filesystem files
• Mentions mDNS for “device.local” resolution, in-browser flashing, and serial monitor.
Main components and interactions
a. Embedded Device (ESP32/ESP8266)
• Hardware: microcontroller, flash memory
b. Networking Stack
• AsyncTCP (ESP32) or ESPAsyncTCP (ESP8266)
• mDNS responder
• Wi-Fi manager / Captive Portal
c. Web Server Layer
• ESPAsyncWebServer – asynchronous HTTP server
• Web handlers:
– /setup handler (SetupConfig module)
– /edit handler (FsCodeEditor module)
– Static file handler for user-uploaded files & built-in assets
d. Filesystem
• SPIFFS or LittleFS
• API for read/write/delete files over HTTP
e. OTA Updater
• Web UI invoking Arduino OTA or Update API
f. Client
• Browser (Chromium-based)
– Wi-Fi provisioning UI
– ACE code editor UI
– Flashing UI (esptool-js)
– Serial monitor (WebSerialMonitor)
g. User sketch
• Calls AsyncFsWebServer.begin(), enableFsCodeEditor(), etc.
• May inject custom HTML/JS into built-in pages
Architectural patterns & design principles
• Event-driven, non-blocking I/O via callbacks
• Single-threaded loop with asynchronous task scheduling
• Modularization: separation between network stack, web server, filesystem, UI
• Vendored dependency isolation (embedded copy of ESPAsyncWebServer)