Starlette
Starlette is an ASGI (Asynchronous Server Gateway Interface) framework and toolkit for building high-performance async web services and applications in Python (web framework).
- ASGI-based toolkit for building async web applications and services (web framework).
- Support for Hypertext Transfer Protocol (HTTP), WebSocket, and Server-Sent Events endpoints (application networking).
- Routing, middleware, requests/responses, and background task abstractions (application framework).
- Support for sessions, authentication helpers, CORS, and static file handling (web application services).
- Integration-oriented design for use as a foundation in other web frameworks and libraries (developer platform).
More About Starlette
Starlette is an ASGI (Asynchronous Server Gateway Interface) framework and toolkit (web framework) designed for building async web applications, APIs, and microservices in Python. It operates directly on the ASGI specification (application networking), which defines a standard interface between async Python applications and web servers, and provides a set of abstractions to simplify request handling, routing, and background execution. Starlette focuses on a minimal but complete core, making it usable both as a standalone framework and as an underlying component for other Python web frameworks.
At its core, Starlette provides a routing system (web framework) that maps HTTP paths and methods to endpoint callables, with support for path parameters and mounted sub-applications. It implements request and response objects (web framework), including form parsing, JSON handling, file uploads, and cookie management. The framework includes middleware support (application framework), allowing concerns such as authentication, CORS handling, session management, and GZip compression to be implemented as composable layers around the application. Background tasks (application framework) are provided to execute operations after the response is sent, such as logging or asynchronous notifications.
Starlette supports multiple communication protocols over ASGI (application networking), including HTTP, WebSocket, and Server-Sent Events. WebSocket endpoints (real-time communication) can be defined using connection lifecycle events and message send/receive operations, which is relevant for chat services, dashboards, and other bidirectional communication scenarios. Server-Sent Events (event streaming) are supported for unidirectional streaming from server to client. Static files and templating support (web application services) are available, enabling delivery of frontend assets and server-side rendered views when required.
In enterprise and institutional environments, Starlette is used to build Application Programming Interface (API) backends, microservices, and async web services (application integration). Its ASGI-first model enables deployment behind ASGI servers such as Uvicorn or Hypercorn (application networking), and it interoperates with other ASGI-compatible components like authentication providers, monitoring tools, and middleware libraries. The frameworkâs modular design (developer platform) allows teams to extend or replace components, plug in custom middleware, and mount other ASGI applications or third-party tools within a Starlette application tree.
From a technical taxonomy perspective, Starlette fits into Python async web frameworks (web framework), API and microservice backends (application integration), and real-time communication infrastructure through WebSocket and Security Services Edge (SSE) support (real-time communication). Its adherence to the ASGI specification (standard interface) enables compatibility across servers, frameworks, and tooling that implement the same protocol, which supports reuse of infrastructure components, simplifies deployment choices, and provides a consistent model for asynchronous I/O in Python-based web stacks.