Quick start¶
TutorialLearn by doing, one step after another.
Five minutes from download to a protected, rate-limited API, on your own machine. You need
the apinx binary for your platform. For a server, follow Install.
1. Start it¶
The example configuration enables a built-in demo backend, so there is something to route to before you connect your own service. Three ports are in use:
| Port | What |
|---|---|
9000 |
Console, Admin API, /healthz, /readyz, /metrics |
8080 |
The proxy: your API traffic |
9100 |
The demo backend |
2. Claim the instance¶
The first start prints a claim token:
Open http://localhost:9000, paste the token, and create the administrator account (an email and a password of at least 12 characters). The token is single use; restarting an unclaimed instance prints a new one.
3. Publish your first API¶
Right after the claim, the console opens a five-step wizard with a default at every step:
- Backend: name the API (
orders) and keep the demo backend. - Protection: keep API key; an application and its first key are created for you.
- Rate limit: keep 60 per minute.
- Review and publish: copy the key (it is shown once), then Publish.
- Try it: Send test request calls through the real gateway and shows the answer next to its trace. Send it again past the limit and the 429 appears with its error code explained.
When the wizard closes, the Overview page is where you land:
1
2
3
4
- The menu follows the work: Develop the APIs, Publish them to consumers, Analyze the traffic, then Admin.
- Getting started ticks off each first step and names the next one.
- Today's calls counts the calls against the plan. This card is in Apinx Cloud only; the pictures in this manual were taken there.
- Ready is the state of the gateway. It turns amber and says why when something needs attention.
If Create in the draft is refused, for example because an API or application with that name already exists, the wizard removes what it had created so far: change the name and create again. The same holds for the wizard's last card, Point it at your own backend: when the publish is refused, the previous backend stays in place and nothing goes live.
4. Call it¶
curl -i localhost:8080/orders/echo
# 401 APX-PL-0001: the route requires an API key
curl -i -H "X-API-Key: apk_…" localhost:8080/orders/echo
# 200, with RateLimit-Remaining counting down
5. Point it at your own backend¶
In the console: Upstreams → New upstream with your service's URL, then APIs → New API choosing that upstream, then Review and deploy. Or write it as a file and import it:
apiVersion: apinx/v1
kind: Gateway
listeners:
- name: http
address: ":8080"
upstreams:
- name: my-service
targets:
- url: http://localhost:3000
routes:
- name: everything
path: /{rest...}
upstream: my-service
What just happened¶
- Nothing restarted. Changes accumulate in a draft; deploying compiles the draft into an immutable revision and swaps it in with no dropped requests. Rollback is a pointer change.
- The key you copied is stored as a hash; revoking it in Consumers takes effect on the next request.
- Every request is in Traffic with a timeline of the policies that ran on it, and in Analytics a minute later.
Next: Your first API, step by step · The model · YAML samples