Skip to content

Architecture

NunjucksRunjucks
lex → parse → transform → compile to JSnew Function → runlex → parse → tree-walk render in Rust

Template context from JavaScript is passed as a plain object and converted to a JSON-compatible representation for the engine.

flowchart LR
JS["Node.js: renderString / Environment"]
R["Rust engine: lex → parse → render"]
JS -->|"template + context"| R
R -->|"string"| JS

The npm package is a thin binding layer around that engine. If you work on the Rust code, browse the Rust API (rustdoc) on this site or open the repo layout described there.

When comparing behavior, the Nunjucks source remains the reference for intent. Runjucks does not compile templates to JavaScript or eval them; it evaluates an AST with the same broad language goals.