How amueed/vehicle-monitoring works
Main Components
• Frontend:
• Built with React (using Vite) and Material UI.
• Contains source directories for components, pages (notably the VehiclesPage), assets, models (Customer.ts, Vehicle.ts), services (VehicleService.ts), and configuration.
• Configured to run separately (with its own Dockerfile and Nginx config) and served at http://localhost:4200.
• Backend:
• Built with .NET Core Minimal API surrounded by a layered architecture.
• Divided into distinct sub-projects:
▪ VehicleMonitoring.Api – Contains the API entry point (Program.cs) and configuration files (appsettings.json, Docker configuration).
▪ VehicleMonitoring.Core – Houses domain models (Customer, Vehicle, BaseEntity), application services (e.g., IVehicleStatusService) and defines the domain logic or contracts.
▪ VehicleMonitoring.Infrastructure – Implements data access via EF Core (MonitoringDbContext), generic repositories, and dependency injection setup. This layer also includes a DatabaseSeeder for populating initial data.
• Exposes endpoints and API documentation through Swagger at http://localhost:8080/swagger/index.html.
• Database:
• While no standalone database service file is explicitly listed, the EF Core DbContext (MonitoringDbContext.cs) indicates that a database (SQL Server or another provider) is connected to the backend.
• Docker and Orchestration:
• Docker-related files (Dockerfiles for backend and frontend, docker-compose.yaml) indicate that both components are containerized and managed by Docker Compose.
Component Relationships and Interactions
• The Frontend interacts with the Backend via RESTful API calls (using HTTP) to perform vehicle monitoring and customer operations.
• The Backend’s API layer accepts requests and delegates business logic calls to the Core (application services and domain models), then utilizes the Infrastructure layer for data persistence.
• The Infrastructure layer directly interacts with the database (via EF Core) to retrieve, update, or seed data.
• Docker Compose orchestrates both the frontend and backend containers ensuring that they can communicate as needed and are deployed efficiently.
Architectural Patterns and Design Principles
• Layered Architecture: The backend is clearly organized into presentation (API), business logic (Core with domain models and services), and data access (Infrastructure) layers.
• Minimal API: Used in .NET Core for a lean, concise entry point into the backend.
• Separation of Concerns: Different responsibilities are split across multiple projects/modules (standard .NET project structure).
• Containerization: Dockerfiles for each component provide isolation and ease of deployment and scaling.
• Infrastructure to a “Database” symbol.