How jahidhiron/mini-blog-microservices works
Main Components
• Client (Frontend): Located in the “client” directory. This service is likely the user interface for blog posts and interactions.
• Microservices:
• Posts Service (in “posts”): Handles creation and management of blog posts.
• Comments Service (in “comments”): Manages comments on posts.
• Moderation Service (in “moderation”): Deals with moderating content based on events received.
• Query Service (in “query”): Likely used to aggregate and provide a consolidated data view or query results.
• Event Bus (in “event-bus”): Serves as the central communication hub that propagates events between different services.
• Infrastructure: “infra/k8s” directory contains Kubernetes deployment and service configuration files, indicating how these services are deployed and exposed.
• External Dependencies: MongoDB is mentioned in the README as the NoSQL database used for persistent storage.
Relationships and Interactions
• The Client (Frontend) interacts with the Posts Service (and possibly Comments) via REST APIs, issuing commands and retrieving updated data.
• When a new post or comment is created, the corresponding service publishes an event to the Event Bus.
• The Event Bus then forwards events to other interested services (such as Moderation for filtering inappropriate content, or Query for updating its read model).
• The Moderation Service listens for relevant events (for example, to moderate specific posts/comments) and may send events back to the bus after processing.
• The Query Service receives and aggregates events from multiple sources to build a queryable, denormalized view of the data.
• Each service runs inside its own Docker container as suggested by the presence of Dockerfiles. Kubernetes YAML files orchestrate these containers.
Architectural Patterns and Technologies
• Microservices Architecture: Each service in its own module has clearly defined responsibilities.
• Event-driven Communication: The Event Bus acts as an internal messaging system, facilitating a decoupled design.
• Containerization and Orchestration: Use of Docker (via Dockerfiles) and Kubernetes (via YAML deployments and services) for container deployment.
• Frontend-Backend Separation: The client directory emphasizes a clear separation by maintaining a dedicated UI alongside backend services.
• Technology Stack:
• JavaScript/Node.js is likely used in several services, as inferred from the “index.js” files.
• React (or similar) is likely used on the client side due to the presence of files like App.js and index.js in the client directory.
• MongoDB is used as the data store.