Starlette Async Jinja banner
lesleslie lesleslie

Starlette Async Jinja

Development community

Description

Asynchronous Jinja2 template integration for Starlette and FastAPI

Installation

This entry records only its repository, not the path inside it, so there is no exact command to give. Open the source below and copy the folder into ~/.claude/skills/, or the file into ~/.claude/agents/.

README

starlette-async-jinja

[![Code style: crackerjack](https://img.shields.io/badge/code%20style-crackerjack-000042)](https://github.com/lesleslie/crackerjack) [![Runtime: oneiric](https://img.shields.io/badge/runtime-oneiric-6e5494)](https://github.com/lesleslie/oneiric) [![uv](https://img.shields.io/endpoint?url=https://raw.githubusercontent.com/astral-sh/uv/main/assets/badge/v0.json)](https://github.com/astral-sh/uv) [![Python: 3.13+](https://img.shields.io/badge/python-3.13%2B-green)](https://www.python.org/downloads/)

An asynchronous Jinja2 template integration for Starlette and FastAPI, built on top of the `jinja2-async-environment` package.

Quick Links

Quality & CI

Crackerjack is the standard quality-control and CI/CD gate for this repo. Keep local validation aligned with the same Ruff, typing, security, and test workflow used in CI.

Features

  • Fully async template rendering - Load templates and render them asynchronously
  • Seamless framework integration - Works with Starlette and FastAPI request/response cycles
  • Template fragments - Render specific blocks from templates
  • Template partials - Include sub-templates with their own context using render_block
  • Fast JSON responses - Enhanced JSON responses using msgspec for faster serialization
  • Context processors - Add global context to all templates
  • Performance optimizations - Context processor caching, fragment caching, and memory pooling
  • Configurable caching - Fine-tune cache sizes and TTL for optimal performance

Installation

pip install starlette-async-jinja

Template Rendering Pipeline

The following diagram shows how a request flows through the async template rendering system:

flowchart TD
    A[HTTP Request] --> B[Starlette/FastAPI Route Handler]
    B