Skip to content

One binary with subsystem toggles; configuration only from the environment

Accepted.

2026-06-11 (the configuration consolidation that wrote the rule down; the one-binary shape dates from the first commit).

FlowCatalyst is several cooperating services: the API and console, the message router, the dispatch scheduler, the stream processor, the outbox processor, the scheduled-job scheduler, the push gateway and the MCP server. They share one database, one set of domain packages and one release.

Teams run it in very different shapes. A developer wants everything in one process with an embedded database. A small production runs a single container. A large one runs the router on its own nodes, the processors behind leader election, and several stateless API replicas.

Two questions follow: how many deployable artefacts, and how are they configured.

One server binary, fc-server. Each subsystem is a switch in the environment, not a separate program:

Variable Subsystem
FC_PLATFORM_ENABLED the platform API and console (default on)
FC_ROUTER_ENABLED the message router
FC_SCHEDULER_ENABLED the dispatch scheduler
FC_STREAM_PROCESSOR_ENABLED the stream processor
FC_OUTBOX_ENABLED the outbox processor
FC_SCHEDULED_JOB_ENABLED the scheduled-job engine
FC_PUSH_ENABLED the push gateway
FC_MCP_ENABLED the MCP server

Everything except the platform API defaults to off, so a deployment states which roles a process plays. The same image runs as an all-in-one node, as a router-only node, or as an API-only node. fcdev is the same code with every subsystem on and an embedded Postgres.

Configuration comes only from the environment. There are no configuration files. One loader (LoadEnv in internal/server/envcfg.go) reads the server’s variables; a few packages read their own (encryption, email, ratelimit, loginbackoff, the scheduled-job scheduler, mcp) through small FromEnv constructors. Rules for the variables:

  • FC_* is the canonical name; a legacy alias, where one exists, is checked second, and the first set non-empty value wins.
  • Booleans accept 1/true/yes/on and 0/false/no/off; anything else falls back to the default.
  • Unparseable numbers fall back to the default rather than failing startup, except where the variable is marked required for a feature.
  • Secrets are referenced rather than inlined (for example env://VAR or a secrets-manager reference) so the same variable set works with different secret stores.

fcdev also takes command-line flags, but their defaults are seeded from the same variable names.

Good

  • One image to build, scan, version and promote. A deployment topology is a change of environment, not of artefact.
  • The same code runs in development and production, so a subsystem is not first exercised in production.
  • Configuration is uniform with container platforms, which inject environment natively, and it is easy to diff between environments.
  • Processes that must have a single active instance (the dispatch scheduler, the stream processor and the scheduled-job engine) are gated by leader election when it is enabled, so a replica can carry every toggle without double work.

Bad

  • The binary contains code a given node never runs, and a misconfigured toggle can start a subsystem where it is not wanted.
  • There are many variables, and no file means no comments or structure alongside the settings. The environment reference exists to make up for that.
  • Silent fallback on an unparseable value can hide a typo. Operators must check the logged configuration at startup.
  • A subsystem that needs its own database pool or tuning shares the binary’s release cadence.
  • Separate binaries or images per service. Clean isolation, but more artefacts, more version-skew cases and a harder local setup.
  • Configuration files (YAML or TOML). Better structure, but a second source of truth next to the container environment, and a file to template and mount in every deployment.
  • A configuration service. Over-engineered for the problem, and a new dependency for starting up.