A Spring Cloud Gateway service that acts as a central entry point for our fintech microservices ecosystem, providing routing, filtering, and cross-cutting concerns management.
The Gateway Service provides:
- 🚦 Centralized routing to microservices
- 🔒 Security and authentication filtering
- 🔄 Load balancing
- 🎯 Request/response transformation
- 📊 Monitoring and logging
src/main/java/com/fintech/gateway/
├── Config/ # Configuration classes
│ ├── FeignConfiguration.java
│ ├── JwtAuthenticationFilter.java
│ └── SecurityConfig.java
├── DTO/ # Data Transfer Objects
│ ├── TokenRequest.java
│ ├── UserResponse.java
│ └── ValidResponse.java
├── Service/ # Service layer
│ └── FeignClient/
│ └── AuthServiceClient.java
├── GatewayApplication.java
└── resources/
└── application.yaml # Gateway configuration
The Gateway routes traffic to the following services:
| Service | Path | Port |
|---|---|---|
| User Service | /api/users/** |
8090 |
| Wallet Service | /api/wallets/** |
8099 |
| Auth Service | /api/auth/** |
8946 |
| Transaction Service | /api/transaction/** |
8599 |
| Notification Service | /api/notifications/** |
8085 |
| Loans Service | /api/loans/** |
8097 |
server:
port: 8222
spring:
application:
name: gateway-service
cloud:
gateway:
routes:
- id: user-service
uri: http://user-service:8090
predicates:
- Path=/api/users/**
# Additional routes configured...var:
filter:
excluded-paths: /api/auth, /users/public/images, /actuator/health- Dynamic Routing: Routes requests to appropriate microservices
- Load Balancing: Distributes traffic across service instances
- Security: JWT authentication and authorization
- Monitoring: Actuator endpoints for health and metrics
- Path-Based Routing: Configured routes based on URL paths
- Service Discovery Integration: Optional service discovery support
- Health Checks: Detailed health information for all routes
-
Prerequisites
- Java 17+
- Maven
- Running Config Server
- Running Auth Service (for JWT validation)
-
Configuration
- Ensure Config Server is running
- Update service URIs if needed
- Configure security settings
-
Running Locally
mvn clean package java -jar target/gateway-service.jar
-
Docker Build
docker build -t gateway-service . docker run -p 8222:8222 gateway-service
The gateway implements several security measures:
- JWT token validation
- Path-based security rules
- Excluded paths for public access
- CORS configuration
Available actuator endpoints:
/actuator/health: Service health information/actuator/metrics: Metrics data/actuator/routes: Available route configurations
Test gateway routing with:
# Test user service route
curl http://localhost:8222/api/users/profile
# Test wallet service route
curl http://localhost:8222/api/wallets/balance| Avatar | Name | Role | GitHub |
|---|---|---|---|
![]() |
Zakariae Azarkan | DevOps Engineer | @zachary013 |
![]() |
El Mahdi Id Lahcen | Frontend Developer | @goalaphx |
![]() |
Hodaifa | Cloud Architect | @hodaifa-ech |
![]() |
Khalil El Houssine | Backend Developer | @khalilh2002 |
![]() |
Mohamed Amine BAHASSOU | ML Engineer | @Medamine-Bahassou |
- Fork the repository
- Create a feature branch (
git checkout -b feature/new-route) - Commit your changes (
git commit -m 'Add new route configuration') - Push to the branch (
git push origin feature/new-route) - Open a Pull Request
This project is licensed under the MIT License - see the LICENSE file for details.





