Skip to content

binja

The fastest Jinja2/Django template engine for Bun. 2-4x faster than Nunjucks, 160x faster with AOT compilation.

Why binja?

2-4x Faster Runtime

Pure TypeScript implementation optimized for Bun. Consistently outperforms Nunjucks in every benchmark.

160x Faster AOT

Pre-compile templates to JavaScript functions for maximum production performance.

Multi-Engine Support

Jinja2, Handlebars, Liquid, and Twig - all through a unified API with shared filters.

84 Built-in Filters

Complete Jinja2 + Django filter set. String, number, date, list, URL, and more.

Quick Install

Terminal window
bun add binja

Quick Example

import { render } from 'binja'
// Simple and fast for development
const html = await render('Hello, {{ name|upper }}!', { name: 'world' })
// Output: Hello, WORLD!

Performance

BenchmarkbinjaNunjucksSpeedup
Simple Template371K ops/s96K ops/s3.9x
Complex Template44K ops/s23K ops/s2.0x
HTML Escaping985K ops/s242K ops/s4.1x
AOT vs Nunjucks14.3M ops/s96K ops/s160x

Framework Adapters

import { Hono } from 'hono'
import { binja } from 'binja/hono'
const app = new Hono()
app.use(binja({ root: './views' }))
app.get('/', (c) => c.render('index', { title: 'Home' }))
export default app

Feature Comparison

FeaturebinjaNunjucksPug
Jinja2 Compatible✅ Full⚠️ Partial❌ No
Django DTL Compatible✅ Full❌ No❌ No
Multi-Engine✅ Yes❌ No❌ No
AOT Compilation✅ Yes❌ No✅ Yes
Framework Adapters✅ Hono, ElysiaExpressExpress
Built-in Filters844030
Debug Panel✅ Yes❌ No❌ No
AI Linting✅ Yes❌ No❌ No

Ready to get started?