# mehdilaghrissi/gestion_des_notifications_clients architecture

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

- Interactive diagram: https://gitdiagram.com/mehdilaghrissi/gestion_des_notifications_clients
- Repository: https://github.com/mehdilaghrissi/gestion_des_notifications_clients

## Overview

##### Project Type and Purpose
- This is a full-stack notification management system (“Système de Gestion des Notifications Clients”) comprising:
- Frontend: Angular 17 SPA for user interface (port 4200).
- Backend: Spring Boot 3.5.3 REST API (port 8080).
- Database: MySQL 8.0 as persistent storage.
- Purpose: centralize and automate multi-channel client notifications (Email, SMS, physical mail, calls, web) with templating, scheduling, bulk imports, PDF generation, and real-time dashboards.

##### File Structure Analysis
- Top-level:
- notif_backend/ — Spring Boot service
- notification/ — Angular application
- README.md
- Backend layers (src/main/java/com/example/notif_backend):
- controller/ — REST endpoints
- service/ — business logic (including factory for multi-channel senders, PDF, email, scheduler)
- repository/ — Spring Data JPA interfaces
- model/ — JPA entities
- dto/ — request/response payloads
- config/, util/ — CORS setup, template engine
- resources/db/migration/ — Flyway SQL scripts
- Frontend structure (per README; not shown in file tree):
- src/app/pages/ — UI views
- src/app/services/ — HTTP + domain services
- src/app/models/ — TypeScript interfaces
- Deployment/config files:
- application.properties / application.yaml
- environment.ts (frontend)
- pom.xml, angular.json, package.json

##### README Insights
- Tech stack and design patterns: Factory, Dependency Injection, Repository, DTO, Scheduler, PDF engine, CORS.
- Workflow: template creation → recipient import → notification crafting → grouped send → scheduling → dashboard.

a. Main Components
1. Angular Frontend
2. Spring Boot Backend
- REST Controllers
- Service Layer (Email/SMS/PDF/Scheduler)
- Repository Layer
- Template Engine Utility
3. MySQL Database
4. External Services
- SMTP Server (Email)
- SMS Gateway
- PDF Generation (Flying Saucer)
b. Relationships & Data Flows
- User actions in Angular → HTTP(S) JSON calls to Backend /api endpoints.
- Controllers delegate to Services → Services invoke Repositories (JPA/Hibernate) → SQL queries to MySQL.
- Scheduler component in backend polls pending jobs and triggers Service factories to send via appropriate channel.
- PDF Service calls template engine → Flying Saucer → generates PDF stored or returned.
- Backend pushes status updates to Dashboard (polled or WebSocket).
- Import CSV/JSON files uploaded to backend (uploads folder), parsed by Service → persisted.
c. Architectural Patterns
- Layered (Controller → Service → Repository)
- Factory Pattern for EnvoiSender (multi-canal)
- DTO for decoupling API payloads from internal entities
- Scheduler as asynchronous job runner
- CORS Config for frontend-backend security
d. Technologies & Frameworks
- Angular, RxJS, PrimeNG
- Spring Boot, Spring Data JPA, Spring Security, Spring Scheduler
- Flyway for DB migration; MySQL 8.0
- JavaMailSender, Flying Saucer

## Diagram (Mermaid)

```mermaid
flowchart TB
    subgraph "Frontend Layer"
        direction TB
        UIPages["UI Pages"]:::frontend
        DomainModels["Models"]:::frontend
        HTTPServices["Services (HTTP)"]:::frontend
    end
    click notification/ "https://github.com/mehdilaghrissi/gestion_des_notifications_clients/tree/master/notification/"

    HTTPServices -->|"HTTP JSON"| API["API Gateway (/api)"]:::api

    subgraph "Backend Application"
        direction TB
        MainApp["NotifBackendApplication"]:::backend
        subgraph "Controller Layer"
            direction TB
            Controllers["REST Controllers"]:::controller
        end
        subgraph "Service Layer"
            direction TB
            Business["Business Services"]:::service
            Factory["EnvoiSenderFactory"]:::service
            PDF["PdfService"]:::service
            EmailS["EmailService"]:::service
        end
        Scheduler["EnvoiScheduler"]:::scheduler
        subgraph "Repository Layer"
            direction TB
            Repos["JPA Repositories"]:::repository
        end
        DTOs["DTOs"]:::dto
        Models["Entities (JPA)"]:::model
        Cors["CorsConfig"]:::config
        Util["TemplateEngine"]:::util
    end
    click notif_backend/src/main/java/com/example/notif_backend/NotifBackendApplication.java "https://github.com/mehdilaghrissi/gestion_des_notifications_clients/blob/master/notif_backend/src/main/java/com/example/notif_backend/NotifBackendApplication.java"
    click notif_backend/src/main/java/com/example/notif_backend/controller/ "https://github.com/mehdilaghrissi/gestion_des_notifications_clients/tree/master/notif_backend/src/main/java/com/example/notif_backend/controller/"
    click notif_backend/src/main/java/com/example/notif_backend/service/ "https://github.com/mehdilaghrissi/gestion_des_notifications_clients/tree/master/notif_backend/src/main/java/com/example/notif_backend/service/"
    click notif_backend/src/main/java/com/example/notif_backend/service/EnvoiSenderFactory.java "https://github.com/mehdilaghrissi/gestion_des_notifications_clients/blob/master/notif_backend/src/main/java/com/example/notif_backend/service/EnvoiSenderFactory.java"
    click notif_backend/src/main/java/com/example/notif_backend/service/PdfService.java "https://github.com/mehdilaghrissi/gestion_des_notifications_clients/blob/master/notif_backend/src/main/java/com/example/notif_backend/service/PdfService.java"
    click notif_backend/src/main/java/com/example/notif_backend/service/EmailService.java "https://github.com/mehdilaghrissi/gestion_des_notifications_clients/blob/master/notif_backend/src/main/java/com/example/notif_backend/service/EmailService.java"
    click notif_backend/src/main/java/com/example/notif_backend/scheduler/EnvoiScheduler.java "https://github.com/mehdilaghrissi/gestion_des_notifications_clients/blob/master/notif_backend/src/main/java/com/example/notif_backend/scheduler/EnvoiScheduler.java"
    click notif_backend/src/main/java/com/example/notif_backend/repository/ "https://github.com/mehdilaghrissi/gestion_des_notifications_clients/tree/master/notif_backend/src/main/java/com/example/notif_backend/repository/"
    click notif_backend/src/main/java/com/example/notif_backend/dto/ "https://github.com/mehdilaghrissi/gestion_des_notifications_clients/tree/master/notif_backend/src/main/java/com/example/notif_backend/dto/"
    click notif_backend/src/main/java/com/example/notif_backend/model/ "https://github.com/mehdilaghrissi/gestion_des_notifications_clients/tree/master/notif_backend/src/main/java/com/example/notif_backend/model/"
    click notif_backend/src/main/java/com/example/notif_backend/config/CorsConfig.java "https://github.com/mehdilaghrissi/gestion_des_notifications_clients/blob/master/notif_backend/src/main/java/com/example/notif_backend/config/CorsConfig.java"
    click notif_backend/src/main/java/com/example/notif_backend/util/TemplateEngine.java "https://github.com/mehdilaghrissi/gestion_des_notifications_clients/blob/master/notif_backend/src/main/java/com/example/notif_backend/util/TemplateEngine.java"
    click notif_backend/src/main/resources/db/migration/V1__init_schema.sql "https://github.com/mehdilaghrissi/gestion_des_notifications_clients/blob/master/notif_backend/src/main/resources/db/migration/V1__init_schema.sql"
    click notif_backend/src/main/resources/application.properties "https://github.com/mehdilaghrissi/gestion_des_notifications_clients/blob/master/notif_backend/src/main/resources/application.properties"
    click notif_backend/src/main/resources/application.yaml "https://github.com/mehdilaghrissi/gestion_des_notifications_clients/blob/master/notif_backend/src/main/resources/application.yaml"
    click notif_backend/uploads/ "https://github.com/mehdilaghrissi/gestion_des_notifications_clients/tree/master/notif_backend/uploads/"
    click notif_backend/src/test/java/com/example/notif_backend/NotifBackendApplicationTests.java "https://github.com/mehdilaghrissi/gestion_des_notifications_clients/blob/master/notif_backend/src/test/java/com/example/notif_backend/NotifBackendApplicationTests.java"

    API --> Controllers
    Controllers -->|"delegates"| Business
    Business --> Repos
    Repos -->|"SQL"| MySQL[(MySQL Database)]:::database
    Business --> Util
    Business --> Factory
    Factory --> EmailS -->|"SMTP"| SMTP["SMTP Server"]:::external
    Factory -->|"SMS API"| SMS["SMS Gateway"]:::external
    PDF --> Util --> PDFEngine["Flying Saucer Engine"]:::external
    Scheduler -.-> Factory
    Scheduler -->|"polls"| Repos
    Controllers --> DTOs
    DTOs --> Models
    Cors --> Controllers
    HTTPServices --> API
    Business -->|"generates"| PDF
    MySQL -->|"migrations"| Flyway["Flyway Migrations"]:::database

    classDef frontend fill:#D6E9FE,stroke:#2B65EC
    classDef api fill:#C9E2B3,stroke:#4B8B3B
    classDef backend fill:#E8F1F2,stroke:#678E97
    classDef controller fill:#B6D7A8,stroke:#38761D
    classDef service fill:#FEE5AC,stroke:#BF9000
    classDef scheduler fill:#EAD1DC,stroke:#B85450
    classDef repository fill:#F4CCCC,stroke:#CC0000
    classDef dto fill:#FFF2CC,stroke:#BF9000
    classDef model fill:#D9D2E9,stroke:#674EA7
    classDef config fill:#F8CECC,stroke:#CC4125
    classDef util fill:#D0E0E3,stroke:#3C8DAD
    classDef database fill:#FFE699,stroke:#E69138,shape:cylinder
    classDef external fill:#D9D9D9,stroke:#7F7F7F,stroke-dasharray:5 5
```
