Architecture¶
ConceptExplains how it works and why.
Apinx is one binary. This page shows what is inside it, what it talks to, and which part does what when a request arrives or when you change the configuration.
The parts¶
| Part | What it does |
|---|---|
| Gateway (data plane) | Accepts requests on the listeners, matches a route, runs the policy chain and calls the backend. It works from a configuration compiled at deploy time and held in memory. |
| Admin API (control plane) | Holds the draft, validates it, stores revisions and deploys them to the gateway. |
| Console | The web interface, embedded in the binary. Everything it does is an Admin API call, so apinxctl and your own scripts can do the same. |
| Store | Configuration, users, consumers, revisions and the audit trail: a SQLite file by default, or PostgreSQL. |
| Redis (optional) | Rate-limit and quota counters shared by several instances. One instance does not need it. |
Two paths through the binary¶
The request path is the top row of the diagram: a caller, the gateway, your backend. It reads nothing from the store while it serves a request. Routing and policies use the configuration in memory, so a store outage does not stop traffic. A request's journey follows one request through it step by step.
The change path starts with your team. An edit in the console, a call to the Admin API, an
apinxctl command or an imported file changes the draft. Deploying validates and compiles the
draft into an immutable revision, and the gateway swaps it in without a restart.
Drafts, revisions and deployments explains each step.
What leaves the binary¶
After a response is written, the gateway emits one telemetry event for the request. The request inspector, the analytics rollups and the access log consume it from a bounded queue, so nothing on the request path waits for them. From there you can send metrics to Prometheus, the access log to Loki, Elasticsearch, Seq or syslog, and traces to any OpenTelemetry tool. See Observability.
The console and this manual are served by the binary itself, and neither loads anything from another site.
More than one instance¶
Several instances of the same binary can share one PostgreSQL database behind your load balancer. Each instance watches the database and applies a deployment made on any other one. Counters that must be exact across the installation live in Redis. See High availability.
One file instead of a store¶
For a stateless gateway with no console, apinx gateway run serves one gateway file and
nothing else. See Run from a file, no database.