skillfed

litestar

Litestar - A production-ready, highly performant, extensible ASGI API Framework

litestar v2.24.0 2.0M downloads/30d#3,351 on PyPI8,393
Permissive license MIT Active released

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 litestar

uv

uv add litestar

poetry

poetry add litestar

Installing 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

Development Status :: 5 - Production/StableEnvironment :: Web EnvironmentIntended Audience :: DevelopersIntended Audience :: Information TechnologyIntended Audience :: System AdministratorsLicense :: OSI Approved :: MIT LicenseNatural Language :: EnglishOperating System :: OS IndependentProgramming Language :: PythonProgramming Language :: Python :: 3.10Programming Language :: Python :: 3.11Programming Language :: Python :: 3.12Programming Language :: Python :: 3.13Programming Language :: Python :: 3.14Programming Language :: Python :: 3.8Programming Language :: Python :: 3.9Topic :: InternetTopic :: Internet :: WWW/HTTPTopic :: Internet :: WWW/HTTP :: HTTP ServersTopic :: Software DevelopmentTopic :: Software Development :: LibrariesTopic :: Software Development :: Libraries :: Application FrameworksTopic :: Software Development :: Libraries :: Python ModulesTyping :: Typed

Tags

asgi api frameworkrest api pythonasync web frameworkdata validation frameworkdependency injection asgiopenapi schema generationorm integration framework
rest-apiasync-frameworkopenapi

More Software Development packages