{"categories":[{"label":"Internet","url":"https://skillfed.io/packages/category/internet/2"}],"enrichment":{"capability":"Middleware for Starlette that stores and accesses request context data, enabling automatic injection of request headers like x-request-id or x-correlation-id into logs and application state.","skillfed_tags":["request-context","distributed-tracing","logging-integration"],"use_cases":["Automatic request ID injection into logs so all log entries for a request share a common identifier without manual threading.","Distributed tracing: propagate correlation IDs through microservices by extracting them from incoming headers and making them available to outbound calls.","Audit logging: store user ID or tenant ID in context during request processing and access it in database operations or business logic without parameter passing.","Multi-tenant applications: extract and store tenant context from request headers to enforce isolation in downstream database queries or API calls.","Request metadata enrichment: populate context with parsed authentication tokens, feature flags, or client metadata for use across handlers."],"what_it_does":"starlette-context is middleware for the Starlette web framework that manages request-scoped context\u2014data that belongs to a single HTTP request and should be accessible throughout its lifecycle. It wraps Starlette's request handling to provide a thread-safe or async-safe context store, populated by configurable plugins that extract headers (like x-request-id or x-correlation-id) and make them available to your route handlers, logging, and other request-processing code without passing them explicitly through function parameters.\n\nThe package ships with built-in plugins for common patterns like request ID and correlation ID extraction, and you can write custom plugins to populate context with application-specific data. This is particularly useful for distributed tracing, structured logging, and audit trails where you want request identifiers to flow automatically through logs and downstream services. It integrates cleanly with Starlette's middleware stack and works with FastAPI applications built on Starlette.","worth_installing":"Yes. The package is actively maintained, has no known vulnerabilities, low install friction, and solves a real problem in web applications\u2014making request-scoped data available throughout the request lifecycle without manual parameter threading. It is well-suited for any Starlette or FastAPI application that needs structured logging, distributed tracing, or request-scoped state management."},"id":"starlette-context","links":{"html":"https://skillfed.io/packages/starlette-context","md":"https://skillfed.io/packages/starlette-context.md","pypi":"https://pypi.org/project/starlette-context/"},"maintenance":{"status":"active"},"meta":{"latest_release":"2026-02-28","license_spdx":"MIT","license_treatment":"permissive","name":"starlette-context","python_support":"supports_current","summary":"Middleware for Starlette that allows you to store and access the context data of a request. Can be used with logging so logs automatically use request headers such as x-request-id or x-correlation-id."},"popularity":{"monthly_downloads":2367211,"position":3102,"tier":"top_5000"},"security":{"n_vulnerabilities":0},"version":"0.5.1"}
