How holedev/vnoi-microservice works
Main Components
• Frontend (Client): This lives in the “client” directory. It is a React 18 application using Vite, Material UI, CodeMirror for a modern, interactive UI, with additional tools like Cypress for E2E testing and K6 for load testing.
• API Gateway: Found under the “server/gateway” directory, this component acts as the central entry point for all client requests, handling routing, security (JWT, rate limiting), and orchestrating calls to internal services.
• Backend Microservices: These include the User Service, Exercise Service, Learning Service, Media Service, Statistics Service, and Common Service. Each service is maintained as a separate module within the “server” directory (with dedicated folders like server/user, server/exercise, etc.). They provide discrete functionalities (e.g., user management, exercise submission and evaluation, course learning, media handling, and analytics).
• Infrastructure Components:
– Messaging Queue: RabbitMQ (configuration found across several service directories) is used to manage asynchronous communication.
– Database: MongoDB is the primary data store for these services.
– Monitoring: Prometheus and Grafana are integrated for real-time performance metrics and logging dashboards.
– Containerization & Orchestration: Docker is extensively used (Dockerfiles and docker-compose configurations are present) to manage environments for development and production.
Relationships and Interactions
• The Client (frontend) communicates directly with the API Gateway.
• The API Gateway then routes requests to the appropriate backend service (User, Exercise, Learning, Media, or Statistics).
• Each microservice interacts with:
– A common service, which provides shared utilities and business logic.
– MongoDB for persistent storage.
– RabbitMQ for inter-service messaging.
• Monitoring services such as Prometheus and Grafana pull metrics from the backend services.
• There are also external dependencies (such as Firebase) and configuration tools integrated into selected services.
Important Architectural Patterns & Principles
• Microservices Architecture: Each service is isolated to manage specific business domains. This improves scalability, maintainability, and fault isolation.
• API Gateway Pattern: Centralizes request routing, security, and possibly load balancing.
• Containerization: Docker is used to standardize and deploy multiple services reliably in various environments.
• Testing First: A comprehensive testing strategy is in place (unit tests, integration tests, E2E tests) ensuring service reliability.
• Observability: Incorporation of Prometheus and Grafana demonstrates an adherence to modern devops practices.