The Problem
You need to generate structured output — HTML pages, Markdown documents, XML files, configuration files, PDF reports. You start with string concatenation. Then templates. Then a DSL. Each project reinvents the same pattern: define a structure, validate it, produce output.
Worse: what if the same data needs to become HTML and PDF and a live widget tree? Now you have three generators that don't share anything.
Genro Builders separates structure from output. You define a grammar (what tags exist, what can contain what), describe your content as a tree, and then render it to any format. One description, many outputs. And it's reactive — change the data, the output updates automatically.
When does this actually matter?
Same data, many formats
A report that needs to be HTML for the web, PDF for printing, and Markdown for documentation — from the same source tree.
Validated structure
The grammar catches mistakes at creation time: wrong children, missing required elements, cardinality violations. No broken output.
Reactive output
Change a data value after build — the output updates automatically. No manual re-rendering.
Reusable components
@component defines composite structures that expand lazily. A login_form always generates the right inputs.
Domain-specific API
Your code reads like the domain: menu.first_courses().pasta(name="Lasagne") — not generic tree manipulation.
Subclass = document
Extend a builder, define main() and store() — your class is the document. Reusable, testable, composable.