Mustache.js

Logic-less {{mustache}} templates for JavaScript, running anywhere JS runs.

Library
npm
v4.2.0
16,720stars
MIT License

Repository Health

Pre-computed score based on development activity, maintenance, community, maturity, and trend momentum.How we score it →
53/100Fair
Development Activity0
Maintenance20
Community92
Maturity60
Momentum40

Technical Analysis

AI-assessed by reading the actual repository — architecture, code quality, innovation, and documentation.How we score it →
77/100Good
Architecture75
Code Quality78
Innovation70
Learning Curve85

Mustache.js is the JavaScript implementation of the language-agnostic Mustache templating system. It expands {{tag}} placeholders in a template string using values from a plain object or array, and deliberately has no if-statements, else-clauses, or loops beyond section blocks — templates stay declarative and portable across the many other Mustache implementations (Ruby, Python, PHP, Java, and more).

The library ships as a single dependency-free file with CommonJS, AMD, and ECMAScript module builds, plus a small CLI. It’s commonly used to render HTML fragments in the browser, generate server-side output in Node.js, or produce non-HTML text such as config files and emails from a shared data context.

What You Get

  • A zero-dependency Mustache.render(template, view, partials, tags) API with automatic HTML escaping and an overridable Mustache.escape function
  • Section tags ({{#section}}) for lists, booleans, and lambda-style function values, plus inverted sections ({{^section}}) for falsy/empty cases
  • Partial template support ({{> partial}}) that inherits the calling context, resolved at render time so recursive partials work
  • Custom delimiter syntax ({{=<% %>=}}) for templating non-HTML/non-mustache-conflicting formats
  • A bundled command-line tool (bin/mustache) for rendering templates outside of a JS program
  • CommonJS, AMD, and native ES module builds (mustache.js / mustache.mjs) plus a minified browser build

Common Use Cases

  • Rendering HTML fragments client-side from JSON data without pulling in a full frontend framework
  • Generating server-rendered HTML, emails, or CLI output in Node.js from a shared template language
  • Sharing one template format across a polyglot stack, since Mustache implementations exist for most languages
  • Producing non-HTML text artifacts — config files, source code stubs, or plain-text reports — from a data context

Under The Hood

Architecture — The library is organized as a small pipeline in a single file (mustache.js, ~760 lines): parseTemplate tokenizes a template string with regex-driven scanning via a Scanner object, nestTokens/squashTokens fold flat tokens into a nested tree for sections, a Context class implements the scope-chain lookup used to resolve {{tag}} values (falling back to parentContext when a key is missing locally, per line 375), and a Writer class (line 481) owns template parsing/caching plus the actual render/renderTokens walk that turns the token tree and a Context into output text. The module-level mustache object is a Writer instance, so Mustache.render is really Writer.prototype.render.

Tech Stack — Plain ES5-compatible JavaScript with no runtime dependencies at all (package.json lists zero dependencies); devDependencies are limited to its own build/test tooling (mocha, chai, eslint, rollup, uglify-js, zuul for browser tests). The exports map in package.json ships both a CommonJS (mustache.js) and an ES module (mustache.mjs) build built via rollup, alongside a minified mustache.min.js for direct browser use, and a small CLI entry at bin/mustache.

Code Quality — Tests live under test/ and are run with mocha (test-unit) plus a dedicated test-lint eslint pass; notably the suite pulls in the official cross-language mustache-spec test fixtures (test/mustache-spec-test.js, test/spec/) so the implementation is validated against the same conformance suite used by other Mustache ports, in addition to hand-written unit tests for context, parsing, scanning, partials, and rendering. Functions are small, single-purpose, and consistently documented with JSDoc-style comments explaining intent (e.g. the null-safe hasProperty/primitiveHasOwnProperty helpers).

API Design — The public surface is deliberately tiny: one primary function (Mustache.render(template, view, partials, tags)) covers the common case with zero configuration required, and power users can reach Mustache.parse/Writer for caching control or override Mustache.escape/Mustache.tags globally. This keeps boilerplate minimal — a single require('mustache') and one render() call is enough to get output — at the cost of a slightly older callback-free, non-chainable API style compared to newer templating libraries.

Used by 21 apps in this directory

TypeScript
99%
Other

Activepieces

Automation · AI Assistants

23,887

Open-source AI automation platform that converts 280+ workflow integrations into MCP servers for LLMs, with no-code builders and TypeScript extensibility.

View details
92
Repo Health
85
Technical
65
Dependency
Built with
TypeScript99%
Updated today
TypeScript
88%
Other

AFFiNE

Productivity · Project Management · Note Taking

71,668

Write, draw, and plan in one infinite canvas — the open-source alternative to Notion and Miro that keeps your data yours.

View details
91
Repo Health
87
Technical
68
Dependency
Built with
TypeScript88%
Updated today
TypeScript
97%
AGPL 3.0

Bigcapital

Invoicing Finance

3,846

Self-hostable double-entry accounting platform with invoicing, inventory, multi-currency, and real-time financial reporting for small and medium businesses.

View details
91
Repo Health
77
Technical
64
Dependency
Built with
TypeScript97%
Updated yesterday
TypeScript
84%
Apache 2.0

Continue

Developer Tools · AI Development · AI Code Assistants

35,532

Open-source coding agent for VS Code, JetBrains, and CLI with support for 30+ LLM providers.

View details
87
Repo Health
88
Technical
65
Dependency
Built with
TypeScript84%
Updated today
Go
61%
Apache 2.0

Harness Open Source

Developer Tools · Devops · Code Editors

38,017

A unified open source DevOps platform combining Git hosting, CI/CD pipelines, cloud development environments, and artifact registries in a single self-hosted system.

View details
89
Repo Health
79
Technical
65
Dependency
Built with
Go61%
TypeScript34%
Updated 2 days ago
TypeScript
76%
Other

Joplin

Note Taking

56,003

The privacy-first, open-source note-taking app with end-to-end encrypted sync, AI assistance, and a powerful plugin ecosystem across every platform.

View details
93
Repo Health
87
Technical
62
Dependency
Built with
TypeScript76%
JavaScript15%
Updated yesterday
Svelte
49%

Kener

Monitoring · Devops

5,114

Stunning, self-hosted status pages with real-time uptime monitoring, incident management, and multi-channel notifications in a single Docker container.

View details
85
Repo Health
76
Technical
68
Dependency
Built with
Svelte49%
TypeScript47%
Updated 2 weeks ago
TypeScript
97%
Other

Kibana

Analytics · Monitoring

21,251

Your open source window into the Elastic Stack — query, visualize, and act on data stored in Elasticsearch with real-time dashboards, AI-assisted search, and automated alerting.

View details
98
Repo Health
87
Technical
68
Dependency
Built with
TypeScript97%
Updated today
TypeScript
69%
Apache 2.0

Laminar

AI Development · Monitoring

3,180

Open-source observability platform purpose-built for AI agents — trace, evaluate, debug, and monitor at scale with SQL access and real-time replay.

View details
85
Repo Health
76
Technical
70
Dependency
Built with
TypeScript69%
Rust29%
Updated yesterday

Join founders buildingwith open source

Opinionated takes, migration guides, cost-saving tips, and insights from the open source ecosystem.

Subscribe on Substack
Join 750+ subscribers

Search