Welcome to the awesome API Gateway project using the Gin framework in Go! 🎉
- 🧭 Smart routing to the right microservices
- 🔐 JWT Authentication for maximum security
- 🚦 Rate Limiting to keep the server stable
- 📝 Advanced logging for monitoring
- ⚙️ Flexible configuration management
Before you start, make sure you have:
- 🐹 Go - Latest Version
- 🐳 Docker (optional, for containerization)
Follow these steps to get started:
- 📥 Clone this repository:
git clone https://github.com/yourusername/api-gateway.git
cd api-gateway
- 📦 Install dependencies:
go mod tidy
- 📄 Create a
config.yaml
file in the project root orconfig/
directory with your configuration settings.
Your config.yaml
file should contain:
server_address: ":8080"
jwt_secret: "SERCRET_KEY_HERE"
rate_limit: 100
services:
users: "http://users-service:8081"
products: "http://products-service:8082"
orders: "http://orders-service:8083"
Adjust these values to match your setup! 😉
To run the API Gateway:
go run main.go
The server will start at the address you specified in the config file. Happy experimenting! 🎊
The API Gateway will forward requests to the appropriate microservice based on the URL path:
👤 /api/users/*: Forwarded to Users service
🛍 /api/products/*: Forwarded to Products service
📦 /api/orders/*: Forwarded to Orders service
Remember, all requests require a valid JWT token in the Authorization header! 🔑
This project is licensed under the MIT License. Feel free to use it, but don't forget to give stars! 😉