Case · Backend · Rust
flag-store: feature flags with percentage rollout
A feature flag service in Rust: per-environment flags, rules on user attributes, a percentage rollout with no randomness, an audit log and an SSE stream of changes. A user bucket is the first 8 bytes of SHA-256 over the flag and the id, modulo 10000, so the answer is stable and raising the percentage never switches anyone off. Shares are in basis points, there are no floats.
- Rust
- axum
- tokio
- SQLite
- SSE
- SHA-256
- proptest
- musl
- distroless
- Docker
- GitHub Actions
01 · How it looks
Screenshots


02 · About
What it is and why
A feature flag service in Rust: per-environment flags, rules on user attributes, a percentage rollout with no randomness, an audit log and an SSE stream of changes. A user bucket is the first 8 bytes of SHA-256 over the flag and the id, modulo 10000, so the answer is stable and raising the percentage never switches anyone off. Shares are in basis points, there are no floats.
Limitations
Reads and evaluate are open: close them at the proxy level.
SQLite with one connection under a mutex: it does not scale horizontally.
Build and tests ran in a rust:1-alpine container, cargo was not installed on the PC.
The project runs on a small VPS with demo data: no redundancy or backups.
What is inside
- A deterministic rollout: SHA-256(flag, id) modulo 10000; one user always gets one answer
- 3 property tests: stability, monotonicity in the percentage, uniformity over 20,000 users within 2 pp
- 15 tests; an 11.6 MB image, 2.7 MiB RAM idle and 3.5 MiB after 200 evaluate calls
- An SSE stream of changes with hello, change and resync; an audit log with the author and the before and after state
03 · How to run
Run it locally
git clone <repository on request> flag-store
cd flag-store
cargo run --release04 · Code
The repository is private
The source is in a private repository. Message me on Telegram and I will open access.
Request the code