How yashpatel-250702/microservice-architecture-projects works
Major Components
• Employee Service ("Employee-info"): This module manages employee-related operations. It includes controllers, services, repositories, exception handling, and utility classes (e.g., for JWT validation).
• Address Service ("address-info"): This service handles address-related information with a similar layered structure as the employee service.
• Department Service ("department-info"): This module deals with department data and follows the same architectural pattern.
• Authentication Service ("auth-service"): Provides authentication endpoints, user credential management, and JWT token generation. It also includes configuration and DTOs for login requests.
• API Gateway ("cloud-gateway"): Acts as the entry point into the system. It routes incoming API requests to the appropriate microservice and features JWT filtering along with fallback controllers.
• Service Registry ("service-registry"): Implements dynamic service discovery mechanisms so that services can be registered and, in turn, discovered by other modules (e.g., the API Gateway).
• Cloud Config Server ("cloud_config"): Centralizes the configuration data for the various microservices, ensuring configuration is consistently applied across the system.
Relationships and Interactions
• All client requests from external sources first hit the Cloud Gateway. The API Gateway then routes these calls to the appropriate microservice (Employee, Address, Department, or Auth Service) based on the request path.
• The Auth Service is responsible for authenticating users and issuing JWT tokens. Once a JWT is obtained, clients include it in subsequent calls, and the corresponding microservices (as well as the gateway) use a JWT Filter (present in several modules) to validate the token.
• Services might also interoperate: for example, the Employee Service includes Feign client interceptors (and Feign client configurations) which suggest that it calls the Address and Department services. This internal communication is facilitated over a service registry which maintains a list of available services.
• The Service Registry enables dynamic service discovery. Services register themselves here, and the API Gateway and/or client services query the registry to locate endpoints.
• The Cloud Config Server centralizes external configuration and can provide updated settings at runtime to microservices.
Important Architectural Patterns
• Microservices Architecture: Each service is a self-contained unit built around a single domain (employee, address, department, etc.), promoting decentralized management and scalability.
• API Gateway Pattern: The cloud-gateway serves as a single entry point that provides request routing, load balancing, and security.
• Service Discovery: The service-registry allows dynamic registration and lookup of microservice instances to facilitate load balancing and resiliency.
• Centralized Configuration: The cloud_config module acts as a configuration server for keeping environment-specific settings managed centrally.
• Security with JWT: Multiple modules (via JwtFilter and JwtUtil) indicate a security pattern based on JSON Web Tokens for authentication and authorization across services.
• Use of Spring Boot (inferred from naming conventions and structure) with Maven for project management.