# josephayo/bibliotheque-e-backend architecture

> Architecture diagram of the GitHub repository josephayo/bibliotheque-e-backend, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2025-01-20). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/josephayo/bibliotheque-e-backend
- Repository: https://github.com/josephayo/bibliotheque-e-backend

## Overview

##### Main Components Identification
The system should be represented with these key components:

a) API Layer
- FastAPI application (evident from the structure and routers)
- Two main route groups: Library and User operations

b) Business Logic Layer
- Repository pattern implementation
- Authentication and authorization services
- Book management services
- User management services
- Curation services

c) Data Layer
- Database (likely SQL based on the models structure)
- Model relationships
- Enums and constants

d) Support Services
- Job scheduler (for reminders)
- Email service
- Helpers and utilities

**[Client Applications]**
- ↓ ↑
**[API Gateway Layer (FastAPI)]**
- ↓ ↑
**[Business Logic Layer]**
- ↓ ↑
**[Data Access Layer]**
- ↓ ↑
**[Database]**

##### Key Relationships to Emphasize

- User authentication and authorization flow
- Book check-in/check-out process
- Curation system
- Notification system
- Reminder job scheduling

##### Technical Stack Indicators

Technology badges for:
- FastAPI
- SQL Database
- Python 3.12
- Authentication mechanism

## Diagram (Mermaid)

```mermaid
flowchart TB
    subgraph Client
        C[Client Applications]
    end

    subgraph API
        FA["FastAPI Application"]:::api
        LR["Library Routes"]:::api
        UR["User Routes"]:::api
        AM["Auth Middleware"]:::api
    end

    subgraph Business
        AS["Authentication Service"]:::service
        BS["Book Service"]:::service
        US["User Service"]:::service
        CS["Curation Service"]:::service
        GS["Genre Service"]:::service
        CIS["Check In/Out Service"]:::service
    end

    subgraph Data
        DB[(Database)]:::db
        subgraph Models
            BM["Book Model"]:::model
            UM["User Model"]:::model
            RM["Role Model"]:::model
            PM["Permission Model"]:::model
            CM["Curation Model"]:::model
            CIM["Check In/Out Model"]:::model
        end
    end

    subgraph Support
        RJ["Reminder Job ⏰"]:::support
        ES["Email Service"]:::support
        ET["Email Templates"]:::support
        DH["DateTime Helper"]:::support
    end

    %% Relationships
    C <--> FA
    FA --> LR & UR
    LR & UR --> AM
    
    AM --> AS
    AS --> US
    BS --> BM
    US --> UM
    CS --> CM
    GS --> BM
    CIS --> CIM

    RJ --> ES
    ES --> ET
    
    %% Model Relationships
    UM <--> RM
    RM <--> PM
    BM <--> CM
    UM <--> CIM
    CIM <--> BM

    %% Styling
    classDef api fill:#2196F3,stroke:#1565C0,color:white
    classDef service fill:#4CAF50,stroke:#2E7D32,color:white
    classDef model fill:#FFC107,stroke:#FFA000,color:black
    classDef db fill:#795548,stroke:#5D4037,color:white
    classDef support fill:#9C27B0,stroke:#7B1FA2,color:white

    %% Click Events
    click FA "https://github.com/josephAyo/bibliotheque-e-backend/blob/main/app/main.py"
    click LR "https://github.com/josephAyo/bibliotheque-e-backend/blob/main/app/routers/library.py"
    click UR "https://github.com/josephAyo/bibliotheque-e-backend/blob/main/app/routers/user.py"
    click AS "https://github.com/josephAyo/bibliotheque-e-backend/blob/main/app/repository/authentication.py"
    click BS "https://github.com/josephAyo/bibliotheque-e-backend/blob/main/app/repository/book.py"
    click US "https://github.com/josephAyo/bibliotheque-e-backend/blob/main/app/repository/user.py"
    click CS "https://github.com/josephAyo/bibliotheque-e-backend/blob/main/app/repository/curation.py"
    click GS "https://github.com/josephAyo/bibliotheque-e-backend/blob/main/app/repository/genre.py"
    click CIS "https://github.com/josephAyo/bibliotheque-e-backend/blob/main/app/repository/check_in_out.py"
    click BM "https://github.com/josephAyo/bibliotheque-e-backend/blob/main/app/database/models/book.py"
    click UM "https://github.com/josephAyo/bibliotheque-e-backend/blob/main/app/database/models/user.py"
    click RM "https://github.com/josephAyo/bibliotheque-e-backend/blob/main/app/database/models/role.py"
    click PM "https://github.com/josephAyo/bibliotheque-e-backend/blob/main/app/database/models/permission.py"
    click CM "https://github.com/josephAyo/bibliotheque-e-backend/blob/main/app/database/models/curation.py"
    click CIM "https://github.com/josephAyo/bibliotheque-e-backend/blob/main/app/database/models/check_in_out.py"
    click RJ "https://github.com/josephAyo/bibliotheque-e-backend/blob/main/app/jobs/reminder.py"
    click ES "https://github.com/josephAyo/bibliotheque-e-backend/blob/main/app/helpers/send_email.py"
    click ET "https://github.com/josephAyo/bibliotheque-e-backend/blob/main/app/helpers/email_templates.py"
    click DH "https://github.com/josephAyo/bibliotheque-e-backend/blob/main/app/helpers/date_time.py"
```
