The Modern Python
ASGI Framework
Built to scale

Build blazing fast APIs with automatic documentation, dependency injection, and type safety. Litestar makes complex web development simple.

main.py
import uvicorn
from litestar import Litestar, get

@get("/")
async def hello() -> dict[str, str]:
    return {"message": "Hello, World!"}

app = Litestar(route_handlers=[hello])

if __name__ == "__main__":
    uvicorn.run(app)

Focused on development experience

  • Modern batteries included
    Comprehensive optional features available out-of-the-box - authentication, validation, ORM integration, caching, middleware, and more. Use what you need, when you need it.
  • Strict & opinionated design
    Thoughtful defaults and clear conventions guide you toward best practices, reducing decision fatigue and ensuring consistent, maintainable code.
  • Hierarchical configuration
    Layered configuration system allows easy modularization. Override settings at any level - application, controller, or route - for maximum flexibility.
  • Powerful plugin system
    Extend functionality seamlessly with official and community plugins. Build reusable components that integrate naturally with Litestar's architecture.

Everything you need to build modern APIs

Litestar provides all the tools you need out of the box, with minimal configuration required.
  • Data Validation And Parsing
    Leverage the power of type hints to define how data should be validated, parsed and serialized.
  • Open Ecosystem
    Define schemas and models for validation with standard types such as dataclasses, libraries like Pydantic, msgspec, attr, or integrate your own.
  • OpenAPI
    Automatically generated OpenAPI schemas help to document APIs and integrate with the frontend via TypeScript schema generation.
  • Interactive API Documentation
    Interactively explore your APIs through Swagger, Redoc or Stoplight Elements, powered by OpenAPI.
  • Middlewares
    Handle rate-limiting, CORS, CSRF, compression, logging and many more common tasks with Litestar's built-in middlewares.
  • Data Stores
    Interfaces for various key/value stores that seamlessly integrate with your application and third party extensions.
  • ORM Integration
    First-class SQLAlchemy support let's you use your models for validation and serialization directly, reducing code duplication.
  • Dependency Injection
    Powerful dependency injection on all application layers, aides in code decoupling and reduces repetition.
  • Caching
    Response caching with minimal configuration and overhead to speed up response times.
  • WebSockets
    Easy to use WebSockets integration, featuring high- and low-level APIs and support for automatic data validation and serialization.
  • Authentication And Authorization
    Session and JWT based authentication and utilities at your disposal to start building your authentication layer with ease.
  • Explore Litestar now

Extend Litestar with plugins

Litestar has a rich module ecosystem, with both official and community-driven plugins. This accelerates development by providing ready-to-use solutions for common needs.
Advanced Alchemy
Advanced Alchemy
SQLAlchemy companion
Litestar AsyncPG
Litestar AsyncPG
AsyncPG Plugin for Litestar
Litestar Granian
Litestar Granian
Granian Plugin for Litestar
Litestar HTMX
Litestar HTMX
HTMX Plugin for Litestar
Litestar MCP
Litestar MCP
MCP Plugin for Litestar
Litestar OracleDB
Litestar OracleDB
OracleDB Plugin for Litestar
Litestar SAQ
Litestar SAQ
SAQ Plugin for Litestar
Litestar Vite
Litestar Vite
Vite Plugin for Litestar
SQLSpec
SQLSpec
A query mapper for Python

Unlock synergy, seamless integrations with Litestar

Explore Litestar seamless integrations with other tools and platforms, enhancing productivity and workflow efficiency.

Scalar

Scalar integration.

RapiDoc

RapiDoc integration.

ReDoc

ReDoc integration.

Spotlight Elements

Elements integration.

Swagger UI

Swagger UI integration.

YAML

YAML integration.

Work with any Python data model

Litestar supports all popular Python data modeling libraries out of the box. Choose your favorite or mix and match based on your needs.

Pydantic

The most popular data validation library for Python.

Dataclasses

Python's built-in dataclasses with full support for serialization and validation.

Attrs

Python classes without boilerplate. Mature and battle-tested with excellent performance.

TypedDict

Type hints for dictionaries with specific key-value types and API responses.

Msgspec

Fast serialization and validation library with JSON and MessagePack support.

The developer's choice for simple and powerful APIs

Litestar was born from developers' need to boost productivity and platform performance. What began as a starlette based-solution is now a solid ASGI frameworks to build APIs that scale.
1M

Monthly downloads

7.7K

GitHub Stars

Open source

Litestar is 100% powered by our passionate open source community.

Start contributing
251

Contributors

2K

Members

Sponsors

Litestar is made possible by contributors and sponsor, it will remain free and open source under the MIT License.