litestar
Litestar - A production-ready, highly performant, extensible ASGI API Framework
What it is and what it does
Litestar is a production-ready ASGI framework designed specifically for building REST APIs. It provides structured tooling for common API concerns: automatic request/response validation using type hints, dependency injection for managing request-scoped and application-scoped resources, middleware support, and automatic OpenAPI 3.1 schema generation. The framework supports both function-based and class-based route handlers, integrates with SQLAlchemy for ORM use, and includes a plugin system for extending serialization and other behaviors.
The framework emphasizes strict typing—it requires type annotations on route handlers and uses them to drive validation, serialization, and documentation. It bundles msgspec for fast data parsing and supports multiple data model formats (dataclasses, TypedDict, Pydantic v1 and v2, attrs). Its 16 runtime dependencies include anyio for async compatibility, httpx for HTTP client support, and rich for CLI output. Installation is straightforward; the base package is pure Python, and an optional 'standard' extra adds uvicorn and the CLI.
Use it for:
- Build REST APIs with automatic request validation and OpenAPI documentation from Python type hints.
- Create microservices with dependency injection and middleware layering for cross-cutting concerns.
- Integrate SQLAlchemy models directly into route handlers for ORM-backed endpoints.
- Generate interactive API documentation (Swagger, Redoc, RapiDoc, Scalar, Stoplight Elements) automatically.
- Develop async-first applications using class-based controllers for organized route grouping.
Worth the install?
AI-flagged interpretation of the facts on this page — verify before relying
Litestar is an ASGI framework for building REST APIs with built-in data validation, dependency injection, ORM integration, and OpenAPI schema generation.
Yes. Litestar is actively maintained, has low install friction, carries no known vulnerabilities, and is licensed permissively under MIT. It is well-suited for developers building REST APIs who value strict typing, automatic validation, and built-in ORM support. The framework's opinionated design and rich feature set (dependency injection, middleware, OpenAPI generation) reduce boilerplate. Install it if you are building an ASGI API and want these conveniences; skip it if you prefer minimal frameworks or are not building REST APIs.
Install
litestar on PyPI
pip
pip install litestaruv
uv add litestarpoetry
poetry add litestarInstalling litestar
Before you install
Low install friction with a pure-wheel distribution. Active maintenance with recent releases; repository shows 8393 stars and current development activity.
License in practice
MIT license permits commercial and private use with minimal restrictions; suitable for most projects without licensing concerns.
Quickstart
pip install litestar
from litestar import Litestar, get
@get("/")
async def hello_world() -> dict[str, str]:
return {"hello": "world"}
app = Litestar(route_handlers=[hello_world])
Requires Python 3.8 or later; async/await syntax required for route handlers.
Verify before relying
- Performance benchmarks against other ASGI frameworks to validate 'high-performance' claims.
- Specific SQLAlchemy integration version compatibility and feature set.
- Whether all 16 runtime dependencies are required or if some are optional extras.
Package facts
| License | MIT (permissive) |
| Python support | supports the current Python release (<4.0,>=3.8) |
| Install friction | low — pure-Python wheel |
| Runtime dependencies | 16 — anyio, click, exceptiongroup, httpx, importlib-metadata, importlib-resources, litestar-htmx, msgspec, multidict, multipart, polyfactory, pyyaml, rich-click, rich, sniffio, typing-extensions |
| Maintenance | actively maintained — 64 days since the last release |
| Last repo commit | |
| First released | |
| Downloads | 2,031,207/month — #3,351 on PyPI (30-day window, as of 2026-08-14) |
| Known vulnerabilities | none known (OSV.dev, checked 2026-08-14) |
Evidence: litestar-2.24.0-py3-none-any.whl
Keywords: api, asgi, litestar, rest, starlite
Tags
More Software Development packages
Provides backported and experimental type hints…
permissive · top 100 on PyPI
numpyNumPy provides an N-dimensional array object…
permissive · top 100 on PyPI
fastapiFastAPI is a Python web framework for building…
permissive · top 100 on PyPI
annotated-docProvides a way to document function parameters,…
permissive · top 100 on PyPI
typerTyper builds command-line applications from…
permissive · top 1,000 on PyPI
distlibDistlib provides low-level packaging utilities…
permissive · top 1,000 on PyPI
advanced-alchemyAdvanced Alchemy provides sync and async…
permissive · top 15,000 on PyPI
litestar-htmxIntegrates HTMX into Litestar web applications,…
permissive · top 5,000 on PyPI
flask-openapi3Builds REST APIs on Flask with automatic…
permissive · top 15,000 on PyPI
piccolo-apiExposes Piccolo ORM tables as REST endpoints in…
permissive · top 15,000 on PyPI
APIFlaskAPIFlask is a lightweight web API framework…
permissive · top 15,000 on PyPI
quart-schemaQuart-Schema adds schema validation and…
permissive · top 15,000 on PyPI
flask-openapi3-scalarProvides Scalar UI integration for…
permissive · top 15,000 on PyPI
flask-openapi3-swaggerProvides Swagger UI integration for…
permissive · top 15,000 on PyPI