flagnetic

module
v0.1.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Oct 23, 2026 License: Apache-2.0

README

Flagnetic

Self-hosted, open-source feature flags and experiments. One Go binary with an embedded web console; PostgreSQL is the only thing it needs.

Status: developer preview. Version 0.1 is the first release: try it, build against its Go SDK, and tell us what breaks, but do not run it where an outage would hurt. The SDK API and the ruleset format only grow from 0.1 on, and upgrades only migrate forward, without data loss; the management API and the console may still change in 0.x, each change marked in the release notes. See what 0.1 promises.

Why

The open-source flag products keep a paid tier, and the features a real team needs sit behind it: roles, SSO, audit log, approvals, environments, streaming, experiment analysis. Flagnetic ships all of it under Apache-2.0, with no cloud edition, no enterprise license and no feature gates. Ever.

What 0.1 contains

  • Flags of four types (boolean, string, number, JSON) in every environment, with targeting rules, segments (private ones included), percentage rollouts, prerequisites, overrides and a kill switch; revert, copy and compare between environments, history, and a tester that shows what a context is served, and why.
  • Access: roles and permissions per project, personal access tokens and project tokens with scopes, an audit log of every change, local sign-in with lockout and throttling, members and invitations.
  • Delivery to SDKs: server and client SDK keys per environment, with rotation and an overlap, revocation and allowed origins; the ruleset with conditional requests; the ruleset stream, which brings a change, a kill switch included, to a server SDK within 2 seconds; remote evaluation for client keys, which learn served values only; the events SDKs post; the attributes SDKs send that the project has not declared; and the SDKs seen using each environment.
  • The Go SDK and its OpenFeature provider: evaluation in the SDK, so a flag check costs no network call and the SDK keeps serving its last good ruleset if the server goes away.
  • Operations: any number of identical replicas on one PostgreSQL, with no sticky sessions; Prometheus metrics; a console in English and Russian; a Docker image for linux/amd64 and linux/arm64 with provenance and an SBOM.

Not there yet

Each arrives in a later release:

  • Experiments: deterministic bucketing is in the ruleset format and the SDK already, but experiments cannot be created, exposures are not stored and there is no analysis.
  • Reports on the evaluation summaries SDKs send, such as flags no SDK evaluates any more.
  • Governance: protected environments with change requests, scheduled changes, webhooks.
  • Identity: OIDC, SAML and SCIM.
  • Export of exposures and evaluation summaries to ClickHouse, object storage or a webhook.
  • More SDKs: JavaScript (server, browser, React), Dart and Flutter, Ruby and Python, each with an OpenFeature provider.
  • A Helm chart.

Quick start

With Docker:

git clone https://github.com/azverinus/flagnetic.git && cd flagnetic/deploy
echo "FLAGNETIC_SECRET_KEY=$(openssl rand -base64 32)" > .env   # once; keep this file
docker compose up -d

This runs PostgreSQL, applies the migrations and starts the server on http://localhost:8080. Create the first instance admin, then sign in with the email and the password it prints:

docker compose exec flagnetic flagnetic admin bootstrap --email you@example.com

Then create a project, add a server SDK key to one of its environments, and follow the Go SDK.

Documentation

Principles

  • PostgreSQL is the only required dependency; everything else is an optional integration.
  • Flag checks are free; the platform going down is not an incident.
  • Assignment is deterministic; exposure is an explicit call, separate from evaluation.
  • Contracts are versioned from the first release, because a mobile app in a store is served for years.
  • Everything in the console is available through the API.

Contributing

Read CONTRIBUTING.md and ARCHITECTURE.md. Security issues: see SECURITY.md.

License

Apache-2.0.

Directories

Path Synopsis
cmd
flagnetic command
Command flagnetic is the Flagnetic server.
Command flagnetic is the Flagnetic server.
eval module
internal
app
Package app is the root of the application layer: one subpackage per bounded context, holding its command and query handlers.
Package app is the root of the application layer: one subpackage per bounded context, holding its command and query handlers.
app/access
Package access holds the use cases of the access context: members, the instance admin, API tokens and the authentication of their callers.
Package access holds the use cases of the access context: members, the instance admin, API tokens and the authentication of their callers.
app/delivery
Package delivery holds the use cases of the delivery context: for now, moving an environment's ruleset version on when a write changes what its SDKs receive, and evaluating its ruleset for a context to explain what the context is served.
Package delivery holds the use cases of the delivery context: for now, moving an environment's ruleset version on when a write changes what its SDKs receive, and evaluating its ruleset for a context to explain what the context is served.
app/flags
Package flags holds the use cases of the flags context: flags, their configuration in each environment, and segments.
Package flags holds the use cases of the flags context: flags, their configuration in each environment, and segments.
app/governance
Package governance holds the use cases of the governance context: for now, reading the audit log.
Package governance holds the use cases of the governance context: for now, reading the audit log.
app/workspace
Package workspace holds the use cases of the workspace context: projects, their environments, unit types and attributes.
Package workspace holds the use cases of the workspace context: projects, their environments, unit types and attributes.
domain
Package domain is the root of the domain layer: one subpackage per bounded context, holding its entities, value objects and invariants.
Package domain is the root of the domain layer: one subpackage per bounded context, holding its entities, value objects and invariants.
domain/access
Package access is the domain of who may do what: members and the instance admin, API tokens and their scopes, the permission catalog, the built-in roles and how a caller is judged against what an operation requires.
Package access is the domain of who may do what: members and the instance admin, API tokens and their scopes, the permission catalog, the built-in roles and how a caller is judged against what an operation requires.
domain/delivery
Package delivery is the domain of what an environment's SDKs receive: the ruleset materialized from its flags, segments and declarations, and the evaluation of it that explains what a context is served.
Package delivery is the domain of what an environment's SDKs receive: the ruleset materialized from its flags, segments and declarations, and the evaluation of it that explains what a context is served.
domain/flags
Package flags is the domain of what a project serves: flags with their definition and variations, their configuration in each environment, and the segments their rules target.
Package flags is the domain of what a project serves: flags with their definition and variations, their configuration in each environment, and the segments their rules target.
domain/governance
Package governance is the domain of how changes are governed.
Package governance is the domain of how changes are governed.
domain/workspace
Package workspace is the domain of where flags live: projects, their environments, and the unit types and attributes their targeting refers to.
Package workspace is the domain of where flags live: projects, their environments, and the unit types and attributes their targeting refers to.
infra
Package infra is the root of the infrastructure layer.
Package infra is the root of the infrastructure layer.
infra/compose
Package compose assembles a replica: it builds the application's handlers on their PostgreSQL and other outbound adapters and mounts the APIs on the edge.
Package compose assembles a replica: it builds the application's handlers on their PostgreSQL and other outbound adapters and mounts the APIs on the edge.
infra/config
Package config is the server's configuration: one table declares every setting, and the loader, the keys of the configuration file and the public reference (docs/configuration.md) are all derived from it, so the reference cannot fall behind what the server reads.
Package config is the server's configuration: one table declares every setting, and the loader, the keys of the configuration file and the public reference (docs/configuration.md) are all derived from it, so the reference cannot fall behind what the server reads.
infra/in/cli
Package cli is the flagnetic command line.
Package cli is the flagnetic command line.
infra/in/http
Package http is the server's HTTP edge: the public handler with its health and readiness probes, onto which the APIs and the console are mounted.
Package http is the server's HTTP edge: the public handler with its health and readiness probes, onto which the APIs and the console are mounted.
infra/in/http/console
Package console serves the web console the binary embeds: the build of web/apps/console, or a placeholder page when the binary was built without it, so `go build` never needs Node.
Package console serves the web console the binary embeds: the build of web/apps/console, or a placeholder page when the binary was built without it, so `go build` never needs Node.
infra/in/http/management
Package management provides primitives to interact with the openapi HTTP API.
Package management provides primitives to interact with the openapi HTTP API.
infra/in/http/management/operations
Package operations reads what each operation of the management API requires from its OpenAPI document, and holds the table generated from it that the permission seam reads.
Package operations reads what each operation of the management API requires from its OpenAPI document, and holds the table generated from it that the permission seam reads.
infra/in/http/sdk
Package sdk provides primitives to interact with the openapi HTTP API.
Package sdk provides primitives to interact with the openapi HTTP API.
infra/in/worker
Package worker runs a replica's background work in rounds.
Package worker runs a replica's background work in rounds.
infra/metrics
Package metrics is the replica's Prometheus registry and the listener that serves it.
Package metrics is the replica's Prometheus registry and the listener that serves it.
infra/out/password
Package password hashes members' passwords with argon2id.
Package password hashes members' passwords with argon2id.
infra/out/postgres
Package postgres is the server's PostgreSQL: the connection pool, the check that the server is a supported version, and the schema migrations embedded in the binary.
Package postgres is the server's PostgreSQL: the connection pool, the check that the server is a supported version, and the schema migrations embedded in the binary.
infra/out/postgres/access
Package access is the PostgreSQL repository of the access context: members, API tokens and sessions.
Package access is the PostgreSQL repository of the access context: members, API tokens and sessions.
infra/out/postgres/delivery
Package delivery is the PostgreSQL repository of the delivery context: for now, the ruleset version of each environment.
Package delivery is the PostgreSQL repository of the delivery context: for now, the ruleset version of each environment.
infra/out/postgres/flags
Package flags is the PostgreSQL repository of the flags context: flags, their configuration in each environment, and segments.
Package flags is the PostgreSQL repository of the flags context: flags, their configuration in each environment, and segments.
infra/out/postgres/governance
Package governance is the PostgreSQL repository of the governance context: the audit log.
Package governance is the PostgreSQL repository of the governance context: the audit log.
infra/out/postgres/workspace
Package workspace is the PostgreSQL repository of the workspace context: projects, their environments, unit types and attributes.
Package workspace is the PostgreSQL repository of the workspace context: projects, their environments, unit types and attributes.
infra/out/testclock
Package testclock is the test-only clock of FLAGNETIC_TEST_CLOCK_FILE: the wall clock moved ahead by the duration a file holds, such as "25h".
Package testclock is the test-only clock of FLAGNETIC_TEST_CLOCK_FILE: the wall clock moved ahead by the duration a file holds, such as "25h".
pkg/buildinfo
Package buildinfo reports the version the running binary was built from.
Package buildinfo reports the version the running binary was built from.
pkg/pglisten
Package pglisten keeps a process listening on a PostgreSQL notification channel, and tells it when it is not.
Package pglisten keeps a process listening on a PostgreSQL notification channel, and tells it when it is not.
pkg/pgtest
Package pgtest gives a test package a real PostgreSQL, so that no test fakes the database.
Package pgtest gives a test package a real PostgreSQL, so that no test fakes the database.
pkg/pgxtx
Package pgxtx carries a PostgreSQL transaction in a context, so the code that owns a unit of work begins it and the code that runs statements finds it, without the transaction appearing in any signature in between.
Package pgxtx carries a PostgreSQL transaction in a context, so the code that owns a unit of work begins it and the code that runs statements finds it, without the transaction appearing in any signature in between.
pkg/safego
Package safego runs functions so that a panic in one is recovered, logged with its stack and counted, rather than crashing the process: one poison input must not take every process that reads it down with it.
Package safego runs functions so that a panic in one is recovered, logged with its stack and counted, rather than crashing the process: one poison input must not take every process that reads it down with it.
shared
Package shared is the root of the kernel every layer may import: error kinds, identifiers, the clock and secret values.
Package shared is the root of the kernel every layer may import: error kinds, identifiers, the clock and secret values.
shared/clock
Package clock is the one time source of the server.
Package clock is the one time source of the server.
shared/errors
Package errors is the one way domain and application code says what went wrong: an error of a fixed kind with a stable code.
Package errors is the one way domain and application code says what went wrong: an error of a fixed kind with a stable code.
shared/id
Package id is the identifiers of every entity: UUIDv7 values minted by the application before the domain sees them, typed per entity.
Package id is the identifiers of every entity: UUIDv7 values minted by the application before the domain sees them, typed per entity.
shared/precondition
Package precondition is how a write names the version of the entity it was based on, and how that version is judged against the stored one.
Package precondition is how a write names the version of the entity it was based on, and how that version is judged against the stored one.
shared/secret
Package secret holds values that must never reach a log: passwords, keys, tokens.
Package secret holds values that must never reach a log: passwords, keys, tokens.
testkit
Package testkit is the Flagnetic test kit: a real, migrated PostgreSQL for every test package, and the fake clock, deterministic identifiers and log sink a test hands to the code under test.
Package testkit is the Flagnetic test kit: a real, migrated PostgreSQL for every test package, and the fake clock, deterministic identifiers and log sink a test hands to the code under test.
sdks
go module

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL