# doctorloan/doctorloan-webapi architecture

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

- Interactive diagram: https://gitdiagram.com/doctorloan/doctorloan-webapi
- Repository: https://github.com/doctorloan/doctorloan-webapi

## Overview

##### Project type and purpose
- From the file tree (only README.md) and the README title “DOCTORLOAN-WebAPI” with description “Web Api Management,” we infer this is a standalone Web API service whose responsibility is to manage doctor loan operations (CRUD, approval, tracking, etc.).
- No frontend code is present, so this is purely a backend/API‐only project.

##### File structure
· src/
– Controllers/
– Services/
– Repositories/ (data access)
– Models/
– Middleware/ (authentication, logging)
· tests/
· docs/
· config/ (DB configs, environment settings)

##### README for additional insights
- The README doesn’t yet specify frameworks or dependencies. When you choose a framework (e.g., ASP.NET Core, Node.js/Express, Spring Boot), update the README to mention key architectural decisions (authentication method, API versioning, data store).

##### Elements
· Rectangles for internal components (controllers, services, repos).
· Parallelogram for external services.

## Diagram (Mermaid)

```mermaid
flowchart TD
    %% Project Documentation
    subgraph "Project Documentation"
        README["README.md"]:::doc
    end

    %% Client
    Client[(Client)]:::external

    %% Infrastructure
    subgraph "Infrastructure"
        Config[(Config Service)]:::infra
        Docker[(Docker / Container)]:::infra
        CICD[(CI/CD Pipeline)]:::infra
    end

    %% API Layer
    subgraph "API Layer"
        Controllers["/loan (Controllers)"]:::api
        Auth["Auth Middleware (JWT)"]:::api
    end

    %% Business Logic Layer
    subgraph "Business Logic Layer"
        LoanService["LoanService"]:::service
    end

    %% Data Layer
    subgraph "Data Layer"
        LoanRepo["LoanRepository"]:::data
        DB["[(PostgreSQL)]"]:::database
    end

    %% External Services
    subgraph "External Services"
        CreditCheck["/ CreditCheck API /"]:::external
        Email["\\ Email Service \\"]:::external
    end

    %% Monitoring & Logging
    subgraph "Monitoring & Logging"
        Prom["Prometheus"]:::infra
        ELK["ELK Stack"]:::infra
    end

    %% Connections
    Client -->|"HTTP Request"| Controllers
    Controllers -->|"JWT validation"| Auth
    Auth -->|"calls Service"| LoanService
    LoanService -->|"reads/writes"| LoanRepo
    LoanRepo -->|"SQL Query"| DB

    LoanService -->|"external API call"| CreditCheck
    LoanService -->|"send email"| Email

    Controllers -->|"metrics/logs"| Prom
    Auth -->|"metrics/logs"| Prom
    LoanService -->|"metrics/logs"| Prom
    LoanRepo -->|"metrics/logs"| Prom

    Controllers -->|"metrics/logs"| ELK
    Auth -->|"metrics/logs"| ELK
    LoanService -->|"metrics/logs"| ELK
    LoanRepo -->|"metrics/logs"| ELK

    Config --> Controllers
    Config --> Auth
    Config --> LoanService
    Config --> LoanRepo

    CICD --> Docker
    Docker --> Controllers

    %% Click Events
    click README "https://github.com/doctorloan/doctorloan-webapi/blob/main/README.md"

    %% Styles
    classDef api fill:#D0E6FF,stroke:#0066CC
    classDef service fill:#E6FDD0,stroke:#33AA00
    classDef data fill:#FFE6D0,stroke:#CC6600
    classDef database fill:#F0F0F0,stroke:#999999,stroke-dasharray:5 5
    classDef external fill:#FDE6FF,stroke:#CC00AA
    classDef infra fill:#F2F2F2,stroke:#666666
    classDef doc fill:#FFFFE0,stroke:#CCCC66
```
