How kludex/starlette works
Project type and purpose
• Starlette is a lightweight, modular ASGI framework/toolkit for building async web services in Python. It provides core HTTP routing, middleware, WebSocket support, background tasks, templating, static-file serving, and a built-in test client.
File structure
• Top-level directories:
• starlette/ contains the production library code, organized by component (applications, routing, requests, responses, middleware, websockets, etc.).
• tests/ contains comprehensive unit tests for each component.
• docs/ and mkdocs.yml define the project documentation.
• .github/ and scripts/ hold CI/CD workflows, release scripts, linting and test commands.
• pyproject.toml and requirements.txt list core and optional dependencies.
• Key patterns:
• Chain-of-responsibility pattern for middleware (in starlette/middleware/*).
• Central application/router in starlette/applications.py orchestrating request flow.
• Separation between the ASGI server interface (user’s Uvicorn/Daphne) and the Starlette app.
README for additional insights
• Confirms the ASGI entrypoint, optional dependencies, and pluggable components.
• Highlights modularity: every component (responses, forms, staticfiles, sessions) can be used standalone.