The model¶
ConceptExplains how it works and why.
Everything in Apinx is one of a small number of objects. This page names them and says how they relate; the gateway configuration reference has every field.
Objects¶
| Object | What it is |
|---|---|
| Listener | A port the proxy accepts traffic on, with its protocol, TLS and limits. |
| Upstream | A backend: one or more targets with load balancing, health checks, retries, a circuit breaker and timeouts. |
| API | A group of operations under a base path, forwarded to an upstream. Carries its own policies, a version, a lifecycle state, and belongs to a family. |
| Operation (route) | One path pattern under the API, optionally restricted by method or headers, with its own policies. enabled: false switches it off: it is kept but served as if it did not exist. |
| Policy | A rule that runs on the request, the response or both: authentication, limits, transforms, caching, protection. Twenty-six are built in. |
| Shared flow | A named, ordered bundle of policies attached to APIs and operations for reuse. |
| Flow hook | Shared flows an administrator attaches at the environment level, run on every API before and after its own chain, locked. |
| Product | What you offer consumers: a set of APIs with plans (rate limit, quota, approval). |
| Application (consumer) | A caller: owns API keys, allowed source addresses, and subscriptions to products at a plan. |
| Revision | An immutable, deployable snapshot of one API or of the environment configuration. |
| User | A console user with a role: administrator, editor or viewer. |
How policies combine¶
A request's policy chain is computed from five levels, widest first:
- A policy of the same type and name at a narrower level overrides the wider one by default,
merges into it (
strategy: merge) or runs in addition (strategy: append). enabled: falseat a narrower level switches off an inherited policy.- Shared flows attached at a level merge before that level's own policies.
- Flow hooks are outside the merge: the client-side hook runs before the whole chain and the backend-side hook after it, and no API can change or switch them off.
- The product level is added by the control plane for APIs in a product: the
subscriptionpolicy that checks the caller's plan.
Within the chain, policies run in a fixed order of phases (access, protection, authentication, authorization, traffic, cache, errors, transformation), whatever order you wrote them in. The console's Develop tab draws the result exactly as the gateway runs it, with the provenance of every step.
Drafts, revisions and deployments¶
Changes made in the console, the Admin API or an imported file go into the draft. Nothing serves traffic until you deploy:
- Each API has its own revisions; deploying one API leaves the others untouched.
- The environment configuration (listeners, upstreams, shared flows, flow hooks, global and environment policies, products) is a unit with its own revisions.
- Deploy all changes gives every changed unit a new revision at once.
- A deployment is validated and compiled first; an invalid draft cannot be deployed and the console lists every problem with the object, field and rule.
- Rollback deploys an older revision; Restore on the Deployments history returns every unit to a past deployment and restores the draft from it.
Versions and families¶
Versions of an API are separate APIs in one family: orders (v1) and orders-v2. A new
version is created from an existing one, either on its own base path or on the same base path
chosen by a request header. Each version has a lifecycle state: created, published, deprecated
(callers get Deprecation, Sunset and a Link to the successor), retired (410). See
Versions and lifecycle.
Products, plans and subscriptions¶
A product packages APIs for consumers. Its plans set the commercial limits: a rate limit per
consumer, a quota per day or month, and whether subscribing needs approval. An application
subscribes to a product at a plan; the subscription policy the control plane binds on the
product's APIs enforces the plan and reports usage. See
Products, plans and consumers.
What is stored where¶
| Configuration, users, consumers, revisions, audit | The store: SQLite file or PostgreSQL |
| Analytics rollups | A second SQLite file, or the same PostgreSQL database |
| Secrets inside configuration | Encrypted in the store with data keys wrapped by your master key |
| Backend tokens, rate-limit counters, caches | Memory only |
| Request traces | Memory, bounded, with retention |