Build the flag relay you need, from components — with flagd as the reference implementation.
Important
This is an independent proof of concept, incubated by a flagd maintainer. It is not an official OpenFeature or CNCF project, and nothing here is endorsed by the OpenFeature Technical Committee. If the idea holds up, the pieces are shaped so they can be proposed to open-feature/flagd later. Until then there are no releases and no images; build from source.
A flag relay is a process that syncs flag configurations from somewhere, keeps them, evaluates them and serves them to OpenFeature clients — over OFREP, flagd's flag evaluation API, flag sync for in-process providers, or something else. flagd is one. So are a vendor's edge proxy and relay proxy.
OpenFeature Relay is a runtime and a builder for flag relays, in the way the OpenTelemetry Collector Builder is for collectors:
- you list the components you want in a manifest,
- the builder generates and compiles a distribution that contains exactly those components,
- anyone can write a component in their own Go module and build it in, without forking.
flagd is the reference implementation, and the code starts from flagd's (this repository carries flagd's full history). Today's flagd becomes the flagd-full distribution: same CLI, configuration, ports, endpoints and behaviour.
flagd today ships as one binary with every sync provider (file, HTTP, gRPC, Kubernetes, GCS, Azure Blob, S3), every service endpoint and the full OpenTelemetry SDK.
- Its
coremodule pulls in roughly 700 transitive dependencies, whatever you actually use. - Adding a sync provider or an endpoint means changing flagd itself.
- In-process providers embed flagd's evaluator and, until recently, got its tracing spans whether they wanted them or not.
- A vendor that wants OFREP, flag sync, event streams and telemetry for its own flag engine has to build all of it again.
OpenFeature Relay keeps the parts that every relay needs — polling, the store, change events, OFREP with its event stream, flag sync, telemetry, event delivery — shared, and makes everything else a selectable component.
flowchart LR
src[(Source)] --> sp[Sync provider]
sp --> cf[Configuration format]
cf --> st[(Store)]
st --> ev[Evaluator]
ev --> se[Service endpoint<br/>OFREP · flag evaluation]
st --> fs[Service endpoint<br/>flag sync]
cf -. configuration change .-> bus{{Event bus}}
se -. evaluation .-> bus
bus --> sink[Event sink]
| Component type | What it does | flagd-full ships |
|---|---|---|
| Sync provider | Reads flag configurations from a kind of source | file, HTTP, gRPC, Kubernetes, GCS, Azure Blob, S3 |
| Configuration format | Validates flag configurations of one format and keeps them in the store as documents | flagd's JSON schema |
| Evaluator | Resolves flags for an evaluation context from its paired format's documents; emits no telemetry | flagd's JsonLogic evaluator |
| Service endpoint | Serves flags to clients over a protocol | flag evaluation (gRPC/Connect), OFREP, flag sync, event collector (off until configured) |
| Middleware | Wraps an endpoint's HTTP handler (auth, CORS, rate limits) | none; configured in flagd's configuration file |
| Telemetry provider | Tracing and metrics for endpoints and middleware | OpenTelemetry |
| Event sink | Delivers configuration change, evaluation and tracking events elsewhere | webhook (off until configured) |
A configuration format and its evaluator can ship together as an engine module — that is how vendors ship their engines. Each format keeps its own documents in the store, so flagd's flag model stays unchanged while a vendor's stays the vendor's. All terms are defined in the glossary.
| Distribution | Contents | Purpose |
|---|---|---|
| flagd-full | every component maintained in this repository | today's flagd, unchanged |
| flagd-sync | sync providers, flagd's format, flag sync — no evaluator | a configuration proxy: in-process providers get validated flag configurations from one place |
| flagd-minimal, flagd-minimal-otel, flagd-cloud, flagd-kubernetes | subsets | smaller binaries without the SDKs you don't use |
| vendor distribution | a vendor's sync provider and engine behind OFREP | e.g. the Flagsmith engine or GO Feature Flag's, serving OpenFeature clients in place of the vendor's edge proxy |
| your own | whatever your manifest lists | custom sources, endpoints, sinks |
Proof of concept. The specification is complete enough to build against, and the code follows it: the component types, the runtime, the builder (relay-builder) and the standard distributions are on main, and flagd-full is built by the builder from its manifest.
| Done | Steps 1 to 11 of the plan, and most of step 12: the component factories and contract tests, the builder and manifest, flagd-full and the standard distributions, event export, a Flagsmith distribution behind OFREP, the reference image and the CI checks. |
| In progress | The release of the distributions and component modules (UC-012), and the flagd testbed as a distribution. |
| Deferred | Recovering from a snapshot (UC-016). Provider migration (formerly UC-015) is a follow-up after the proof of concept, #156. |
The full order and what each check verifies are in Status and roadmap; each use case's Status line in docs/use_cases/ says where it stands.
You need Go (the version in flagd/go.mod), make and curl.
git clone https://github.com/open-feature-forking/openfeature-relay.git
cd openfeature-relay
git submodule update --init
make workspace-init
make build-flagd
./bin/flagd start --uri file:./config/samples/example_flags.flagd.jsonEvaluate a flag over flagd's evaluation API (port 8013):
curl -X POST "http://localhost:8013/flagd.evaluation.v1.Service/ResolveBoolean" \
-H "Content-Type: application/json" -d '{"flagKey":"myBoolFlag","context":{}}'…or over OFREP (port 8016):
curl -X POST "http://localhost:8016/ofrep/v1/evaluate/flags/myBoolFlag" \
-H "Content-Type: application/json" -d '{"context":{}}'Run the tests with make test.
On Windows, use WSL for Go and Docker.
Everything flagd does, flagd-full does. flagd's documentation lives in docs/ in this repository and, for released flagd, at flagd.dev. flagd itself is developed at open-feature/flagd by its contributors; this repository merges upstream regularly. For production use, use released flagd, not this repository.
The specification is the contract, written with the AI Unified Process: vision, requirements, glossary, use cases and research.
The code is written by AI agents in a fixed loop, with a human approving each plan and able to stop any pull request:
| Role | Does |
|---|---|
| planner | turns a use case into steps, characterization tests and gates |
| opposer | attacks the plan before code is written |
| implementer / mechanic | implements the approved steps, with the gate output |
| reviewer | re-runs the gates and reviews the pull request |
Agent definitions are in .claude/agents/, plans and their reviews in .claude/plans/, the working agreement in CLAUDE.md. Every slice lands as a pull request in this repository, and flagd's own gates — unit tests, lint, benchmarks, the test-harness acceptance suites — have to stay green.
Ideas, questions and criticism of the approach are the most useful contribution right now: open an issue. For code, read CONTRIBUTING.md; commits need a DCO sign-off.
Apache License 2.0, as flagd.