kludex/starlette

The little ASGI framework that shines. 🌟

12,158 stars Python 12 components 8 connections

Lightweight ASGI web framework for building async Python web services

HTTP requests flow through middleware stack, get routed to endpoints, and responses flow back through middleware

Under the hood, the system uses 1 feedback loop, 2 data pools, 2 control points to manage its runtime behavior.

Structural Verdict

A 12-component repository with 8 connections. 68 files analyzed. Loosely coupled — components are relatively independent.

How Data Flows Through the System

HTTP requests flow through middleware stack, get routed to endpoints, and responses flow back through middleware

  1. ASGI Receive — Incoming HTTP/WebSocket connection received from ASGI server
  2. Middleware Processing — Request passes through middleware stack (errors, auth, CORS)
  3. Route Matching — Router matches URL path to endpoint using path patterns and convertors
  4. Endpoint Execution — Function or class-based endpoint processes request and returns response
  5. Background Tasks — Optional async tasks scheduled to run after response is sent
  6. Response Middleware — Response flows back through middleware stack in reverse order
  7. ASGI Send — Final response sent to client via ASGI server

System Behavior

How the system actually operates at runtime — where data accumulates, what loops, what waits, and what controls what.

Data Pools

Request State (state-store)
Per-request state dictionary for sharing data between middleware and endpoints
Application State (state-store)
Global application state shared across all requests

Feedback Loops

Delays & Async Processing

Control Points

Technology Stack

anyio (library)
Async I/O abstraction supporting asyncio and trio backends
python-multipart (library)
Form data and file upload parsing
jinja2 (library)
Optional template rendering support
httpx (library)
HTTP client for TestClient implementation
pytest (testing)
Test framework
mypy (testing)
Static type checking
ruff (build)
Python linting and formatting
hatchling (build)
Modern Python packaging backend

Key Components

Configuration

starlette/formparsers.py (python-dataclass)

tests/test_responses.py (python-dataclass)

Explore the interactive analysis

See the full architecture map, data flow, and code patterns visualization.

Analyze on CodeSea

Related Repository Repositories

Frequently Asked Questions

What is starlette used for?

Lightweight ASGI web framework for building async Python web services kludex/starlette is a 12-component repository written in Python. Loosely coupled — components are relatively independent. The codebase contains 68 files.

How is starlette architected?

starlette is organized into 5 architecture layers: ASGI Interface, Middleware Stack, Routing Engine, Request/Response, and 1 more. Loosely coupled — components are relatively independent. This layered structure keeps concerns separated and modules independent.

How does data flow through starlette?

Data moves through 7 stages: ASGI Receive → Middleware Processing → Route Matching → Endpoint Execution → Background Tasks → .... HTTP requests flow through middleware stack, get routed to endpoints, and responses flow back through middleware This pipeline design reflects a complex multi-stage processing system.

What technologies does starlette use?

The core stack includes anyio (Async I/O abstraction supporting asyncio and trio backends), python-multipart (Form data and file upload parsing), jinja2 (Optional template rendering support), httpx (HTTP client for TestClient implementation), pytest (Test framework), mypy (Static type checking), and 2 more. A focused set of dependencies that keeps the build manageable.

What system dynamics does starlette have?

starlette exhibits 2 data pools (Request State, Application State), 1 feedback loop, 2 control points, 2 delays. The feedback loops handle retry. These runtime behaviors shape how the system responds to load, failures, and configuration changes.

What design patterns does starlette use?

5 design patterns detected: ASGI Protocol, Middleware Stack, Dependency Injection, Exception Handler Registry, Async Context Managers.

Analyzed on March 31, 2026 by CodeSea. Written by .