https://github.com/jacobcoffee/litestar-flags
Questionably-ready feature flags for Litestar
https://github.com/jacobcoffee/litestar-flags
feature-flags litestar litestar-framework litestar-plugin
Last synced: 2 months ago
JSON representation
Questionably-ready feature flags for Litestar
- Host: GitHub
- URL: https://github.com/jacobcoffee/litestar-flags
- Owner: JacobCoffee
- Created: 2025-12-28T20:50:30.000Z (5 months ago)
- Default Branch: main
- Last Pushed: 2026-03-29T00:34:33.000Z (2 months ago)
- Last Synced: 2026-03-29T03:13:30.437Z (2 months ago)
- Topics: feature-flags, litestar, litestar-framework, litestar-plugin
- Language: Python
- Homepage: http://flags.litestar.scriptr.dev/
- Size: 9.48 MB
- Stars: 3
- Watchers: 0
- Forks: 0
- Open Issues: 2
-
Metadata Files:
- Readme: README.md
- Security: SECURITY.md
Awesome Lists containing this project
README
# litestar-flags
Production-ready feature flags for [Litestar](https://litestar.dev) applications.
[](https://badge.fury.io/py/litestar-flags)
[](https://pypi.org/project/litestar-flags/)
[](https://opensource.org/licenses/MIT)
## Installation
```bash
uv add litestar-flags
# With extras
uv add litestar-flags[redis] # Redis backend
uv add litestar-flags[database] # SQLAlchemy backend
uv add litestar-flags[workflows] # Approval workflows
uv add litestar-flags[openfeature] # OpenFeature SDK provider
uv add litestar-flags[prometheus] # Prometheus metrics
uv add litestar-flags[observability] # OpenTelemetry + structlog
uv add litestar-flags[all] # Everything
```
## Quick Start
```python
from litestar import Litestar, get
from litestar_flags import FeatureFlagsPlugin, FeatureFlagsConfig, FeatureFlagClient
config = FeatureFlagsConfig()
plugin = FeatureFlagsPlugin(config=config)
@get("/")
async def index(feature_flags: FeatureFlagClient) -> dict:
if await feature_flags.is_enabled("new_checkout"):
return {"flow": "new"}
return {"flow": "legacy"}
app = Litestar(plugins=[plugin])
```
## Features
- **Multiple backends** - Memory, Redis, and SQLAlchemy storage
- **Percentage rollouts** - Gradual releases with consistent hashing
- **User targeting** - Rules based on user attributes
- **Segment-based targeting** - Reusable user groups for complex targeting
- **A/B testing** - Weighted variants for experiments
- **Time-based rules** - Scheduled launches and maintenance windows
- **Multi-environment** - Environment inheritance, promotion, and per-env configs
- **Admin API** - REST endpoints for flag management with RBAC and audit logging
- **Analytics** - Evaluation tracking, metrics, and Prometheus export
- **OpenFeature support** - Vendor-agnostic evaluation via OpenFeature SDK
- **Approval workflows** - Human-in-the-loop governance for enterprise use
## Documentation
Full docs at [flags.litestar.scriptr.dev](https://flags.litestar.scriptr.dev).
## Development
```bash
git clone https://github.com/JacobCoffee/litestar-flags.git
cd litestar-flags
uv sync --all-extras
uv run pytest
```
## License
MIT