# udit-mimani/lendermatchplatform architecture

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

- Interactive diagram: https://gitdiagram.com/udit-mimani/lendermatchplatform
- Repository: https://github.com/udit-mimani/lendermatchplatform

## Overview

##### Project Type and Purpose
- This is a full-stack web application called **LenderMatch AI**.
- Purpose: match equipment finance loan applications to eligible lenders and programs, calculate fit scores, explain rejections, and persist/rerun applications.

##### File Structure Analysis
- Top-level folders:
- LenderMatch.API/ – .NET 8 Web API (Controllers, Services, Data, Entities, Migrations, config, Dockerfile)
- client/ – React 19 + TypeScript + Vite frontend (src, public, Dockerfile, nginx.conf, lint & TS configs)
- docker-compose.yml – orchestrates api, client (with Nginx proxy), and PostgreSQL 15
- LenderMatch.slnx – Visual Studio solution
- Architectural patterns: layered backend (Controller → Service → DbContext/Entities), SPA front-end served via Nginx, containerized with Docker Compose.

##### Key Insights from README
- CLIENT (React+TS) on port 3000 behind Nginx
- API (ASP.NET Core Web API + EF Core) on port 8080
- PostgreSQL database on port 5432
- REST endpoints in MatchController invoke MatchingService which uses EF Core to query/persist data.

a. Main Components
- User’s Browser / React SPA (port 3000)
- Nginx reverse-proxy + static server
- ASP.NET Core Web API (port 8080)
- MatchingService (business logic layer)
- EF Core / AppDbContext (data access layer)
- PostgreSQL database (port 5432)
- Docker Compose (orchestration)

b. Relationships & Data Flow
1. User interacts with React UI →
2. React issues HTTP/REST calls to Nginx →
3. Nginx forwards `/api/*` to .NET API (other paths serve static assets) →
4. MatchController validates input, calls MatchingService →
5. MatchingService derives features, applies lender/program rules →
6. EF Core persists/retrieves data via Npgsql to PostgreSQL →
7. API returns JSON results to React →
8. React renders match results or dashboards.

c. Architectural Patterns & Principles
- Layered architecture (Presentation → API/Controllers → Services → Data Access)
- Single Page Application (SPA) front-end separated from backend
- Containerized deployment with Docker Compose (loose coupling, easy scaling)
- Configuration via environment variables and appsettings.json
- Infrastructure as code for local vs. production (docker-compose.yml, launchSettings.json)

d. Relevant Technologies
- Frontend: React 19, TypeScript, Vite, Tailwind CSS, Axios
- Backend: .NET 8, ASP.NET Core Web API, EF Core 8, Npgsql
- Database: PostgreSQL 15
- DevOps: Docker, Docker Compose, Nginx

## Diagram (Mermaid)

```mermaid
flowchart TD
    subgraph "Docker Compose" 
        direction TB
        style DockerCompose fill:#cccccc,stroke:#333,stroke-width:1px
        DockerCompose["Docker Compose"]:::orchestration

        subgraph "Frontend Container"
            direction TB
            NGINX["Nginx Proxy & Static Server"]:::orchestration
            ReactSPA["React SPA"]:::frontend
            AppComp["React App Component"]:::frontend
            Assets["Static Assets & Styling"]:::frontend
            Config["Vite & TypeScript Config"]:::frontend
            FrontendDocker["Frontend Dockerfile"]:::orchestration
            NginxConf["Nginx Config"]:::orchestration
        end

        subgraph "API Container"
            direction TB
            API["ASP.NET Core Web API"]:::backend
            MC["MatchController"]:::backend
            MS["MatchingService"]:::backend
            DBCTX["AppDbContext"]:::backend
            Seeder["Database Seeding Utilities"]:::backend
            Entities["Entity Models"]:::backend
            Migrations["EF Core Migrations"]:::backend
            APIConfig["API Config & Launch Settings"]:::backend
            APIDocker["API Dockerfile"]:::orchestration
        end

        subgraph "PostgreSQL Container"
            direction TB
            Postgres["PostgreSQL"]:::database
        end

        DockerCompose -->|"orchestrates"| FrontendContainer((Frontend Container))
        DockerCompose -->|"orchestrates"| APIContainer((API Container))
        DockerCompose -->|"orchestrates"| PostgreSQLContainer((PostgreSQL Container))
    end

    ReactSPA -->|"serves static"| NGINX
    NGINX -->|"HTTP/REST"| API
    API -->|"invokes"| MC
    MC -->|"calls"| MS
    MS -->|"uses"| DBCTX
    DBCTX -->|"SQL/Npgsql"| Postgres
    Postgres -->|"data"| DBCTX
    ReactSPA -->|"renders via"| AppComp
    ReactSPA -->|"loads assets from"| Assets

    %% Click Events
    click ReactSPA "https://github.com/udit-mimani/lendermatchplatform/blob/main/client/src/main.tsx"
    click AppComp "https://github.com/udit-mimani/lendermatchplatform/blob/main/client/src/App.tsx"
    click Assets "https://github.com/udit-mimani/lendermatchplatform/tree/main/client/src/assets"
    click Assets "https://github.com/udit-mimani/lendermatchplatform/blob/main/client/src/App.css"
    click Assets "https://github.com/udit-mimani/lendermatchplatform/blob/main/client/src/index.css"
    click Config "https://github.com/udit-mimani/lendermatchplatform/blob/main/client/vite.config.ts"
    click Config "https://github.com/udit-mimani/lendermatchplatform/blob/main/client/tsconfig.json"
    click Config "https://github.com/udit-mimani/lendermatchplatform/blob/main/client/tsconfig.app.json"
    click Config "https://github.com/udit-mimani/lendermatchplatform/blob/main/client/tsconfig.node.json"
    click FrontendDocker "https://github.com/udit-mimani/lendermatchplatform/tree/main/client/Dockerfile"
    click NginxConf "https://github.com/udit-mimani/lendermatchplatform/blob/main/client/nginx.conf"
    click DockerCompose "https://github.com/udit-mimani/lendermatchplatform/blob/main/docker-compose.yml"
    click MC "https://github.com/udit-mimani/lendermatchplatform/blob/main/LenderMatch.API/Controllers/MatchController.cs"
    click MS "https://github.com/udit-mimani/lendermatchplatform/blob/main/LenderMatch.API/Services/MatchingService.cs"
    click DBCTX "https://github.com/udit-mimani/lendermatchplatform/blob/main/LenderMatch.API/Data/AppDbContext.cs"
    click Seeder "https://github.com/udit-mimani/lendermatchplatform/blob/main/LenderMatch.API/Data/DbSeeder.cs"
    click Seeder "https://github.com/udit-mimani/lendermatchplatform/blob/main/LenderMatch.API/TestData/ExampleApplications.cs"
    click Entities "https://github.com/udit-mimani/lendermatchplatform/blob/main/LenderMatch.API/Entities/Models.cs"
    click Migrations "https://github.com/udit-mimani/lendermatchplatform/tree/main/LenderMatch.API/Migrations/"
    click APIConfig "https://github.com/udit-mimani/lendermatchplatform/blob/main/LenderMatch.API/appsettings.json"
    click APIConfig "https://github.com/udit-mimani/lendermatchplatform/blob/main/LenderMatch.API/appsettings.Development.json"
    click APIConfig "https://github.com/udit-mimani/lendermatchplatform/blob/main/LenderMatch.API/Properties/launchSettings.json"
    click APIDocker "https://github.com/udit-mimani/lendermatchplatform/tree/main/LenderMatch.API/Dockerfile"
    click DockerCompose "https://github.com/udit-mimani/lendermatchplatform/blob/main/docker-compose.yml"

    classDef frontend fill:#bbdefb,stroke:#1e88e5,stroke-width:1px;
    classDef backend fill:#e1bee7,stroke:#8e24aa,stroke-width:1px;
    classDef database fill:#c8e6c9,stroke:#43a047,stroke-width:1px;
    classDef orchestration fill:#f5f5f5,stroke:#757575,stroke-width:1px;
```
