# ivoiliev0394/logisticmanagementapp architecture

> Architecture diagram of the GitHub repository ivoiliev0394/logisticmanagementapp, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-05-28). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/ivoiliev0394/logisticmanagementapp
- Repository: https://github.com/ivoiliev0394/logisticmanagementapp

## Overview

1. **Overall shape**
   This is a layered ASP.NET Core MVC application built around a rich logistics domain. The runtime entry point is `Program.cs`, which wires MVC, Identity, EF Core persistence, custom model binding, and the application services used by controllers and views.

2. **Presentation boundary**
   The UI layer is classic MVC: controllers in `Controllers/`, Razor views in `Views/`, shared layout/components in `Views/Shared/`, and Identity UI in `Areas/Identity/`. There are no standalone frontend or API tiers in this repo; the browser talks directly to MVC actions that return views and form posts.

3. **Functional portals**
   The application is organized by business portal rather than by technical layer:
   - `AdminController` and `Views/Admin` for system administration and reporting
   - `AuthController` and `Views/Auth` for login/register/access control
   - `ClientPortalController` and `Views/ClientPortal` for client self-service
   - `CompanyController` split across many partial files for the main operational portal
   This is the main UI boundary for an architecture diagram: one web app with multiple role-based workspaces.

4. **Application layer**
   The `Application/Services` folder contains the business use-case layer. Services are exposed via interfaces in `Application/Interfaces` and consumed by controllers. This layer coordinates validation, reads/writes entities, shapes data into view models, and encapsulates portal-specific logic such as auth, home/dashboard, client address management, company CRUD, logistics workflows, and sequential number generation.

5. **Domain model**
   The `Domain/` tree is the core of the system and is highly logistics-specific. It includes:
   - **Companies / clients**: company profiles, branches, contacts, client addresses
   - **Shipments / orders / operations**: shipments, legs, containers, packages, parties, tracking events, bookings, consolidations
   - **Assets by transport mode**: air, road, rail, sea, plus cargo units
   - **Routes and planning**: routes, route plans, assignments, capacity, calendars, utilization
   - **Billing and pricing**: invoices, payments, charges, tariffs, surcharges, quotes, taxes
   - **Compliance and documents**: dangerous goods, temperature requirements, document versions, file resources
   - **Identity and security**: application users, roles, sessions
   The domain is entity-heavy, suggesting most screens are CRUD and workflow screens over EF Core entities.

6. **Persistence layer**
   `Infrastructure/Persistence/LogisticAppDbContext.cs` is the central data access boundary. The database model is configured through many EF Core configuration classes under `Infrastructure/Persistence/Configurations/`, matching the domain structure one-to-one. Migrations are present, so schema changes are managed by EF Core. The README says SQL Server is the target database, and the repo structure strongly supports that.

7. **Seed and bootstrapping data**
   The `Infrastructure/Persistence/Seed/` tree contains extensive seeders for nearly every module: companies, users/roles, shipments, assets, billing, routes, compliance, operations, and locations. This means the app likely depends on seeded reference data to make the portals usable immediately after initialization. A `SeedRunner` coordinates the seeding process.

8. **Cross-cutting infrastructure**
   There are a few technical support pieces that affect how requests flow:
   - `SoftDeleteExtensions` for soft-delete behavior in persistence
   - `FlexibleDecimalModelBinder` and provider for culture-tolerant numeric input
   - static JavaScript helpers in `wwwroot/js/` for auto-generated fields and decimal input fixes
   These indicate the app handles complex forms and data entry heavily.

9. **Security and identity**
   Authentication and authorization are built on ASP.NET Core Identity using custom `ApplicationUser`, `ApplicationRole`, and `RoleNames`. The presence of portal-specific controllers and Identity pages indicates role-based access control across admin, company, and client experiences. User sessions are also modeled in the domain, suggesting login/session auditing or session state tracking is part of the business logic.

10. **View models and UI composition**
    `Models/` contains extensive ViewModel classes grouped by portal and feature. These are the data contracts between services/controllers and Razor views. The separation is important: domain entities are not rendered directly; instead, the app projects them into portal-specific view models for forms, lists, and details pages.

11. **Routing and partial controllers**
    `CompanyController` is intentionally split into many partial files by subdomain area: assets, routes, operations, documents, compliance, billing, shared locations, and reports. The same pattern exists in the service layer. This makes the company portal the largest subsystem and suggests the architecture is modular by business capability rather than by technical tier.

12. **Testing boundary**
    `LogisticManagementApp.Tests` contains service-level tests and helpers for Identity and DbContext setup. The test suite focuses on application services and business behavior rather than UI rendering, which reinforces the architecture: controllers are thin, services do the work, and EF Core-backed data is exercised in tests.

13. **Deployment/runtime**
    The repo includes a Dockerfile and app settings for development plus service dependency metadata, so it is designed to run as a containerized .NET 8 web app backed by SQL Server. Static assets are served from `wwwroot`, and the UI stack uses Bootstrap, jQuery, and validation scripts for server-rendered forms.

14. **High-level data flow**
    A typical request path is: browser submits an MVC form or page request → controller action → application service interface/implementation → EF Core DbContext and entity configuration → SQL Server → service maps results into ViewModels → Razor view renders response. Identity flows follow the same web entry point but use ASP.NET Core Identity and role checks before reaching business actions.

Main entry points: [`LogisticManagementApp/LogisticManagementApp/Infrastructure/Persistence/LogisticAppDbContext.cs`](https://github.com/ivoiliev0394/logisticmanagementapp/blob/main/LogisticManagementApp/LogisticManagementApp/Infrastructure/Persistence/LogisticAppDbContext.cs) (DbContext), [`LogisticManagementApp/LogisticManagementApp/Application/Services/CompanyPortal/CompanyPortalService.cs`](https://github.com/ivoiliev0394/logisticmanagementapp/blob/main/LogisticManagementApp/LogisticManagementApp/Application/Services/CompanyPortal/CompanyPortalService.cs) (Company Service), [`LogisticManagementApp/LogisticManagementApp/Program.cs`](https://github.com/ivoiliev0394/logisticmanagementapp/blob/main/LogisticManagementApp/LogisticManagementApp/Program.cs) (Program), [`LogisticManagementApp/LogisticManagementApp/Controllers`](https://github.com/ivoiliev0394/logisticmanagementapp/tree/main/LogisticManagementApp/LogisticManagementApp/Controllers) (Controllers)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_presentation["Presentation"]
  node_program(("Program<br/>host bootstrap<br/>[Program.cs]"))
  node_controllers["Controllers"]
  node_views["Razor Views<br/>mvc views"]
  node_identity_area["Identity Pages<br/>identity ui"]
  node_portal_models["View Models<br/>ui contracts"]
end

subgraph group_application["Application"]
  node_admin_service["Admin Service<br/>admin use-case"]
  node_auth_service["Auth Service<br/>auth use-case<br/>[AuthService.cs]"]
  node_client_services["Client Services<br/>client portal use-cases"]
  node_company_service["Company Service<br/>portal use-cases"]
  node_home_service["Home Service<br/>dashboard use-case<br/>[HomeService.cs]"]
  node_seq_number["Numbering<br/>utility service"]
  node_interfaces["Service Interfaces<br/>abstractions"]
end

subgraph group_domain["Domain"]
  node_domain_core{{"Logistics Domain<br/>entities"}}
  node_ships_ops["Shipments & Ops<br/>domain cluster"]
  node_assets["Transport Assets<br/>domain cluster"]
  node_commercial["Commercial<br/>domain cluster"]
  node_company_domain["Company Profiles<br/>domain cluster"]
end

subgraph group_persistence["Persistence"]
  node_infra_db[("DbContext<br/>ef core context")]
  node_ef_configs["EF Configs<br/>entity mappings"]
  node_seed_runner["Seed Runner<br/>bootstrap data<br/>[SeedRunner.cs]"]
  node_migrations["Migrations<br/>schema history"]
end

subgraph group_tests["Tests"]
  node_tests_proj["Service Tests<br/>test project"]
end

node_program -->|"registers MVC"| node_controllers
node_program -->|"registers services"| node_interfaces
node_program -->|"configures EF Core"| node_infra_db
node_program -->|"enables identity"| node_identity_area
node_controllers -->|"depends on"| node_interfaces
node_controllers -->|"binds view models"| node_portal_models
node_controllers -->|"renders"| node_views
node_identity_area -.->|"shares auth flow"| node_auth_service
node_admin_service -->|"reads/writes"| node_infra_db
node_auth_service -->|"reads/writes"| node_infra_db
node_client_services -->|"reads/writes"| node_infra_db
node_company_service -->|"reads/writes"| node_infra_db
node_home_service -->|"queries"| node_infra_db
node_seq_number -.->|"supports"| node_company_service
node_infra_db -->|"uses mappings"| node_ef_configs
node_infra_db -->|"evolves schema"| node_migrations
node_seed_runner -->|"seeds data"| node_infra_db
node_seed_runner -.->|"materializes"| node_domain_core
node_company_service -->|"manages"| node_assets
node_company_service -->|"manages"| node_ships_ops
node_company_service -->|"manages"| node_commercial
node_company_service -->|"manages"| node_company_domain
node_company_service -->|"coordinates"| node_domain_core
node_tests_proj -->|"verifies"| node_interfaces
node_tests_proj -.->|"uses test db"| node_infra_db

click node_program "https://github.com/ivoiliev0394/logisticmanagementapp/blob/main/LogisticManagementApp/LogisticManagementApp/Program.cs"
click node_controllers "https://github.com/ivoiliev0394/logisticmanagementapp/tree/main/LogisticManagementApp/LogisticManagementApp/Controllers"
click node_views "https://github.com/ivoiliev0394/logisticmanagementapp/tree/main/LogisticManagementApp/LogisticManagementApp/Views"
click node_identity_area "https://github.com/ivoiliev0394/logisticmanagementapp/tree/main/LogisticManagementApp/LogisticManagementApp/Areas/Identity"
click node_portal_models "https://github.com/ivoiliev0394/logisticmanagementapp/tree/main/LogisticManagementApp/LogisticManagementApp/Models"
click node_admin_service "https://github.com/ivoiliev0394/logisticmanagementapp/blob/main/LogisticManagementApp/LogisticManagementApp/Application/Services/AdminPortal/AdminCrudService.cs"
click node_auth_service "https://github.com/ivoiliev0394/logisticmanagementapp/blob/main/LogisticManagementApp/LogisticManagementApp/Application/Services/Auth/AuthService.cs"
click node_client_services "https://github.com/ivoiliev0394/logisticmanagementapp/tree/main/LogisticManagementApp/LogisticManagementApp/Application/Services/ClientPortal"
click node_company_service "https://github.com/ivoiliev0394/logisticmanagementapp/blob/main/LogisticManagementApp/LogisticManagementApp/Application/Services/CompanyPortal/CompanyPortalService.cs"
click node_home_service "https://github.com/ivoiliev0394/logisticmanagementapp/blob/main/LogisticManagementApp/LogisticManagementApp/Application/Services/HomeService.cs"
click node_seq_number "https://github.com/ivoiliev0394/logisticmanagementapp/blob/main/LogisticManagementApp/LogisticManagementApp/Application/Services/SequentialNumberGenerator.cs"
click node_interfaces "https://github.com/ivoiliev0394/logisticmanagementapp/tree/main/LogisticManagementApp/LogisticManagementApp/Application/Interfaces"
click node_domain_core "https://github.com/ivoiliev0394/logisticmanagementapp/tree/main/LogisticManagementApp/LogisticManagementApp/Domain"
click node_ships_ops "https://github.com/ivoiliev0394/logisticmanagementapp/tree/main/LogisticManagementApp/LogisticManagementApp/Domain/Shipments"
click node_assets "https://github.com/ivoiliev0394/logisticmanagementapp/tree/main/LogisticManagementApp/LogisticManagementApp/Domain/Assets"
click node_commercial "https://github.com/ivoiliev0394/logisticmanagementapp/tree/main/LogisticManagementApp/LogisticManagementApp/Domain/Billing"
click node_company_domain "https://github.com/ivoiliev0394/logisticmanagementapp/tree/main/LogisticManagementApp/LogisticManagementApp/Domain/Companies"
click node_infra_db "https://github.com/ivoiliev0394/logisticmanagementapp/blob/main/LogisticManagementApp/LogisticManagementApp/Infrastructure/Persistence/LogisticAppDbContext.cs"
click node_ef_configs "https://github.com/ivoiliev0394/logisticmanagementapp/tree/main/LogisticManagementApp/LogisticManagementApp/Infrastructure/Persistence/Configurations"
click node_seed_runner "https://github.com/ivoiliev0394/logisticmanagementapp/blob/main/LogisticManagementApp/LogisticManagementApp/Infrastructure/Persistence/Seed/SeedRunner.cs"
click node_migrations "https://github.com/ivoiliev0394/logisticmanagementapp/tree/main/LogisticManagementApp/LogisticManagementApp/Infrastructure/Persistence/Migrations"
click node_tests_proj "https://github.com/ivoiliev0394/logisticmanagementapp/blob/main/LogisticManagementApp/LogisticManagementApp.Tests"

classDef toneNeutral fill:#f8fafc,stroke:#334155,stroke-width:1.5px,color:#0f172a
classDef toneBlue fill:#dbeafe,stroke:#2563eb,stroke-width:1.5px,color:#172554
classDef toneAmber fill:#fef3c7,stroke:#d97706,stroke-width:1.5px,color:#78350f
classDef toneMint fill:#dcfce7,stroke:#16a34a,stroke-width:1.5px,color:#14532d
classDef toneRose fill:#ffe4e6,stroke:#e11d48,stroke-width:1.5px,color:#881337
classDef toneIndigo fill:#e0e7ff,stroke:#4f46e5,stroke-width:1.5px,color:#312e81
classDef toneTeal fill:#ccfbf1,stroke:#0f766e,stroke-width:1.5px,color:#134e4a
class node_program,node_controllers,node_views,node_identity_area,node_portal_models toneBlue
class node_admin_service,node_auth_service,node_client_services,node_company_service,node_home_service,node_seq_number,node_interfaces toneAmber
class node_domain_core,node_ships_ops,node_assets,node_commercial,node_company_domain toneMint
class node_infra_db,node_ef_configs,node_seed_runner,node_migrations toneRose
class node_tests_proj toneIndigo
```

## Components

### Presentation

MVC UI, role portals, and shared Razor composition.

- [Program](https://github.com/ivoiliev0394/logisticmanagementapp/blob/main/LogisticManagementApp/LogisticManagementApp/Program.cs): host bootstrap · Wires MVC, Identity, EF Core, model binding, and app services. · `LogisticManagementApp/LogisticManagementApp/Program.cs`
- [Controllers](https://github.com/ivoiliev0394/logisticmanagementapp/tree/main/LogisticManagementApp/LogisticManagementApp/Controllers): mvc controllers · Role-based MVC entry points for admin, auth, client, company, home, and errors. · `LogisticManagementApp/LogisticManagementApp/Controllers`
- [Razor Views](https://github.com/ivoiliev0394/logisticmanagementapp/tree/main/LogisticManagementApp/LogisticManagementApp/Views): mvc views · Server-rendered pages for the portals and shared layout/components. · `LogisticManagementApp/LogisticManagementApp/Views`
- [Identity Pages](https://github.com/ivoiliev0394/logisticmanagementapp/tree/main/LogisticManagementApp/LogisticManagementApp/Areas/Identity): identity ui · ASP.NET Core Identity pages and account management UI. · `LogisticManagementApp/LogisticManagementApp/Areas/Identity`
- [View Models](https://github.com/ivoiliev0394/logisticmanagementapp/tree/main/LogisticManagementApp/LogisticManagementApp/Models): ui contracts · Portal-specific data contracts used between services, controllers, and views. · `LogisticManagementApp/LogisticManagementApp/Models`

### Application

Use-case services and interfaces consumed by controllers.

- [Admin Service](https://github.com/ivoiliev0394/logisticmanagementapp/blob/main/LogisticManagementApp/LogisticManagementApp/Application/Services/AdminPortal/AdminCrudService.cs): admin use-case · Administrative CRUD and reporting use cases. · `LogisticManagementApp/LogisticManagementApp/Application/Services/AdminPortal/AdminCrudService.cs`
- [Auth Service](https://github.com/ivoiliev0394/logisticmanagementapp/blob/main/LogisticManagementApp/LogisticManagementApp/Application/Services/Auth/AuthService.cs): auth use-case · Login, registration, and access-control workflows. · `LogisticManagementApp/LogisticManagementApp/Application/Services/Auth/AuthService.cs`
- [Client Services](https://github.com/ivoiliev0394/logisticmanagementapp/tree/main/LogisticManagementApp/LogisticManagementApp/Application/Services/ClientPortal): client portal use-cases · Client dashboard and address-management workflows. · `LogisticManagementApp/LogisticManagementApp/Application/Services/ClientPortal`
- [Company Service](https://github.com/ivoiliev0394/logisticmanagementapp/blob/main/LogisticManagementApp/LogisticManagementApp/Application/Services/CompanyPortal/CompanyPortalService.cs): portal use-cases · Large company portal service split across assets, routes, operations, documents, and billing. · `LogisticManagementApp/LogisticManagementApp/Application/Services/CompanyPortal/CompanyPortalService.cs`
- [Home Service](https://github.com/ivoiliev0394/logisticmanagementapp/blob/main/LogisticManagementApp/LogisticManagementApp/Application/Services/HomeService.cs): dashboard use-case · Home and dashboard composition for role-specific landing pages. · `LogisticManagementApp/LogisticManagementApp/Application/Services/HomeService.cs`
- [Numbering](https://github.com/ivoiliev0394/logisticmanagementapp/blob/main/LogisticManagementApp/LogisticManagementApp/Application/Services/SequentialNumberGenerator.cs): utility service · Sequential number generation used by portal workflows. · `LogisticManagementApp/LogisticManagementApp/Application/Services/SequentialNumberGenerator.cs`
- [Service Interfaces](https://github.com/ivoiliev0394/logisticmanagementapp/tree/main/LogisticManagementApp/LogisticManagementApp/Application/Interfaces): abstractions · Application service contracts consumed by controllers and tests. · `LogisticManagementApp/LogisticManagementApp/Application/Interfaces`

### Domain

Core logistics entities and business concepts.

- [Logistics Domain](https://github.com/ivoiliev0394/logisticmanagementapp/tree/main/LogisticManagementApp/LogisticManagementApp/Domain): entities · Core company, shipment, routing, billing, compliance, location, and identity entities. · `LogisticManagementApp/LogisticManagementApp/Domain`
- [Shipments & Ops](https://github.com/ivoiliev0394/logisticmanagementapp/tree/main/LogisticManagementApp/LogisticManagementApp/Domain/Shipments): domain cluster · Shipments, legs, bookings, consolidations, planning, tracking, and notifications. · `LogisticManagementApp/LogisticManagementApp/Domain/Shipments`
- [Transport Assets](https://github.com/ivoiliev0394/logisticmanagementapp/tree/main/LogisticManagementApp/LogisticManagementApp/Domain/Assets): domain cluster · Air, road, rail, sea, and cargo-unit assets. · `LogisticManagementApp/LogisticManagementApp/Domain/Assets`
- [Commercial](https://github.com/ivoiliev0394/logisticmanagementapp/tree/main/LogisticManagementApp/LogisticManagementApp/Domain/Billing): domain cluster · Orders, pricing, billing, invoices, payments, tariffs, and quotes. · `LogisticManagementApp/LogisticManagementApp/Domain/Billing`
- [Company Profiles](https://github.com/ivoiliev0394/logisticmanagementapp/tree/main/LogisticManagementApp/LogisticManagementApp/Domain/Companies): domain cluster · Companies, branches, contacts, and client addresses. · `LogisticManagementApp/LogisticManagementApp/Domain/Companies`

### Persistence

EF Core database context, configurations, migrations, and seeders.

- [DbContext](https://github.com/ivoiliev0394/logisticmanagementapp/blob/main/LogisticManagementApp/LogisticManagementApp/Infrastructure/Persistence/LogisticAppDbContext.cs): ef core context · Central persistence boundary for the application database. · `LogisticManagementApp/LogisticManagementApp/Infrastructure/Persistence/LogisticAppDbContext.cs`
- [EF Configs](https://github.com/ivoiliev0394/logisticmanagementapp/tree/main/LogisticManagementApp/LogisticManagementApp/Infrastructure/Persistence/Configurations): entity mappings · One-to-one EF Core configuration classes for domain entities. · `LogisticManagementApp/LogisticManagementApp/Infrastructure/Persistence/Configurations`
- [Seed Runner](https://github.com/ivoiliev0394/logisticmanagementapp/blob/main/LogisticManagementApp/LogisticManagementApp/Infrastructure/Persistence/Seed/SeedRunner.cs): bootstrap data · Coordinates broad reference and sample-data seeding. · `LogisticManagementApp/LogisticManagementApp/Infrastructure/Persistence/Seed/SeedRunner.cs`
- [Migrations](https://github.com/ivoiliev0394/logisticmanagementapp/tree/main/LogisticManagementApp/LogisticManagementApp/Infrastructure/Persistence/Migrations): schema history · EF Core migrations and model snapshot. · `LogisticManagementApp/LogisticManagementApp/Infrastructure/Persistence/Migrations`

### Tests

Service-focused test project.

- [Service Tests](https://github.com/ivoiliev0394/logisticmanagementapp/blob/main/LogisticManagementApp/LogisticManagementApp.Tests): test project · Tests for application services and supporting identity/DbContext helpers. · `LogisticManagementApp/LogisticManagementApp.Tests`

## Connections

- Program → Controllers: registers MVC · Application startup wires request handling and dependencies.
- Program → Service Interfaces: registers services · Startup binds service contracts to implementations.
- Program → DbContext: configures EF Core · Startup connects persistence and database options.
- Program → Identity Pages: enables identity · Startup activates authentication and identity UI.
- Controllers → Service Interfaces: depends on · Controllers call through service abstractions.
- Controllers → View Models: binds view models · Actions map inputs and outputs through portal-specific models.
- Controllers → Razor Views: renders · MVC actions return Razor views and form responses.
- Identity Pages → Auth Service: shares auth flow · Identity UI complements the app's authentication workflows.
- Admin Service → DbContext: reads/writes · Admin use cases work against EF-backed persistence.
- Auth Service → DbContext: reads/writes · Authentication workflows interact with persisted users and roles.
- Client Services → DbContext: reads/writes · Client portal actions persist addresses and related data.
- Company Service → DbContext: reads/writes · Main portal workflows operate over the logistics database.
- Home Service → DbContext: queries · Dashboards aggregate data from persisted entities.
- Numbering → Company Service: supports · Sequential numbers support company workflow creation.
- DbContext → EF Configs: uses mappings · DbContext is shaped by entity configuration classes.
- DbContext → Migrations: evolves schema · Migrations capture database changes over time.
- Seed Runner → DbContext: seeds data · Bootstrap data is inserted through the DbContext.
- Seed Runner → Logistics Domain: materializes · Seeders populate the major logistics entities.
- Company Service → Transport Assets: manages · Company portal covers air, road, rail, sea, and cargo assets.
- Company Service → Shipments & Ops: manages · Company portal covers shipments, tracking, and operational workflows.
- Company Service → Commercial: manages · Company portal includes billing, pricing, and commercial records.
- Company Service → Company Profiles: manages · Company portal includes profiles, branches, contacts, and clients.
- Company Service → Logistics Domain: coordinates · Portal logic composes and updates logistics domain entities.
- Service Tests → Service Interfaces: verifies · Tests target service contracts and use-case behavior.
- Service Tests → DbContext: uses test db · Test helpers stand up an EF Core-backed test context.
