
Deploy Apache APISIX
One-service Apache APISIX: API and AI gateway, config as code, no etcd.
apache-apisix
Just deployed
Deploy and Host Apache APISIX on Railway
Apache APISIX is a cloud-native, open-source API and AI gateway built on NGINX and OpenResty. It routes, secures, and observes HTTP traffic with 100+ plugins, including AI proxy and prompt-guard plugins for LLM workloads. This template runs APISIX as one declarative service: no etcd, no database, routes as code in Git.
About Hosting Apache APISIX
Hosting APISIX in standalone mode turns the gateway into a single stateless service. Routes, upstreams, and plugins are declared in one YAML file that lives in the repository, so every change is version-controlled in Git and a deploy is a rebuild. There is no etcd, no Admin API, and no persistent volume; the container is disposable and identical on every start. Railway terminates TLS at the edge and forwards plain HTTP to port 9080. Backends can be public HTTPS endpoints, or services in the same Railway project reached over the private network at .railway.internal.
Common Use Cases
- Publish a stable public domain for backends deployed in the same Railway project, routed over the private network.
- Front an LLM API with the AI gateway plugins: proxy multiple providers, apply token rate limiting, and guard prompts.
- Apply authentication and rate limiting to internal services before exposing a single gateway domain.
- Mock and test APIs during development with the mocking plugin, before the real backend exists.
- Serve canary or traffic-split deployments from a declarative, reviewable configuration.
Dependencies for Apache APISIX Hosting
- Official multi-architecture Docker image
apache/apisix:3.21.0-debian(amd64 and arm64, about 145 MB). - One public HTTP service listening on port
9080; no etcd, no database, no cache, no persistent volume. - Backends to route to: public HTTP/S endpoints, or services reachable in the same Railway project.
Implementation Details
Routes are declared in conf/apisix.yaml. Add a route, commit, and push — the next deploy loads the file into memory:
routes:
- uri: /api/*
upstream:
nodes:
"your-service.railway.internal:80": 1
type: roundrobin
#END
A built-in /healthz route returns 200 via the mocking plugin and is used by the Railway health check. It proxies nothing and is safe to keep.
| Path | Exposure | Purpose |
|---|---|---|
:9080 HTTP | Public via Railway domain | Proxied traffic and /healthz |
| Railway private network | Internal only | Reach backends at .railway.internal: |
Standalone mode intentionally disables the Admin API, so there is no management port exposed.
Comparison with Alternatives
✅ = built-in part of the workflow, ❌ = not available or requires a workaround.
| Capability | This template (APISIX standalone) | APISIX full mode (etcd + dashboard) | Kong Gateway | LiteLLM / New API |
|---|---|---|---|---|
| Single service, no etcd or database | ✅ | ❌ | ❌ (PostgreSQL, or DB-less without admin features) | ❌ (database for keys and usage) |
| No persistent volume required | ✅ | ❌ | ❌ | ❌ |
| Route changes version-controlled in Git | ✅ | ❌ (stored in etcd, edited via dashboard) | ✅ (DB-less mode only) | ✅ |
| Web dashboard for runtime route editing | ❌ (config as code) | ✅ | ✅ | ✅ |
| General API gateway feature set (routing, auth, traffic, observability) | ✅ | ✅ | ✅ | ❌ (LLM-focused) |
| Built-in AI/LLM proxy plugins (ai-proxy, ai-rate-limiting, ai-prompt-guard) | ✅ | ✅ | ✅ | ✅ |
| Zero required environment variables | ✅ | ❌ | ❌ | ❌ |
Sources: the Apache APISIX repository, the APISIX deployment modes documentation, and the APISIX Docker repository. The dashboard trade-off is intentional: config-as-code gives every route change a reviewable Git history at the cost of a GUI.
Security Considerations
- Every route and plugin change goes through Git, so gateway configuration is auditable — treat the repository as the source of truth and review changes like code.
- The Admin API is disabled in standalone mode, so there is no management endpoint to secure or accidentally expose.
- Enable an authentication plugin (for example
key-authoropenid-connect) before routing to backends that are not meant to be public. - Railway terminates TLS at the edge; traffic inside the project's private network is not TLS-terminated by this service.
- Do not commit upstream credentials in route files — use APISIX secret references or environment templating in
conf/config.yaml.
Why Deploy Apache APISIX on Railway?
Railway is a singular platform to deploy your infrastructure stack. Railway will host your infrastructure so you don't have to deal with configuration, while allowing you to vertically and horizontally scale it.
By deploying Apache APISIX on Railway, you are one step closer to supporting a complete full-stack application with minimal burden. Host your servers, databases, AI agents, and more on Railway.
Backends in the same project are reachable over the private network, so one gateway service can front an entire project — and the declarative, GitOps-style configuration keeps every route change reviewable.
Template Content
apache-apisix
codestorm-official/apache-apisix
