https://github.com/tommed/ducto-featureflags
A lightweight, embeddable, and pluggable feature flag engine for Go. Reusable anywhere.
https://github.com/tommed/ducto-featureflags
configuration declarative ducto event-processing feature-flags flag-engine go golang-library json launchdarkly-alternative microservices open-source pipeline-automation sdk serverless
Last synced: 23 days ago
JSON representation
A lightweight, embeddable, and pluggable feature flag engine for Go. Reusable anywhere.
- Host: GitHub
- URL: https://github.com/tommed/ducto-featureflags
- Owner: tommed
- License: mit
- Created: 2025-04-07T13:31:52.000Z (about 1 year ago)
- Default Branch: main
- Last Pushed: 2025-04-16T14:44:16.000Z (about 1 year ago)
- Last Synced: 2025-06-02T17:16:24.048Z (12 months ago)
- Topics: configuration, declarative, ducto, event-processing, feature-flags, flag-engine, go, golang-library, json, launchdarkly-alternative, microservices, open-source, pipeline-automation, sdk, serverless
- Language: Go
- Homepage:
- Size: 55.5 MB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- Contributing: CONTRIBUTING.md
- License: LICENSE
- Code of conduct: CODE_OF_CONDUCT.md
Awesome Lists containing this project
README
# Ducto Feature Flags
[](https://github.com/tommed/ducto-featureflags/actions/workflows/ci.yml)
[](https://codecov.io/gh/tommed/ducto-featureflags)
> Lightweight, embeddable, and pluggable **[OpenFeature](https://openfeature.dev/) compatible** feature flag engine for
> Go. Designed for pipelines, microservices, and event-driven systems.
---
## ✨ What is Ducto Feature Flags?
`ducto-featureflags` is a minimalist feature flag manager built in Go. It was designed as a reusable component for:
- Data transformation pipelines (like [Ducto](https://github.com/tommed))
- Serverless functions
- Microservices and APIs
- CLI tools and test harnesses
It supports both static file-based flags and dynamic backends, and can be used as:
- A **Go SDK** (directly, or as an [OpenFeature Provider](https://github.com/open-feature/go-sdk))
- A **CLI for testing**
- A **preprocessor plugin** in the [ducto-orchestrator](https://github.com/tommed/ducto-orchestrator)
Please note that whilst Ducto Feature Flags is compatible with OpenFeature,
it is **not** compliant with [flagd](https://flagd.dev/) because we support nested conditional
statements, which _cannot_ be reduced to flagd's simpler conditional system.
Once flagd can support nested conditionals like 'and' and 'or', we will provide support.
---
## ✅ Features
- 🔍 Evaluate flags at runtime
- 🧩 Simple JSON/YAML flag format
- ♻️ Optional hot-reloading (fsnotify)
- 🤝 OpenFeature compatible
- 🌐 Future: HTTP / Redis / Consul backends
- 🔓 MIT licensed and reusable in other OSS projects
[View the Specifications here](./docs/specs.md).
---
## 🔧 Example Flag File
The simplest possible flag file is static like so:
```json
{
"ui": {
"variants": {
"beta": true,
"stable": false
},
"defaultVariant": "stable"
}
}
```
To make this more dynamic, you can add rules based on an `EvalContext`:
```json
{
"new_ui": {
"variants": {
"beta": true,
"stable": false
},
"defaultVariant": "stable",
"rules": [
{ "if": { "env": "prod", "group": "beta" }, "variant": "beta" },
{ "if": { "env": "prod" }, "variant": "stable" }
]
}
}
```
You can also make use of YAML files, like this [example here](./examples/04-with_rules.yaml).
---
## 🧑💻 Usage (SDK)
```golang
store, err := featureflags.NewStoreFromFile("flags.json")
// assert no error
if store.IsEnabled("new_ui", featureflags.EvalContext{}) {
// Enable experimental flow
}
```
---
## 📦 Use as an OpenFeature Provider
```bash
go get -u github.com/tommed/ducto-featureflags
```
[Check our OpenFeature example here](./openfeature/example_provider_test.go)
---
## 📦 Install CLI
```bash
go install github.com/tommed/ducto-featureflags/cmd/ducto-flags@latest
```
### CLI Usage
```bash
# Check if a single flag is enabled
ducto-flags -file flags.json -key new_ui -ctx env=prod -ctx region=EU
# Print all flags
ducto-flags -file flags.json -list
# Host a flags server (optional auth token)
ducto-flags serve -file flags.json [-token secret-123]
```
---
## 🛠️ Planned Backends
- [x] JSON file
- [x] YAML file
- [x] HTTP endpoint
- [x] OpenFeature compatibility
- [x] OpenFeature provider
- [ ] Redis
- [ ] Google Firestore
- [ ] Env var overrides
- [ ] Versioned flag API with auditing
---
## 🤖 Part of the Ducto Ecosystem
- [ducto-dsl](https://github.com/tommed/ducto-dsl) – declarative data transformation engine
- [ducto-orchestrator](https://github.com/tommed/ducto-orchestrator) – pluggable streaming runtime
- `ducto-featureflags` – this repo
---
## 🧰 License
- Code licensed under [MIT](./LICENSE)
- Logos and illustrations (and their likeness) are (c) Copyright 2025 Tom Medhurst, all rights reserved.