A feature flag evaluation service for Go with rule-based targeting and multi-tenant support.
- Rule-Based Targeting - Evaluate flags based on user attributes, tenant, and custom conditions
- Multiple Value Types - Boolean, string, and number flag values
- Condition Operators - Equals, not equals, in, not in, exists, starts with
- Multi-Tenant - Built-in support for tenant and user context
- HTTP API - RESTful API with OpenAPI documentation via Huma
go run ./cmd/server --port 8080curl -X POST http://localhost:8080/flags \
-H "Content-Type: application/json" \
-d '{
"key": "dark-mode",
"type": "bool",
"enabled": true,
"defaultValue": {"kind": "bool", "bool": false},
"rules": [
{
"id": "beta-testers",
"conditions": [{"attr": "plan", "op": "eq", "value": "premium"}],
"value": {"kind": "bool", "bool": true}
}
]
}'curl -X POST http://localhost:8080/flags/dark-mode/evaluate \
-H "Content-Type: application/json" \
-d '{
"tenantId": "acme-corp",
"userId": "user-123",
"attrs": {"plan": "premium"}
}'| Method | Path | Description |
|---|---|---|
| POST | /flags |
Create a feature flag |
| POST | /flags/{key}/evaluate |
Evaluate a flag |
| Operator | Description |
|---|---|
eq |
Attribute equals value |
neq |
Attribute does not equal value |
in |
Attribute is in list of values |
not_in |
Attribute is not in list of values |
exists |
Attribute exists (is not nil) |
starts_with |
String attribute starts with prefix |
- Disabled Check - If flag is disabled, return default value with
disabledreason - Rule Matching - Evaluate rules in order, first match wins
- Default - If no rules match, return default value
# Run tests
go test ./...
# Run tests with coverage
go test ./... -coverprofile=coverage.out
# Run linter
golangci-lint run
# Start the server
go run ./cmd/serverMIT License - see LICENSE for details.