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)
main.py
import uvicorn
from litestar import Litestar
from controllers.class_controller import MyController
from controllers.router_controller import router
app = Litestar(route_handlers=[MyController, router])
if __name__ == "__main__":
uvicorn.run(app)
main.py
import uvicorn
from litestar import Litestar, post
from schema import User, UserResponseDTO
@post("/users", return_dto=UserResponseDTO)
async def create_user(data: User) -> User:
return User(name=data.name, email=data.email, password=data.password)
app = Litestar(route_handlers=[create_user], debug=True)
if __name__ == "__main__":
uvicorn.run(app)
Focused on development experience
- Modern batteries includedComprehensive 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 designThoughtful defaults and clear conventions guide you toward best practices, reducing decision fatigue and ensuring consistent, maintainable code.
- Hierarchical configurationLayered configuration system allows easy modularization. Override settings at any level - application, controller, or route - for maximum flexibility.
- Powerful plugin systemExtend 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.
- 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.
Unlock synergy, seamless integrations with Litestar
Explore Litestar seamless integrations with other tools and platforms, enhancing productivity and workflow efficiency.
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.
Sponsors
Litestar is made possible by contributors and sponsor, it will remain free and open source under the MIT License.