MCPSERV.CLUB
GO Feature Flag

GO Feature Flag

Self-Hosted

Lightweight, Open‑Source Feature Flagging for Self‑Hosted Apps

Active(100)
1.8kstars
0views
Updated 1 day ago
GO Feature Flag screenshot 1
1 / 2

Overview

Discover what makes GO Feature Flag powerful

GO Feature Flag is a lightweight, self‑hosted feature‑toggle engine written in Go. It exposes a **RESTful API** and an **OpenFeature**‑compatible SDK that can be embedded directly into any Go service or called via HTTP from other languages. At its core, the engine evaluates flag rules against a context that includes user attributes, environment variables, and custom data points. The evaluation logic is deterministic and stateless, allowing the same flag definition to be served from multiple instances behind a load balancer without coordination.

Core Engine (Go)

Storage Layer

HTTP API & Admin UI

OpenFeature SDK

Overview

GO Feature Flag is a lightweight, self‑hosted feature‑toggle engine written in Go. It exposes a RESTful API and an OpenFeature‑compatible SDK that can be embedded directly into any Go service or called via HTTP from other languages. At its core, the engine evaluates flag rules against a context that includes user attributes, environment variables, and custom data points. The evaluation logic is deterministic and stateless, allowing the same flag definition to be served from multiple instances behind a load balancer without coordination.

Architecture

The application follows a modular architecture:

  • Core Engine (Go) – Implements the flag evaluation engine, rule parsing, and persistence layer. It is a single binary that can run in any container or on bare metal.
  • Storage Layer – Supports multiple back‑ends: an in‑memory map for fast dev cycles, a local JSON/YAML file for simple deployments, and a PostgreSQL/SQLite driver for production persistence. The storage interface is pluggable via the store package, enabling custom back‑ends such as Redis or DynamoDB with minimal effort.
  • HTTP API & Admin UI – A lightweight Gin‑based REST API provides CRUD operations for flags, segments, and environments. The UI is a single‑page React app bundled with the binary; it communicates over the same API, so no separate front‑end server is required.
  • OpenFeature SDK – The go-feature-flag SDK implements the OpenFeature specification, exposing a Provider that can be dropped into any application. It supports flag evaluation, metadata introspection, and telemetry hooks.

The stack is intentionally minimal: Go 1.22+, standard library, Gin for routing, and GORM‑like abstractions only where necessary. No heavy frameworks or runtime dependencies mean the binary stays under 20 MiB and fits easily into any container registry.

Core Capabilities

  • Rule Language – Flags can target arbitrary user attributes, environment variables, or custom keys. Rules are expressed as logical expressions (AND, OR, NOT) with support for comparisons, regex matches, and numeric ranges.
  • Rollout & Gradual Delivery – Percentage‑based rollouts (10%, 5-15%) are natively supported, with optional bucketing on user IDs or custom keys to ensure consistent behavior across requests.
  • Segmentation – Define reusable segments (e.g., beta-testers, enterprise-users) and reference them in flag rules. Segments can be nested and updated via the API.
  • Metrics & Webhooks – The engine emits flag evaluation metrics to Prometheus and can trigger HTTP webhooks on configuration changes, enabling observability pipelines or CI/CD hooks.
  • Multi‑Environment – Flags can be scoped to environments (dev, staging, prod) with isolated configurations, while sharing the same storage layer.

Deployment & Infrastructure

GO Feature Flag is designed for self‑hosting with zero external dependencies. A single Docker image (ghcr.io/thomaspoignant/go-feature-flag:latest) contains the binary and static assets. Deployment patterns include:

  • Kubernetes – Deploy as a StatefulSet or DaemonSet; persistent volumes for the JSON store or external PostgreSQL service.
  • Docker Compose – Quick local setup with a bind mount for the config file and optional Postgres service.
  • Bare Metal / VMs – Run the binary directly; environment variables control port, storage path, and log level.

The application scales horizontally by sharing a common database; the stateless API layer can be replicated behind an ingress controller. For high‑throughput use cases, the in‑memory store combined with a read‑replica database can deliver sub‑millisecond evaluations.

Integration & Extensibility

  • SDKs – The Go SDK is OpenFeature‑compliant; community bindings exist for Java, Node.js, Python, and Ruby via the OpenFeature provider bridge. This allows teams to adopt the same flag semantics across polyglot stacks.
  • Plugin System – Custom data sources (e.g., LDAP, SaaS APIs) can be injected via the data-source interface. Developers can expose new context keys without modifying the core engine.
  • Webhooks & Event Bus – Flags can publish events to Kafka, NATS, or simple HTTP endpoints whenever a flag is toggled. Consumers can react in real time (e.g., clearing cache, triggering downstream jobs).
  • CLI – A command‑line tool (goflag) provides CRUD operations, dry‑run evaluations, and schema validation for CI pipelines.

Developer Experience

The project prioritizes clear documentation: the README, API spec (OpenAPI), and SDK docs are available on pkg.go.dev. A comprehensive test suite covers rule parsing, evaluation logic, and edge cases, giving confidence when extending the engine. The community is active on Slack and GitHub Discussions; contributors can submit PRs for new storage back‑ends or language bindings. Licensing under Apache 2.0 removes vendor lock‑in, making it suitable for internal tooling or open‑source projects.

Use Cases

  • Feature Rollouts – Deploy a new UI component to 5% of users, gradually increase based on telemetry.
  • Canary Releases – Enable a new API endpoint for a subset of customers while monitoring error rates.
  • A/B Testing – Serve different algorithm variants to distinct segments and collect usage metrics via the webhook integration.
  • Environment‑Specific Flags – Disable experimental features in

Open SourceReady to get started?

Join the community and start self-hosting GO Feature Flag today

Weekly Views

Loading...
Support Us

Featured Project

$30/month

Get maximum visibility with featured placement and special badges

Repository Health

Loading health data...

Information

Category
development-tools
License
MIT
Stars
1.8k
Technical Specs
Pricing
Open Source
Database
None
Supported OS
LinuxDocker
Author
thomaspoignant
thomaspoignant
Last Updated
1 day ago