Skip to content

umuttopalak/example-api-gateway

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

1 Commit
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Example API Gateway Project

A robust API Gateway application designed to manage and route microservices traffic.

Features

  • Microservice management and routing
  • Redis-based service registry and discovery
  • Rate limiting
  • CORS support
  • Centralized error handling
  • Health checks
  • Docker support

Technologies

  • Python 3.9
  • FastAPI
  • Redis
  • Docker & Docker Compose
  • HTTPX
  • Uvicorn
  • Pydantic

Installation

Clone and set up the project:

git clone https://github.com/umuttopalak/example-api-gateway.git
cd api-gateway
cp sample.env .env

Start with Docker:

docker-compose up -d

Usage

Service Registration

curl -X POST http://localhost:8000/api/services/register \
  -H "Content-Type: application/json" \
  -d '{"name": "user-service", "url": "http://user-service:8001"}'

Available Endpoints

  • GET /api/services - List all registered services
  • POST /api/services/register - Register a new service
  • DELETE /api/services/{service_name} - Remove a service
  • GET /api/users - User service endpoints
  • GET /api/products - Product service endpoints
  • GET /api/orders - Order service endpoints

Configuration

Key environment variables:

PORT=8000
REDIS_HOST=redis
REDIS_PORT=6379
RATE_LIMIT=10
RATE_LIMIT_WINDOW=60

Contributing

  1. Fork the project
  2. Create your feature branch (git checkout -b feature/AmazingFeature)
  3. Commit your changes (git commit -m 'Add some AmazingFeature')
  4. Push to the branch (git push origin feature/AmazingFeature)
  5. Open a Pull Request

Contact

Email - [email protected] Project Link: https://github.com/umuttopalak/example-api-gateway

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published