MCPcopy
hub / github.com/openflagr/flagr

github.com/openflagr/flagr @1.2.2 sqlite

repository ↗ · DeepWiki ↗ · release 1.2.2 ↗
2,554 symbols 7,083 edges 331 files 1,640 documented · 64%
README
<a href="https://github.com/openflagr/flagr/actions/workflows/ci.yml?query=branch%3Amain+" target="_blank">
    <img src="https://github.com/openflagr/flagr/actions/workflows/ci.yml/badge.svg?branch=main">
</a>
<a href="https://goreportcard.com/report/github.com/openflagr/flagr" target="_blank">
    <img src="https://goreportcard.com/badge/github.com/openflagr/flagr">
</a>
<a href="https://godoc.org/github.com/openflagr/flagr" target="_blank">
    <img src="https://img.shields.io/badge/godoc-reference-green.svg">
</a>
<a href="https://github.com/openflagr/flagr/releases" target="_blank">
    <img src="https://img.shields.io/github/release/openflagr/flagr.svg?style=flat&color=green">
</a>
<a href="https://codecov.io/gh/openflagr/flagr">
    <img src="https://codecov.io/gh/openflagr/flagr/branch/main/graph/badge.svg?token=iwjv26grrN">
</a>
<a href="https://deepwiki.com/openflagr/flagr">
    <img src="https://deepwiki.com/badge.svg?color=green" alt="Ask DeepWiki">
</a>

What is Flagr?

Flagr is an open-source Go service for feature flags, A/B testing, and dynamic configuration. One primitive — the flag — covers all three: a decision point in your code that the evaluation engine resolves at runtime based on who is asking.

It exists to decouple deploy from release — turn a feature on for one user, a thousand, or nobody, without redeploying. Run experiments and trust the numbers. Change configuration without a code change or a restart.

openflagr/flagr is the community-driven home of Flagr, advancing development beyond the original checkr/flagr.


📖 Documentation

https://openflagr.github.io/flagr

Developers: clone the repo and run make help for build, test, and UI commands (single entrypoint for CI and local work).

Page Content
Home Quick start, dev, testing, deploy
Overview Concepts, running example, architecture
Use Cases Feature flags, A/B testing, dynamic configuration
Debug Console UI evaluation testing
Server Configuration Environment variables, DB, auth, recorders
JSON Flag Source GitOps, JSON format, validator
Notifications Webhooks on flag changes
Exposure Logging POST /exposures API
Data Recorders & A/B Analysis Kafka, Kinesis, Pub/Sub; sample consumer; A/B analytics
Datar Analytics In-process eval aggregates
API Reference Swagger/OpenAPI spec

Features

  • Feature flags — binary on/off, kill switches, targeted rollouts by audience
  • Duplicate flag — clone variants, segments, constraints, distributions, and tags to a new flag (POST /flags/{id}/duplicate or Flag Management on flag detail)
  • A/B testing — multi-variant experiments with deterministic, sticky assignment
  • Dynamic configuration — per-variant JSON attachments, no redeploy or restart
  • GitOps / Flags-as-code — load flags from JSON or HTTP; manage in Git, validate in CI, rollback with git revert
  • Exposure loggingPOST /exposures for client-reported impressions, the trustworthy A/B denominator
  • Webhook notifications — HTTP POST on every flag change, with retry and backoff
  • Multi-database — SQLite (dev), MySQL, PostgreSQL, and JSON sources
  • Vue 3 UI — TypeScript management UI (Vite, typed REST via ApiResult); see make help for build-ui / test-e2e

Quick start

docker pull ghcr.io/openflagr/flagr
docker run -it -p 18000:18000 ghcr.io/openflagr/flagr

# Open the Flagr UI
open localhost:18000

Or try the hosted demo at https://try-flagr.onrender.com (cold starts may take a moment):

curl --request POST \
     --url https://try-flagr.onrender.com/api/v1/evaluation \
     --header 'content-type: application/json' \
     --data '{
       "entityID": "127",
       "entityType": "user",
       "entityContext": { "state": "NY" },
       "flagID": 1,
       "enableDebug": true
     }'

Flagr UI

<img src="https://github.com/openflagr/flagr/raw/1.2.2/docs/images/demo_readme.png" width="900">

Architecture

Flagr has three components:

  • Evaluator — serves evaluation from an in-memory cache of all flags. The cache refreshes periodically (default 3s) and short-circuits when nothing changed, so evaluation never touches the database on the request path.
  • Manager — the CRUD gateway; all flag mutations flow through here.
  • Metrics — fans evaluation and exposure events out to your data pipeline (Kafka, Kinesis, Pub/Sub) or the built-in Datar aggregates. Recording is asynchronous, so a slow backend never stalls an evaluation.

See the architecture overview for diagrams, request flows, and the deterministic bucketing algorithm.

Performance

Tested with vegeta — 2,000 req/s sustained, sub-millisecond median latency:

Requests      [total, rate]            56521, 2000.04
Duration      [total, attack, wait]    28.26s, 28.26s, 365.53µs
Latencies     [mean, 50, 95, 99, max]  371.63µs, 327.99µs, 614.92µs, 1.39ms, 12.50ms
Success       [ratio]                  100.00%
Status Codes  [code:count]             200:56521

Client Libraries

Language Client
Go goflagr
JavaScript jsflagr
Python pyflagr
Ruby rbflagr

License and Credit

Extension points exported contracts — how you extend this code

DataRecorder (Interface)
DataRecorder can record and produce the evaluation result [5 implementers]
pkg/handler/data_recorder.go
Notifier (Interface)
(no doc) [3 implementers]
pkg/notification/notifier.go
GetDatarFlagSummaryHandlerFunc (FuncType)
GetDatarFlagSummaryHandlerFunc turns a function with the right signature into a get datar flag summary handler
swagger_gen/restapi/operations/datar/get_datar_flag_summary.go
ImportMetaEnv (Interface)
(no doc)
browser/flagr-ui/src/env.d.ts
Exposure (Interface)
Exposure handles POST /exposures. [1 implementers]
pkg/handler/exposure.go
GetDatarFlagSummaryHandler (Interface)
GetDatarFlagSummaryHandler interface for that can handle valid get datar flag summary params
swagger_gen/restapi/operations/datar/get_datar_flag_summary.go
ImportMeta (Interface)
(no doc)
browser/flagr-ui/src/env.d.ts
Eval (Interface)
Eval is the Eval interface [1 implementers]
pkg/handler/eval.go

Core symbols most depended-on inside this repo

Len
called by 118
pkg/datar/engine.go
Fatalf
called by 87
swagger_gen/restapi/server.go
WithPayload
called by 83
swagger_gen/restapi/operations/flag/put_flag_responses.go
ErrorMessage
called by 75
pkg/handler/error.go
Error
called by 57
pkg/handler/error.go
SafeUint
called by 55
pkg/util/util.go
CreateFlag
called by 41
pkg/handler/crud_flag_creation.go
NewTestDB
called by 40
pkg/entity/db.go

Shape

Method 1,294
Function 806
Struct 311
Interface 89
FuncType 38
Class 10
TypeAlias 6

Languages

Go91%
TypeScript9%

Modules by API surface

pkg/handler/crud.go66 symbols
browser/flagr-ui/src/api/crud.ts37 symbols
browser/flagr-ui/src/pages/flagPage.ts36 symbols
browser/flagr-ui/src/api/types.ts33 symbols
pkg/datar/engine_test.go28 symbols
integration_tests/integration_test.go28 symbols
pkg/handler/eval_cache_validate_test.go26 symbols
swagger_gen/restapi/operations/flagr_api.go25 symbols
pkg/handler/eval_test.go24 symbols
pkg/handler/eval_cache_normalize_ids_test.go21 symbols
swagger_gen/restapi/server.go20 symbols
pkg/handler/data_recorder_test.go20 symbols

Dependencies from manifests, versioned

cloud.google.com/gov0.123.0 · 1×
cloud.google.com/go/auth/oauth2adaptv0.2.8 · 1×
cloud.google.com/go/compute/metadatav0.9.0 · 1×
cloud.google.com/go/pubsub/v2v2.0.0 · 1×
github.com/DataDog/datadog-gov4.8.3+incompatible · 1×
github.com/DataDog/datadog-go/v5v5.2.0 · 1×
github.com/DataDog/go-tufv0.3.0--fix-localmet · 1×
github.com/DataDog/sketches-gov1.4.1 · 1×

Datastores touched

(mysql)Database · 1 repos
flagrDatabase · 1 repos

For agents

$ claude mcp add flagr \
  -- python -m otcore.mcp_server <graph>

⬇ download graph artifact