Exapedia / Tools / JavaScript template engine libraries JavaScript template engine libraries Updated Nov 2026
JavaScript template engine libraries render HTML or text by filling a template with data in Node.js and the browser. An engine either embeds plain JavaScript in the template or uses its own tag syntax with helpers, partials, and layout inheritance. These libraries let web servers, static site generators, and email tools build pages from shared templates.
Popularity Capabilities Lodash EJS Handlebars Underscore mustache Eta Pug Nunjucks FAQ Popularity EJS has the most monthly downloads among dedicated template engines in this comparison, at 223.7M .
Library Monthly downloads Stars Last release License Lodash 801.2M
Not on GitHub Apr 2026 MIT EJS 230.1M
8.1K Oct 2026 Apache-2.0 Handlebars 219.7M
18.7K Oct 2026 MIT Underscore 166.4M
Not on GitHub Feb 2026 MIT mustache 98.2M
16.7K Mar 2021 MIT Eta 42.4M
Not on GitHub Apr 2026 MIT Pug 19.8M
Not on GitHub Mar 2026 MIT Nunjucks 19.3M
9.0K Apr 2023 BSD-2-Clause Downloads: npm , last thirty days. Stars and releases: GitHub. Amber: no release in over a year.
Features compared Library Escapes interpolation Async rendering File-loading API Lodash Unsupported Unsupported Unsupported EJS Built-in Built-in Built-in Handlebars Built-in Unsupported Built-in Underscore Unsupported Unsupported Unsupported mustache Built-in Unsupported Unsupported Eta Built-in Built-in Built-in Pug Built-in Unsupported Built-in Nunjucks Built-in Built-in Built-in
Libraries and code examples Compiles text templates with configurable delimiters as one part of a broad utility library.
Downloads / mo 801.2M
Last release 4.18.1
License MIT $ npm install lodash@4.18.1 Copy
const _ = require('lodash');
const render = _.template('Hello <%= name %>!');
const output = render({ name: 'Ada' });
Lodash examples From open-source projects on GitHub function compile(options, data, render) {
return gulpPlugin('gulp-template', file => {
const contents = file.contents.toString();
try {
const template = _.template(contents, options);
file.contents = Buffer.from(render ? template(_.merge({}, file.data, data)) : template.toString());
return file;
} catch (error) {
error.message = `${error.message} in ${file.path}`;
error.fileName = file.path;
throw error;
}
});
}
Show full example Generates template output using JavaScript control flow and escaped or raw interpolation.
Downloads / mo 230.1M
Stars 8.1K
Last release 7.0.2
License Apache-2.0 Strengths Uses JavaScript inside templates . Write loops and conditions with normal JavaScript. Changes delimiters per template . Choose delimiters per render instead of changing global settings. Limitations Templates need trusted authors . Do not accept unrestricted template source from end users. Layouts rely on includes . Compose headers and footers; EJS does not provide layout blocks. $ npm install ejs@7.0.2 Copy
const ejs = require('ejs');
const output = ejs.render('Hello <%= name %>!', { name: 'Ada' });
EJS examples From open-source projects on GitHub async compile(str, inputPath) {
let options = this.getEjsOptions();
if (inputPath && inputPath !== "ejs" && inputPath !== "md") {
options.filename = inputPath;
}
let fn = this.ejsLib.compile(str, options);
return function (data) {
return fn(data);
};
}
Show full example Generates HTML or other template text from an input object.
Downloads / mo 219.7M
Stars 18.7K
Last release 4.7.10
License MIT Strengths Precompiles templates for client execution . Generate template code before deploying the rendering runtime. Reuses registered partial templates . Register partials once and call them from other templates. Limitations Missing fields are silently ignored . Enable strict to throw when template data is missing. Prototype properties are blocked . Convert model instances to plain objects before rendering. $ npm install handlebars@4.7.10 Copy
const Handlebars = require('handlebars');
const render = Handlebars.compile('Hello {{name}}!');
const output = render({ name: 'Ada' });
Handlebars examples From open-source projects on GitHub async compile(str) {
// Ensure partials are cached and registered.
await this.getPartials();
let fn = this.handlebarsLib.compile(str);
return function (data) {
return fn(data);
};
}
Show full example Compiles text templates with evaluate, interpolate, and escape tags as one part of a utility toolkit.
Downloads / mo 166.4M
Last release 1.13.8
License MIT $ npm install underscore@1.13.8 Copy
const _ = require('underscore');
const render = _.template('Hello <%= name %>!');
const output = render({ name: 'Ada' });
Underscore examples From open-source projects on GitHub function() {
this.$el.html(this.template(this.model.toJSON()));
this.$el.toggleClass('done', this.model.get('done'));
this.input = this.$('.edit');
return this;
}
Expands template tags using values supplied in an object.
Downloads / mo 98.2M
Stars 16.7K
Last release 4.2.0
License MIT Strengths Reuses partials at runtime . Supply partial text by name when rendering nested templates. Changes tag delimiters inline . Switch delimiters when braces conflict with other template content. Limitations Complex branching belongs in data . Prepare decisions in view values or helper functions. Missing keys render nothing . Validate required input fields before rendering. $ npm install mustache@4.2.0 Copy
const Mustache = require('mustache');
const output = Mustache.render('Hello {{name}}!', { name: 'Ada' });
mustache examples From open-source projects on GitHub async compile(str) {
let partials = await super.getPartials();
return function (data) {
return this.render(str, data, partials).trim();
}.bind(this.mustacheLib);
}
Renders embedded JavaScript templates with escaping by default, async methods, includes, and layouts.
Downloads / mo 42.4M
Last release 4.6.0
License MIT $ npm install eta@4.6.0 Copy
const { Eta } = require('eta');
const eta = new Eta();
const output = eta.renderString('Hello <%= it.name %>!', { name: 'Ada' });
Eta examples From open-source projects on GitHub export async function compileSSGTemplate(
template: string,
): Promise<SSGTemplateCompiled> {
const eta = new Eta({rmWhitespace: true});
const compiledTemplate = eta.compile(template.trim());
return (data: SSGTemplateData) => eta.render(compiledTemplate, data);
}
Compiles a whitespace-sensitive template language to HTML with includes and block inheritance.
Downloads / mo 19.8M
Last release 3.0.4
License MIT $ npm install pug@3.0.4 Copy
const pug = require('pug');
const output = pug.render('p Hello #{name}!', { name: 'Ada' });
Pug examples From open-source projects on GitHub async compile(str, inputPath) {
let options = this.getPugOptions();
if (!inputPath || inputPath === "pug" || inputPath === "md") {
// do nothing
} else {
options.filename = inputPath;
}
return this.pugLib.compile(str, options);
}
Show full example Renders templates with reusable layouts and overridable blocks.
Downloads / mo 19.3M
Stars 9.0K
Last release 3.2.4
License BSD-2-Clause Strengths Supports template inheritance . Use extends and blocks to share page layouts. Supports asynchronous template work . Add asynchronous filters and loaders for data-dependent rendering. Limitations Default API shares one configuration . Create an explicit Environment when instances need separate settings. Async loaders need async rendering . Use callback-based rendering with asynchronous loaders. $ npm install nunjucks@3.2.4 Copy
const nunjucks = require('nunjucks');
const output = nunjucks.renderString('Hello {{ name }}!', { name: 'Ada' });
Nunjucks examples From open-source projects on GitHub async compile(str, inputPath) {
let tmpl;
if (this._usingPrecompiled) {
tmpl = this.njkEnv.getTemplate(str, true);
} else if (!inputPath || inputPath === "njk" || inputPath === "md") {
tmpl = new NunjucksLib.Template(str, this.njkEnv, null, true);
} else {
tmpl = new NunjucksLib.Template(str, this.njkEnv, inputPath, true);
}
return async function (data) {
return new Promise(function (resolve, reject) {
tmpl.render(data, function (err, res) {
if (err) {
reject(err);
} else {
resolve(res);
}
});
});
};
}
Show full example For coding agents
Found your template engine library? Help your agent use it. Connect Exa so your coding agent can find the library’s documentation, check its API, and look up implementations while you build.
Claude Code Cursor Codex VS Code Devin Devin Desktop Gemini CLI OpenCode
Run in your terminal
claude plugin install exa@claude-plugins-official Copy Add to ~/.cursor/mcp.json
{
"mcpServers": {
"exa": {
"url": "https://mcp.exa.ai/mcp"
}
}
} Copy Open in your browser, then install the Exa plugin
https://chatgpt.com/plugins/exa Copy Add to .vscode/mcp.json
{
"servers": {
"exa": {
"type": "http",
"url": "https://mcp.exa.ai/mcp"
}
}
} Copy In Devin, open Customize, then MCPs, and add a custom HTTP server with this URL
https://mcp.exa.ai/mcp Copy Add to ~/.config/devin/mcp_config.json
{
"mcpServers": {
"exa": {
"serverUrl": "https://mcp.exa.ai/mcp"
}
}
} Copy Add to ~/.gemini/settings.json
{
"mcpServers": {
"exa": {
"httpUrl": "https://mcp.exa.ai/mcp"
}
}
} Copy Add to opencode.json
{
"mcp": {
"exa": {
"type": "remote",
"url": "https://mcp.exa.ai/mcp"
}
}
} Copy