litestar-flags¶
Ship features with confidence. Production-ready feature flags for Litestar with percentage rollouts, A/B testing, segment targeting, multi-environment support, analytics, and a complete Admin API.
Memory, Redis, and SQLAlchemy storage backends. Choose what fits your infrastructure.
Gradually release features to a subset of users. Roll back instantly if issues arise.
Built-in variant support for experimentation. Measure impact with confidence.
Define reusable user segments with complex conditions for powerful targeting rules.
Schedule launches, maintenance windows, and recurring availability patterns.
Environment inheritance, promotion workflows, and per-environment configurations.
REST endpoints for flag management with RBAC, audit logging, and pagination.
Track evaluations, collect metrics, and export to Prometheus for monitoring.
Vendor-agnostic feature flagging via the OpenFeature standard.
Quick Start¶
from litestar import Litestar, get
from litestar_flags import FeatureFlagsPlugin, FeatureFlagsConfig, FeatureFlagsClient
config = FeatureFlagsConfig()
plugin = FeatureFlagsPlugin(config=config)
@get("/")
async def index(feature_flags: FeatureFlagsClient) -> dict:
if await feature_flags.is_enabled("dark_mode"):
return {"theme": "dark"}
return {"theme": "light"}
app = Litestar(plugins=[plugin])
Full type hints with msgspec validation. Catch errors before they reach production.
Works out of the box with sensible defaults. Customize when you need to.
Built for async from the ground up. No blocking operations.
Minimal dependencies. Install only the backends you need.
Installation, configuration, and your first feature flag in minutes.
Step-by-step guides for rollouts, testing, targeting, and more.
Complete documentation for all modules, classes, and functions.