litestar-flags

Ship features with confidence. Production-ready feature flags for Litestar with percentage rollouts, A/B testing, user targeting, and time-based scheduling.

Multiple Backends

Memory, Redis, and SQLAlchemy storage backends. Choose what fits your infrastructure.

Percentage Rollouts

Gradually release features to a subset of users. Roll back instantly if issues arise.

A/B Testing

Built-in variant support for experimentation. Measure impact with confidence.

User Targeting

Target specific users, groups, or segments. Personalize experiences at scale.

Time-based Rules

Schedule launches, maintenance windows, and recurring availability patterns.

OpenFeature

Vendor-agnostic feature flagging via the OpenFeature standard.


Quick Start

app.py
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])
Type-Safe

Full type hints with msgspec validation. Catch errors before they reach production.

Zero Config

Works out of the box with sensible defaults. Customize when you need to.

Async Native

Built for async from the ground up. No blocking operations.

Lightweight

Minimal dependencies. Install only the backends you need.


Getting Started

Installation, configuration, and your first feature flag in minutes.

Getting Started
How-To Guides

Step-by-step guides for rollouts, testing, targeting, and more.

How-To Guides
API Reference

Complete documentation for all modules, classes, and functions.

API Reference