doT.js review
A lightweight open-source engine for compiling JavaScript templates into rendering functions.
Reviewed by iTechGuides Editors · Editorial team · Updated Oct 2026
For JavaScript developers generating HTML, text, or code from templates, doT.js compiles templates into rendering functions and runs in Node.js and browsers. Its small scope centers on interpolation and evaluation, with support for both logic-based syntax and a logic-less style. The project is open source and provides tooling to compile template files into JavaScript modules, making it a fit for teams that want templates close to their JavaScript code rather than a broader presentation system.
Its feature set covers runtime and compile-time evaluation, conditionals, array iteration, and partials. Developers can customize delimiters and choose whether whitespace is stripped or preserved. The engine supports both runtime rendering and compilation ahead of use, so teams can choose how templates fit into their application. This flexibility is useful for rendering HTML as well as other text or code, but it does not include template inheritance or automatic escaping. Teams that need those capabilities should consider an engine with explicit support for them.
The key operational consideration is trust: the maintainer warns that templates can contain arbitrary JavaScript, so they should be treated as trusted code. That makes doT.js a more natural fit for developer-controlled templates than for user-supplied content. The repository describes the project as rarely updated, lists v1.1.3 as its latest release, and mentions a v2 beta. Choose it when an open-source JavaScript engine with compilation and a compact feature set suits the implementation; look elsewhere if untrusted template execution, inheritance, or automatic escaping is central to the decision.
doT.js pros and cons
- Where it wins
- Supports runtime and compile-time evaluation, conditionals, and iteration
- Partials, customizable delimiters, and whitespace control
- Compiles template files into JavaScript functions or files
- Where it doesn't
- Templates can contain arbitrary JavaScript and must be trusted
- No template inheritance or automatic escaping
- The project is described as rarely updated
doT.js fact sheet, pricing and score →
Advertiser disclosure: iTechGuides is reader-supported. Vendors can pay for top positions in our rankings and for a place on other products' pages, and we may earn a commission when you click some links. Bought places stand at the number bought; this page and our disclosure say so. Paying vendors may get a fuller, more detailed review from our editors, and that review can change their score. How we rank.
Last updated · How we research and update