Skip to main content

API Gateway

Central entry point for all API requests, providing request routing, TLS termination, rate limiting, and JWT validation for the issue tracker platform.

Service Structure

├── main.py                    # FastAPI application entrypoint
├── config/
│   ├── traefik.yml           # Traefik static configuration
│   └── dynamic.yml           # Traefik dynamic configuration
└── requirements.txt           # Python dependencies (httpx)

Features

Request Routing

  • Path-based routing: Routes requests to appropriate backend services
  • Service discovery: Automatic service endpoint resolution
  • Load balancing: Round-robin load distribution

Security

  • JWT Validation: Validates JWT tokens before forwarding requests
  • Rate Limiting: Per-client rate limiting
  • CORS: Configurable Cross-Origin Resource Sharing
  • TLS Termination: Handles HTTPS termination

Observability

  • Request Logging: Structured logging for all requests
  • Health Checks: Service health endpoints
  • Metrics: Request latency, error rates, throughput

Service Mapping

Path Prefix Backend Service Port
/api/v1/auth auth-service 8001
/api/v1/users user-service 8002
/api/v1/projects project-service 8003
/api/v1/issues issue-service 8004
/api/v1/comments comment-service 8005
/api/v1/notifications notification-service 8006
/api/v1/search search-service 8007
/api/v1/audit audit-service 8008

API Endpoints

Health Check

GET /health

Response:
{
  "status": "healthy",
  "service": "api-gateway",
  "version": "1.0.0"
}

Ping (Traefik)

GET /ping

Response: 200 OK

Configuration

Environment variables (in .env):

# Service
SERVICE_NAME=api-gateway
SERVICE_VERSION=1.0.0
ENVIRONMENT=development

# Backend Services
AUTH_SERVICE_URL=http://auth-service:8000
USER_SERVICE_URL=http://user-service:8000
PROJECT_SERVICE_URL=http://project-service:8000
ISSUE_SERVICE_URL=http://issue-service:8000
COMMENT_SERVICE_URL=http://comment-service:8000
NOTIFICATION_SERVICE_URL=http://notification-service:8000
SEARCH_SERVICE_URL=http://search-service:8000
AUDIT_SERVICE_URL=http://audit-service:8000

# Security
SECRET_KEY=your-secret-key-change-in-production
ALGORITHM=HS256

# Rate Limiting
RATE_LIMIT_REQUESTS=100
RATE_LIMIT_WINDOW=60

Traefik Configuration

The gateway uses Traefik v2.10 as a reverse proxy:

Static Configuration (config/traefik.yml)

  • Entry points (HTTP/HTTPS)
  • API dashboard
  • Providers (file-based)

Dynamic Configuration (config/dynamic.yml)

  • Routers with path matching
  • Middleware (rate limiting, auth)
  • Services (load balancers)
  • TLS certificates

Development

Running the Service

# Install dependencies
pip install -r requirements.txt

# Run with uvicorn
uvicorn main:app --reload --host 0.0.0.0 --port 8000

# Or using Docker
docker build -f Dockerfile -t api-gateway .
docker run -p 8000:8000 --env-file .env api-gateway

Testing

# Health check
curl http://localhost:8000/health

# Test routing
curl -H "Authorization: Bearer <token>" http://localhost:8000/api/v1/auth/me

Security Considerations

  1. JWT Validation: All protected routes require valid JWT
  2. Rate Limiting: Prevents abuse and DDoS
  3. HTTPS: Use TLS in production
  4. CORS: Configure allow_origins appropriately
  5. Secrets: Change SECRET_KEY in production

Future Enhancements

  • WebSocket support for real-time features
  • Request/response transformation
  • Circuit breaker pattern
  • Advanced rate limiting (token bucket)
  • API versioning support
  • Request caching
  • GraphQL gateway support

Metadata

Release files for api-gateway-byom 1.0.1

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Built distribution (wheel)

Table of built distributions (wheels) for api-gateway-byom 1.0.1
File Interpreter ABI Platform Actions
api_gateway_byom-1.0.1-py3-none-any.whl Python 3 none any Details for api_gateway_byom-1.0.1-py3-none-any.whl

Release files / api_gateway_byom-1.0.1-py3-none-any.whl

Download URL api_gateway_byom-1.0.1-py3-none-any.whl
Size 10.6 kB
Tags Python 3
SHA-256 checksum
How to use checksums
d79d42c7fc983315ca5fbaa4b41f4bd4edca62db0aaf8b8dddb2c67051633f67
BLAKE2b-256 checksum
How to use checksums
282469c8c16a1bff76df81745c2b08fafe8ab0516333c4194a87c0aed8a63c4b
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Aug 5, 2026.

Transparency log

Security for api-gateway-byom 1.0.1

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

Full provenance

All 1 file in this release has been uploaded with provenance metadata.

Attestation for api_gateway_byom-1.0.1-py3-none-any.whl

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Aug 5, 2026.

Transparency log

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Release history Release notifications | RSS feed

This release

1.0.1 This release

1 release file Full provenance

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page