2026-09-01 10:57:59 +10:00
2026-09-01 10:57:59 +10:00
2026-09-01 10:57:59 +10:00
2026-09-01 10:57:59 +10:00
2026-09-01 10:57:59 +10:00
2026-08-27 14:25:38 +10:00
2026-09-01 10:57:59 +10:00
2026-09-01 10:57:59 +10:00
2025-11-09 10:17:57 +10:00
2026-09-01 10:57:59 +10:00
2026-09-01 10:57:59 +10:00
2025-11-09 09:51:04 +10:00
2026-09-01 10:57:59 +10:00
2026-09-01 10:57:59 +10:00

Device Framework Template Engine

DFTE streams HTML and text for ESP8266 and ESP32 without constructing a giant response in RAM. It combines PROGMEM templates, live getters, nested layouts, conditions, and iterators with request-safe asynchronous HTTP rendering.

Why use it

  • Predictable memory: render fixed-size chunks instead of one large String.
  • Reusable templates: keep layouts, partials, CSS, and HTML in flash.
  • Live device data: resolve values from getters only when a chunk is rendered.
  • Safe async responses: use one render context per HTTP request while sharing one prepared registry.

Try it

#include <TemplateEngine.h>

static const char PAGE[] PROGMEM = "<h1>%TITLE%</h1>";
    Serial.begin(115200);
PlaceholderRegistry registry;
TemplateContext context;

void setup() {
    registry.registerProgmemData(PSTR("%TITLE%"), PSTR("Hello DFTE"));
    registry.registerProgmemTemplate(PSTR("%PAGE%"), PAGE);
    context.setRegistry(&registry);
    TemplateRenderer::initializeContext(context, PSTR("%PAGE%"));
}

void loop() {
    uint8_t chunk[128];
    if (!TemplateRenderer::isComplete(context) && !TemplateRenderer::hasError(context)) {
        Serial.write(chunk, TemplateRenderer::renderNextChunk(context, chunk, sizeof(chunk)));
    }
}
Goal Example
Smallest placeholder render HelloPlaceholder
Layouts, partials, and conditions NestedLayouts
Async HTTP streaming StreamingAsync
Dashboard, iterators, and telemetry AsyncDashboardDemo

Install

lib_deps =
    DeviceFrameworkTemplateEngine=https://github.com/alexhopeoconnor/DFTE.git#v1.1.0

PlatformIO checks out the Git ref after #; GitHub Release assets are unrelated. DFTE’s supported release targets are ESP8266 and ESP32.

Documentation

Read the documentation index for template syntax, async web responses, per-context memory sizing, examples, tests, and releases.

Development and releases

./scripts/test.sh compile --platform esp8266
./scripts/test.sh compile --platform esp32
./scripts/check-docs.sh
./scripts/prepare-release.sh vMAJOR.MINOR.PATCH --tag

Tagging repeats the board-free compile checks, validates the package, and creates a GitHub Release from the matching changelog section. It does not publish to the PlatformIO Registry or deploy firmware.

See the changelog and licence.

S
Description
DeviceFrameworkTemplateEngine is a lightweight Arduino-compatible renderer for ESP8266 and ESP32.
Readme MIT
312 KiB
Languages
C++ 93.8%
C 4.3%
Shell 1.9%