How castro-1/stadium-delivery works
Main Components
• Frontend: Built with React (noted by client-app and restaurant-admin directories) that interacts with users using Material-UI.
• Microservices:
• Inventory Service: Handles product catalog management (examined in inventory-service – controllers, models, routes).
• Order Service: Manages order creation, validation, and stock updating (order-service – controllers, models, routes, Kafka producer usage).
• Notification Service: Sends real-time notifications to users (notification-service – Socket.io integration, Kafka consumer).
• Databases:
• MongoDB: Used for inventory and notifications.
• PostgreSQL: Used by the order service.
• External Communication & Tools:
• Kafka: Enables asynchronous communication between services.
• REST APIs: For frontend-microservice and inter-service communication.
• Docker & Kubernetes: For containerizing and orchestrating the services (see docker-compose.yml, Minikube deployment scripts, and k8s-new configuration files).
Component Relationships and Interactions
• User Interaction Flow:
• The user interacts with the frontend application.
• The frontend makes GET requests to the inventory service to display available products.
• When an order is placed, the frontend sends a POST request to the order service.
• Backend Processing Flow:
• The order service validates the order and queries or updates the inventory service accordingly.
• After order creation, the order service publishes a “pedido creado” (order created) event to Kafka.
• The notification service listens to Kafka; upon receiving an event, it creates and dispatches a notification using Socket.io.
• Data Persistence:
• MongoDB stores inventory and notification data.
• PostgreSQL is utilized by the order service to persist order details.
Architectural Patterns and Principles
• Microservices Architecture:
• Different services are narrowly focused on specific domains (inventory, order, notifications).
• Containerization & Orchestration:
• Each service is containerized with a Dockerfile and deployed using Kubernetes configurations.
• Event-driven Communication:
• Kafka is utilized to decouple services and enable asynchronous event-driven processing.
• API-based Communication:
• Services interact via RESTful endpoints, ensuring loose coupling.
Relevant Technologies, Frameworks, and Tools
• Frontend Technologies:
• React, Vite, Tailwind CSS alongside Material-UI (mentioned within README).
• Backend Technologies:
• Node.js with Express framework, with each microservice implementing its own set of controllers, models, and routes.
• Deployment & Infrastructure:
• Docker (for containerization)
• Kubernetes and Minikube (for orchestration)
• YAML files to describe deployments (in the k8s-new folder).
Additional Details
• Containers and orchestration elements:
• Docker images and Kubernetes clusters to emphasize containerization.
• Optionally, include configuration files like docker-compose and Minikube deployment scripts to note how the system is deployed.
• Utility scripts (like seed-data.js) as part of the startup or initialization flow for inventory data.
• Any integration with external systems (if applicable) should be labeled, though the primary interactions here remain internal.