How maxime1992/pizza-sync works
Main System Components
• Frontend Application:
• Built in Angular.
• Organized into multiple modules and features such as “pizzas,” “orders,” “countdown,” “providers,” “identification-dialog,” etc.
• Uses NgRx for state management (actions, reducers, effects) to handle pizzas, orders, ingredients, and UI state.
• Connects to backend via RESTful endpoints and socket.io for real-time updates.
• Backend Server:
• Implemented using Node.js with NestJS.
• Contains various controllers and modules for handling command-line operations and managing features (models for pizzas, orders, ingredients, users, etc.).
• Implements real-time communications via socket.io.
• Offers command-line commands (e.g., countdown updates, provider management) through its interactive prompt.
• Contains utility/helper modules for common operations (file, HTTP, normalization, etc.).
• Data Flow & Communication:
• The frontend sends HTTP requests to the backend API and interacts over WebSockets for real-time data (e.g., live order updates, countdown changes).
• The command-line utility on the backend feeds data or configurations into the system that then propagate in real time to the frontend.
• Docker / Deployment Environment:
• API service container (built from Dockerfile.api) running the backend server.
• NGINX container (built from Dockerfile.nginx) serving the Angular static assets and forwarding HTTP + WebSocket connections.
• A docker-compose configuration ties these containers together with proper linking and port forwarding.
Architectural Relationships and Interactions
• Frontend (Angular) and backend (NestJS) as separate but connected components.
• HTTP REST calls: frontend → backend.
• WebSocket communication: bidirectional between frontend and backend.
• Command-line interactions: admin command input on the backend that triggers state changes and is propagated to the frontend.
• Within the backend, display internal modularity (e.g., “features” for pizzas, orders, and users) as smaller blocks under a larger "Backend" component.
• For the frontend, indicate separation between core/shared modules, feature modules (like pizzas, orders, countdown), and state management libraries (NgRx store, effects, etc.).
Architectural Patterns & Design Principles
• Separation of concerns between frontend (UI, state management, Angular components) and backend (API, WebSocket, business logic, command-line interface).
• Real-time updates using socket.io as a key integration point.
• How Docker is used as a containerization and deployment strategy with separate containers for API (backend) and a static file server/caching proxy (NGINX) for the frontend.
• A “Frontend” block that is further decomposed into:
• Core & Shared Modules.
• Feature Modules (Pizzas, Orders, Countdown, etc.).
• State Management (NgRx Store, Actions & Effects).
• A “Backend” block that is subdivided into:
• API Layer (HTTP endpoints).
• WebSocket Service (real-time updates).
• Command-Line Interface (interactive admin commands like countdown settings).
• Business Logic/Modules (Models for pizzas, orders, ingredients, users, etc.).
• Helper Utilities.
• An “External Services” or “Pizza Providers” block that illustrates the backend’s task of parsing external provider websites.
• API Container (Dockerfile.api).
• NGINX Container (Dockerfile.nginx) acting as a static file server and reverse proxy.
• A “Docker Compose” element which coordinates both containers and their network links.
Final Assembly
• On a separate section “Deployment”, include the “Docker Compose” with nodes for API Container and NGINX Container and show how the NGINX container connects to the API container.