The Formance Gateway is a reverse proxy built on Caddy.
It embeds the standard Caddy modules together with a set of custom plugins and is
configured through the Caddyfile.
Based on the current Caddyfile, the gateway listens on port 80 and:
- adds a tracing span named
gatewayto incoming requests; - runs the custom
auditplugin, which can publish audit events to Kafka or NATS (NATS is enabled in the shipped configuration); - reverse proxies requests matching
/api/ledger*to the Ledger service on127.0.0.1:3068; - serves a
/versionsendpoint through the customversionsplugin, which gathers and reports the version and health of the configured downstream components; - responds
502 Bad Gatewayto any other/api/*route.
The binary itself (see main.go) simply registers the standard Caddy
modules and the gateway plugins, then hands control to Caddy's command-line entry
point.
- Nix with flakes enabled.
The development environment (Go toolchain, just, golangci-lint, and related
tooling) is provided by the dev shell defined in flake.nix, so no
other toolchain needs to be installed.
Enter the development shell:
nix developRun the linter:
nix develop -c just lintRun the tests:
nix develop -c just testsRun just (or nix develop -c just) with no arguments to list all available
recipes.
Caddyfile— Caddy configuration describing the gateway's routing, plugins, and reverse-proxy behavior.openapi.yaml— OpenAPI specification for the Gateway API, including the/versionsendpoint.pkg/— Go source for the custom Caddy plugins (auditandversions).test/— end-to-end tests for the gateway.