whatisgithub

What is nunjucks?

mozilla/nunjucks — explained in plain English

Analysis updated 2026-06-24

8,947JavaScriptAudience · developerComplexity · 2/5Setup · easy

In one sentence

A JavaScript templating engine from Mozilla that lets you build HTML pages with reusable layouts and variable data, inspired by Python's Jinja2. Works in Node.js and the browser.

Mindmap

mindmap
  root((nunjucks))
    What it does
      HTML templating
      Template inheritance
      Async support
    Environments
      Node.js server
      Browser client
    Key features
      Jinja2 inspired
      Layout reuse
      Variable fill-in
    Audience
      Web developers
      Node.js users
Click or tap to explore — scroll the page freely

Code map

Detail Auto

An interactive map of this repo's files and how they connect — its source is parsed live in your browser. Click Visualize to build it.

filefunction / class

What do people build with it?

USE CASE 1

Build a Node.js website where all pages share a common header and footer by using Nunjucks template inheritance.

USE CASE 2

Generate HTML emails or reports from JSON data by writing a template with placeholder syntax that Nunjucks fills in at runtime.

USE CASE 3

Add server-side rendering to an Express.js app so dynamic pages load without a front-end JavaScript framework.

What is it built with?

JavaScriptNode.js

How does it compare?

mozilla/nunjuckspoloclub/cnn-explainermarcelscruz/public-apis
Stars8,9478,9468,952
LanguageJavaScriptJavaScriptJavaScript
Setup difficultyeasyeasyeasy
Complexity2/52/51/5
Audiencedevelopergeneraldeveloper

Figures from each repo's GitHub metadata at analysis time.

How do you get it running?

Difficulty · easy Time to first run · 5min

So what is it?

Nunjucks is a templating engine for JavaScript, maintained by Mozilla. A templating engine is a tool that lets you build HTML pages (or other text files) by combining a fixed structure with variable data. Instead of writing the same HTML repeatedly with slightly different content, you write the structure once using special placeholder syntax, and the engine fills in the values at runtime. Nunjucks is inspired by Jinja2, a popular Python templating system, and brings a similar feature set to JavaScript. It supports template inheritance, which means you can define a base page layout and have other templates extend it, avoiding repeated code. It also handles asynchronous operations, which matters in JavaScript where many tasks happen in a non-blocking way. It works both on the server side (in Node.js) and in the browser. Installation is a single command via npm, the standard JavaScript package manager. The documentation is hosted separately on GitHub Pages. The README for this project is brief and points to the external documentation site for full details. This is a developer utility, not an end-user application.

Copy-paste prompts

Prompt 1
I'm building a Node.js Express app and want to use Nunjucks for HTML pages. Show me how to set Nunjucks as the view engine and create a base template that other pages extend.
Prompt 2
I have a JSON array of products and want to generate an HTML table from it using Nunjucks. Show me the template syntax for looping through the array and displaying each field.
Prompt 3
How do I use Nunjucks in the browser to render templates on the client side without a Node.js server?

Frequently asked questions

What is nunjucks?

A JavaScript templating engine from Mozilla that lets you build HTML pages with reusable layouts and variable data, inspired by Python's Jinja2. Works in Node.js and the browser.

What language is nunjucks written in?

Mainly JavaScript. The stack also includes JavaScript, Node.js.

How hard is nunjucks to set up?

Setup difficulty is rated easy, with roughly 5min to a first successful run.

Who is nunjucks for?

Mainly developer.

Open on GitHub → Ask about another repo

This repo across BitVibe Labs

Verify against the repo before relying on details.