RepositoryRustATAustria
MI

mitsuhiko/minijinja

MiniJinja is a powerful but minimal dependency template engine for Rust compatible with Jinja/Jinja2

2.8kstars
205forks
10issues
1views

Featured achievements

The project's latest awards

2
TINIX TRENDING·Topic: jinja2

#2 Repository of the week

2
TINIX TRENDING·Topic: jinja

#2 Repository of the week

3
TINIX TRENDING·Topic: templates

#3 Repository of the week

MiniJinja: a powerful template engine with minimal dependencies

License Crates.io rustc 1.63.0 Documentation

MiniJinja is a powerful but minimal dependency template engine which is based on the syntax and behavior of the Jinja2 template engine for Python.

It's implemented in Rust and Go and is also available via WASM for JavaScript and as a Python extension module and as a command line utility.

It's supports all serde types and only has it as a single required dependency. It supports a range of features from Jinja2 including inheritance, filters and more. The goal is that it should be possible to use some templates in Rust programs without the fear of pulling in complex dependencies for a small problem. Additionally it tries not to re-invent something but stay in line with prior art to leverage an already existing ecosystem of editor integrations.

$ cargo tree
minimal v0.1.0 (examples/minimal)
└── minijinja v2.21.0 (minijinja)
    └── serde v1.0.144

Additionally minijinja is also available as an (optionally pre-compiled) command line executable called minijinja-cli:

$ curl -sSfL https://github.com/mitsuhiko/minijinja/releases/latest/download/minijinja-cli-installer.sh | sh
$ echo "Hello {{ name }}" | minijinja-cli - -Dname=World
Hello World

You can play with MiniJinja online in the browser playground powered by a WASM build of MiniJinja.

Goals:

Example

Example Template:

{% extends "layout.html" %}
{% block body %}
  <p>Hello {{ name }}!</p>
{% endblock %}

Invoking from Rust:

use minijinja::{Environment, context};

fn main() {
    let mut env = Environment::new();
    env.add_template("hello.txt", "Hello {{ name }}!").unwrap();
    let template = env.get_template("hello.txt").unwrap();
    println!("{}", template.render(context! { name => "World" }).unwrap());
}

Getting Help

If you are stuck with MiniJinja, have suggestions or need help, you can use the GitHub Discussions.

Use Cases and Users

Here are some interesting Open Source users and use cases of MiniJinja. The examples link directly to where the engine is used so you can see how it's utilized:

Similar Projects

These are related template engines for Rust:

  • Askama: Jinja inspired, type-safe, requires template precompilation. Has significant divergence from Jinja syntax in parts.
  • Tera: Jinja inspired, dynamic, has divergences from Jinja.
  • Liquid: an implementation of Liquid templates for Rust. Liquid was inspired by Django from which Jinja took its inspiration.
  • TinyTemplate: minimal footprint template engine with syntax that takes lose inspiration from Jinja and handlebars.

If you like the project and find it useful you can become a sponsor.

AI Use Disclaimer

This codebase mostly predates LLM based code generation but some recent features have been built with support of AI. For the AI contribution rules see AI Disclosure Rules.

Similar Projects

Discover other similar projects and AI models.

RepositoryPython
pallets/jinja

A very fast and expressive template engine.

11.8k
Jun 14, 2025
RepositoryC++
jinja2cpp/Jinja2Cpp

Jinja2 C++ (and for C++) almost full-conformance template engine implementation

602
Nov 30, 2026
RepositoryRust
uros-5/jinja-lsp

Language Server for jinja

177
Jul 4, 2026
RepositoryEmacs Lisp
fxbois/web-mode

web template editing mode for emacs

1.7k
Aug 31, 2026
RepositoryGo
noirbizarre/gonja

Jinja-like syntax template-engine for Go

153
Sep 27, 2023
RepositoryCrystal
straight-shoota/crinja

Implementation of Jinja2 template language in Crystal

149
Jul 21, 2026
RepositoryJinja
Petro31/easy-time-jinja

Easy Time calculations for Home Assistant templates

136
Dec 12, 2025
RepositoryPython
adamchainz/heroicons

Use heroicons in your Django and Jinja templates.

119
Nov 4, 2026
Modelsentence-similarity
sentence-transformers/all-MiniLM-L6-v2

all-MiniLM-L6-v2 This is a sentence-transformers(https://www.SBERT.net) model: It maps sentences & paragraphs to a 384 dimensional dense vector space and can be used for tasks like clustering or semantic search. Usage (Sentence-Transformers) Using t...

♥0
157.6M
Jun 1, 2026