Easy-Gateway Documentation
Overview
Easy-Gateway — lightweight API Gateway for microservices architecture.
Features
- Simple YAML configuration
- CLI interface
- Middleware system
- Prefix-based routing
- Rate limiting
- Logging
- Caching
- Admin Panel with Basic Auth
Installation
pip install easy-gateway
# or
uv add easy-gateway
Configuration (easy_conf.yaml)
1. Server Settings
server:
host: "0.0.0.0"
port: 8000
2. Cache Settings
redis:
enabled: true # false -> cache disabled
url: "redis://localhost:6379"
expire_time: 300 # cache TTL in seconds (default 180)
To run Redis, you can use Docker:
docker run -d --name my-redis -p 6379:6379 redis
Caching is per-route — add cache: true to any route to enable it (default false):
routes:
- path: "/pets/*"
target: "https://petstore.swagger.io/"
cache: true # enable response caching for this route
How caching works:
- Only
GETrequests are cached — and only successful responses (2xx) - Cache key:
cache:<path>:<METHOD>:<md5(query_params)>— requests with different params never collide - TTL is controlled by
redis.expire_time - Any non-
GETrequest (POST/PUT/DELETE/PATCH) to a cached route automatically invalidates its cache entries - Cache health is reported in
/health
3. Routes
routes:
- path: "/bin/*" # prefix route: /bin/anything, /bin/ip, ...
target: "https://httpbin.org/" # full URL, requested path is appended
- path: "/users" # exact route: only /users
target: "https://api.example.com" # base URL, route path is appended automatically
- path: "/pets/*"
target: "https://petstore.swagger.io/"
description: "Pets service"
cache: true # enable response caching for this route
Important:
path: "/user/*"— prefix route: forwards any/user/...path to the targetpath: "/user/"— exact route: matches only that URL- For exact routes the target must be a base URL without the path — the route path is appended automatically (
/users+https://api.example.com→https://api.example.com/users) - For prefix routes the target must be a full URL (with
http://orhttps://) cache: true— (optional) enables response caching for a given route
4. Middleware
Available middleware:
LoggingMiddleware— request loggingRateLimitMiddleware— request rate limiting
middlewares:
- name: "LoggingMiddleware"
enabled: true
- name: "RateLimitMiddleware"
enabled: true
requests_per_minute: 30
5. CORS
cors:
allow_origins:
- "https://myfront.com"
- "https://testreact.space"
6. ADMIN
admin:
username: "admin" # by default: admin
password: "admin" # change this in production!
Running
easy-gateway -c PATH-TO-YOUR-CONFIG
# or simply
easy-gateway (if config is in root directory)
Release files for easy-gateway 0.1.14
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| easy_gateway-0.1.14.tar.gz | 13.1 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| easy_gateway-0.1.14-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 27.2 kB
Release files / easy_gateway-0.1.14.tar.gz
| Download URL | easy_gateway-0.1.14.tar.gz |
|---|---|
| Size | 13.1 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
4a579d813baf93b1b88912ffea1f75924e4f1e9d0fd288e0cff2e0bb1fda7c22
|
|
BLAKE2b-256 checksum How to use checksums |
907cba6483bc4835ba7d3ad7048f63241c1b293f45ec84512af78bea7c86b344
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/7.0.0 CPython/3.13.14
|
Release files / easy_gateway-0.1.14-py3-none-any.whl
| Download URL | easy_gateway-0.1.14-py3-none-any.whl |
|---|---|
| Size | 14.2 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
d95ec6bcb715c5122196e15403a379b2a59b5fe40ffd679c6d25bedc316f0d23
|
|
BLAKE2b-256 checksum How to use checksums |
aab205b6f1fbe420efcf73dae18a96ee8ff185d0ddceaa34428d323fb9a0c76c
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/7.0.0 CPython/3.13.14
|