Skip to content

0debt/api-gateway

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

36 Commits
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

API Gateway - 0debt

Kong-based, DB-less gateway to front 0debt microservices with JWT auth, per-plan rate limiting, and CORS.

πŸ“ Project structure

api-gateway/
β”œβ”€β”€ .github/
β”‚   └── workflows/
β”‚       └── deploy.yaml   # Build & push image + trigger Coolify
β”œβ”€β”€ Dockerfile            # Kong image with declarative config
β”œβ”€β”€ kong.yaml             # Declarative services, routes, and plugins
β”œβ”€β”€ .gitignore
└── README.md

βš™οΈ Key configuration

  • kong.yaml defines services, routes, and JWT/rate-limiting/CORS plugins.
  • Dockerfile copies kong.yaml as a template and replaces {vault://env/JWT_SECRET} at runtime via JWT_SECRET.
  • deploy.yaml builds and pushes the multi-arch image to GHCR and triggers the Coolify webhook.

Environment variables

Variable Description Required
JWT_SECRET Injected at startup to validate tokens Yes

πŸš€ Quick start

Build and run locally:

docker build -t api-gateway .
docker run -p 8000:8000 -e JWT_SECRET=super-secret api-gateway

Kong is exposed at http://localhost:8000.

πŸ“‹ Services and routes

Path Service Notes
/auth users-service Public (no JWT)
/users users-service JWT protected
/api/groups groups-service JWT protected
/expenses, /balances expenses-service JWT protected
/v1/budgets, /v1/health, /v1/internal/users analytics-service JWT protected
/notifications, /preferences notifications-service JWT protected

πŸ”’ Security and limits

  • JWT: required on all routes except /auth; use Authorization: Bearer <token>.
  • Rate limiting per plan:
    • Free: 60/min, 500/hour.
    • Pro: 1000/min, 10000/hour.
    • Enterprise: 5000/min, 50000/hour.
  • CORS: allowed origins http://localhost:3000, https://www.0debt.xyz, https://0debt.xyz; methods GET, POST, PUT, DELETE, PATCH, OPTIONS; exposed headers X-RateLimit-Remaining-Minute and X-RateLimit-Remaining-Hour.

πŸ“ Notes

  • Declarative (DB-less) configuration, no database needed.
  • Plan consumers can be managed externally; the gateway enforces the configured policies.

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors 4

  •  
  •  
  •  
  •