How rimanshu11/loopback-microservices works
Main Components
• API Gateway (bms-api-gateway): Acts as the central entry point (running on port 3005). It’s responsible for token validation, routing client requests, and handling cross-service interactions.
• Microservices:
• Author Service – Manages authors and runs on port 3001.
• Book Service – Manages books and runs on port 3002.
• Category Service – Manages categories and runs on port 3003.
• Auth Service – Although not present in the file tree, the README indicates an authentication service for handling user authentication (likely running on port 3004).
File Structure for Each Microservice
• Each service (e.g., AuthorServices, BookServices, CategoryServices, and bms-api-gateway) has a similar internal structure:
• A ‘src’ directory containing application entry points, controllers, datasources, models, repositories, and API specification files.
• Testing directories (i.e., __tests__) indicate an emphasis on correctness and acceptance testing.
• This common structure suggests the use of a well-defined separation of concerns. For instance, controllers handle HTTP routes, models represent the data structures, datasources manage database interactions, and repositories abstract data access.
Relationships and Interactions
• External services or message brokers can be represented if event-driven communication is incorporated (the README suggests the possibility, for example, mentioning RabbitMQ or Kafka).
Architectural Patterns and Design Principles
• Microservices Architecture: Emphasize that services are independently deployable and adhere to a “split by business capability” philosophy.
• Clear Separation of Concerns: Within each microservice, highlight separation between controllers, datasources, models, and repositories.
• API Gateway Pattern: Illustrate how the gateway abstracts the complexity of multiple microservices and enforces cross-cutting concerns (e.g., authentication, logging, rate limiting).
Technologies and Frameworks
• That each service is built using Node.js and follows similar configurations (indicated by consistent use of tools like ESLint, Prettier, Docker, and testing frameworks like Mocha).
• That the API specifications (openapi-spec.ts) are used to manage and document API contracts, which can be highlighted as part of the overall design.