How featurehub-io/featurehub works
Project type and purpose
• This repo implements FeatureHub, a Cloud-Native, open-source feature-flagging and experimentation platform.
• It’s a full-stack, microservices-based system:
• Frontends (admin console GUI and CLI) for users
• A set of backend services (Management Repository, cache service “Dacha,” streaming “Edge” service, event processors, messaging, security)
• Persistent storage (relational DB via Ebean/SQL modules) and event bus (NATS/Google PubSub/Kinesis adapters)
• SDKs and end-to-end test layers
File structure
• Top-level directories:
• adks – Admin SDK examples & E2E SDK for testing
• admin-frontend – Dart/Flutter web admin console + CLI layer + code-gen layers
• backend – dozens of maven sub-modules:
– common-db, common-web (shared frameworks)
– mr-api, mr (Management Repository REST service & API definitions)
– dacha, dacha2 (cache service listening to events and exposing cache API)
– edge-*, edge-full, edge-rest (services exposing feature-state to client SDKs via REST/SSE)
– eventing-* (cloud-events, pubsub, kinesis, nats adapters)
– messaging-delivery, webhook-common, security-oauth, security-saml (auxiliary microservices)
– mr-db-* (DB API, Ebean migrations, SQL implementations, services)
– mr-eventing-* (glue between MR and event bus)
– party-server (lightweight in-memory server for demos)
• infra – Pulumi bucket API hosting, S3 metadata
• pipeline – CI/CD definitions (Cloudbuild, Dockerfiles, Helm charts under pipeline/deploy)
• e2e – end-to-end test harness in Dart
• docs – Antora-driven documentation site
• Configuration & build files: global pom.xml, many module-level pom.xml, Dockerfiles, shell scripts
Architecture insights from README
• Core services:
a. Management Repository (“mr”) – the source-of-truth, REST API for feature metadata, user & environment management
b. Dacha – event-driven cache service maintaining feature state snapshots
c. Edge – streaming/REST service serving SDK clients in real time via SSE or HTTP
• Event-driven: MR publishes change events to an event bus; Dacha, Edge, “mr-eventing” consume and process them.
• Supports multiple pub/sub backends (NATS, Google PubSub, Kinesis, CloudEvents).
• DB layers: API definitions (mr-db-api), SQL implementations (mr-db-sql), migrations (mr-db-ebean), services (mr-db-services).
How to model this
• Frontend layer:
• Admin Console (Flutter web)
• CLI (Dart/featurehub-cli)
• Admin SDKs (adks/e2e-sdk)
• API layer:
• MR-API (OpenAPI) – code-gen module under backend/mr-api
• Backend services:
• Management Repository service (“mr”)
• Dacha cache service
• Edge streaming/REST service
• Event processors (mr-eventing, eventing-*, webhook-feature-update, messaging-delivery)
• Security adapters (security-oauth, security-saml)
• Data stores & bus:
• Relational Database (Ebean via mr-db-ebean)
• Pub/Sub/Event Bus (NATS, PubSub, Kinesis)
• Clients & SDKs:
• Edge SDKs (JavaScript, Android, iOS, .NET, etc.)
• Custom apps using EdgeFeatureHubConfig
• Infrastructure & CI/CD:
• Pulumi S3 API bucket (infra/api-bucket)
• Docker/K8s Helm (pipeline/deploy)
• CI pipelines (pipeline/app-build-pipeline, .github/workflows)
b. Relationships & data flows:
1. Admin Console or CLI → MR service (HTTP REST) → DB
2. MR service → publishes change events to Event Bus
3. Dacha & mr-eventing consume Event Bus → update in-memory feature snapshots
4. Edge service consumes Dacha snapshots & Event Bus → serves feature states to SDK clients via SSE/REST
5. SDK clients ←→ Edge service (continuous streaming)
6. Event processors & webhooks → subscribe to change events for analytics or external notifications
7. Security services integrate MR & Frontend with OAuth/SAML providers
8. CI/CD pipelines & Pulumi deploy services into Kubernetes or Docker
c. Architectural patterns & principles:
• Microservices (single responsibility per module)
• Event-driven pub/sub for scaling & decoupling
• Hexagonal modules: API definitions separate from implementations
• Shared “common-db” and “common-web” libraries to enforce consistency
• Modular DB API vs. SQL implementation to allow multiple DB backends
d. Technologies & frameworks:
• Java/Kotlin, Maven, Jersey + Grizzly for REST services
• Ebean ORM for DB migrations & access
• CloudEvents + NATS/Google PubSub/Kinesis connectors
• Dart/Flutter for web UI and CLI
• Docker, Kubernetes (Helm), Pulumi for infra
• Cucumber/Gherkin for E2E tests
Detail
• Every service boundary and data store.
• Code-generation modules (mr-api, dacha-api, edge-api) feeding into client/stub code.
• Don’t oversimplify: retaining all major modules (mr-eventing, eventing-*, security-*) helps maintain clarity on extensibility.
• CI/CD and documentation delivery pipelines as part of the deployment flow.