Build a high-performance Python REST API that handles many concurrent requests without blocking.
Add WebSocket support to a Python web server for real-time features like chat or live data feeds.
Create reusable middleware components that work across any ASGI-compatible Python framework.
Use Starlette as a foundation to build a custom Python web framework or toolkit.
Requires running alongside a separate ASGI server like Uvicorn, not included as a required dependency.
Starlette is a lightweight Python library for building web servers and APIs. It runs on a modern Python interface called ASGI, which allows the framework to handle many requests at the same time without blocking, making it well-suited for services that make network calls or do other work that involves a lot of waiting. You install it with pip, write your routes and handler functions in Python, then run it with a separate server program like Uvicorn. A minimal example involves defining a route (a URL path) and an async function that returns a response, and Starlette handles the plumbing between incoming HTTP requests and those functions. Starlette can be used in two ways. As a complete framework, it provides routing, request handling, WebSocket support, background tasks, middleware for compression and cross-origin requests, session and cookie support, template rendering with Jinja2, and a built-in test client. As a toolkit, individual components can be pulled out and used on their own without adopting the full framework structure. This modular design is intentional: it makes it possible to share middleware and application components across any ASGI-compatible project. The library has very few required dependencies. Optional features like templates, form parsing, sessions, and schema generation each require one additional package, but only those that are actually needed have to be installed. Starlette is fully type-annotated and claims 100% test coverage. It serves as the foundation that FastAPI builds on top of. The project is released under the BSD license.
← kludex on gitmyhub — every repo by this author, as a profile.
Verify against the repo before relying on details.