How nhat-tien/ipm works
Main Components Identification
• Frontend Client: Represented by the IPM.ClientApp folder, a Svelte-based application that contains components, routes, services, and use cases to render the UI.
• Web API / Backend Gateway: The IPM.WebApi project acts as the API layer. It exposes RESTful endpoints (see ApiEndpoints, Controllers, Validators, etc.) and integrates with other backend layers.
• Application Layer: Located in the IPM.Application project, this layer holds the use cases, business logic, repositories’ interfaces, unit-of-work abstractions, services (like authentication and email), and utility classes. It orchestrates the business rules.
• Domain Layer: Found in the IPM.Domain project, where the core business entities (such as AffiliatedUnit, AidType, Project, User, etc.) are defined. This is where your business models and domain logic reside.
• Infrastructure/Data Access Layer: The IPM.Infrastructure project implements data access using Entity Framework Core. It includes the DB Context, repository implementations, database configurations, migrations, and unit-of-work implementations.
• Database: The system is designed to use PostgreSQL, as indicated in the README and configured by the EF Core migrations.
• External Services/Utilities: Although not a separate project, note the integration with external systems like email services, Minio (for file storage), and possibly JWT authentication. These are wired in via service registers and custom services in the WebApi layer.
• Docker Components: The Dockerfile and docker-compose.yml show that containerization is used for the deployment or development environment.
Relationships & Interactions
• The Frontend (Svelte) communicates with the Web API through HTTP REST endpoints.
• The Web API then invokes handlers in the Application Layer (use cases) for business operations.
• The Application Layer uses repository interfaces and unit-of-work abstractions to access and manipulate data.
• The Infrastructure Layer provides concrete implementations of these interfaces, and communicates directly with the PostgreSQL database using Entity Framework Core.
• Additional services such as authentication, email, and file handling are integrated in the Web API layer and further support the overall operations.
• Docker is used to encapsulate and manage services, such as spinning up database containers and possibly API containers.
Architectural Patterns & Design Principles
• Adopts a layered (clean) architecture that decouples business logic, infrastructure concerns, and presentation (UI).
• Employs dependency inversion by defining interfaces in the Application layer while using concrete implementations in Infrastructure.
• Uses use case (or command/query) based organization within the Application layer, which can be clearly represented as individual “business process” blocks.
• Separation of concerns with distinct routing (Frontend pages, API endpoints), business logic (Application use cases), and data persistence (Infrastructure/EF Core).
Relevant Technologies/Frameworks
• Backend: .NET Core 8.0, Entity Framework Core, ASP.NET Core Web API.
• Frontend: Svelte, NodeJS (v20+), Vite.
• Database: PostgreSQL.
• Containerization: Docker, Docker Compose.
• Additional Libraries: JWT authentication, Email Service implementations, and supporting middleware/filters.