# mohamediliasskaddar/app-gestion-qualite architecture

> Architecture diagram of the GitHub repository mohamediliasskaddar/app-gestion-qualite, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2025-08-07). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/mohamediliasskaddar/app-gestion-qualite
- Repository: https://github.com/mohamediliasskaddar/app-gestion-qualite

## Overview

##### Project Type and Purpose
- This is a full-stack quality-management web application (“app-gestion-qualite”) composed of:
- A frontend Angular SPA under `frontend/`
- A backend Node.js + TypeScript REST API under `backend/` using Express-style routes, controllers, and services
- A relational database accessed via Prisma ORM with schema and migrations under `backend/prisma/`

##### Main Architectural Components
a. Frontend Angular Application
- Core modules: `app.component`, routing (`app.routes.ts`), feature pages (`home`, `landing-page`, `mesure-info`, `new-measurement`, `new-mold`)
- Shared components: `navbar`
- Services layer calling backend APIs: `api.service.ts`, `mesure.service.ts`, `moule.service.ts`
- Utilities and environment configs
b. Backend REST API
- Entry point: `server.ts`
- Routing layer: files in `src/routes/*.routes.ts` define endpoint URLs
- Controller layer: `src/controllers/*.controller.ts` handle request/response logic
- Service layer: `src/services/*.service.ts` contain business logic and call Prisma client
- Utility helpers in `src/utils/helpers.ts`
- Prisma client import in `src/prisma.ts`
c. Database
- Defined by `schema.prisma`, managed through migrations (`prisma/migrations/…`)
- Prisma-generated client code under `prisma/generated/prisma` interacts with the actual RDBMS (PostgreSQL, MySQL, etc.)
d. Build & Deployment Artifacts
- Transpiled JS output in `backend/dist/`
- Configuration files: `package.json`, `tsconfig.json`, Angular CLI config (`angular.json`)

##### Component Relationships and Data Flows
- User → Browser → Angular SPA
- Angular Components ↔ Angular Services
- Angular Services —HTTP/JSON→ Backend API Endpoints (Routes)
- Routes → Controllers → Services
- Services → Prisma Client → Database
- Response path: Database → Prisma → Service → Controller → HTTP Response → Angular → UI

##### Architectural Patterns and Principles
- Layered (Presentation / API Routing / Controller / Service / Data Access)
- MVC-inspired on backend; modular feature pages on frontend
- Dependency Injection in Angular services
- Single-page application communicating over REST
- Schema-first data modeling with Prisma

##### Technologies and Frameworks
- Frontend: Angular, TypeScript, Angular Router, RxJS
- Backend: Node.js, Express-style routing, TypeScript, Prisma ORM
- Database: Relational DB (Postgres/MySQL) via Prisma
- Build tools: Angular CLI, tsc, npm/yarn
- Testing stubs: `.spec.ts` files in frontend services and components

## Diagram (Mermaid)

```mermaid
flowchart TB
    %% User
    User["User"]:::user

    %% Client-side
    subgraph "Client-side" 
        direction TB
        Browser["Browser"]:::user
        subgraph "Angular SPA" 
            direction TB
            AppComponent["App Component\n(Angular 15 + RxJS)"]:::frontend
            RoutingModule["Routing Module\n(app.routes.ts)"]:::frontend
            Config["App Config\n(app.config.ts)"]:::frontend
            Bootstrap["Bootstrap Entry\n(main.ts)"]:::frontend
            IndexHTML["Index HTML\n(index.html)"]:::frontend
            Styles["Global Styles\n(styles.css)"]:::frontend
            CLIConfig["Angular CLI Config\n(angular.json)"]:::frontend
            TSConfigs["TS Configs\n(tsconfig*.json)"]:::frontend
            subgraph "Feature Pages"
                HomePage["Home Page"]:::frontend
                LandingPage["Landing Page"]:::frontend
                InfoPage["Measurement Info Page"]:::frontend
                NewMeasurement["New Measurement Page"]:::frontend
                NewMold["New Mold Page"]:::frontend
            end
            subgraph "Shared & Utils"
                Navbar["Navbar Component"]:::frontend
                DateUtil["Date Utility"]:::utils
                Models["Data Models"]:::utils
                EnvConfig["Environment Config"]:::frontend
            end
            subgraph "Services (API Layer)"
                APIService["Generic API Service"]:::frontend
                MeasureService["Measurement Service"]:::frontend
                MoldService["Mold Service"]:::frontend
            end
        end
        User --> Browser
        Browser -->|"loads SPA"| AppComponent
        AppComponent --> RoutingModule
        AppComponent --> Config
        AppComponent --> Bootstrap
        AppComponent --> IndexHTML
        AppComponent --> Styles
        AppComponent --> CLIConfig
        AppComponent --> TSConfigs
        RoutingModule --> HomePage
        RoutingModule --> LandingPage
        RoutingModule --> InfoPage
        RoutingModule --> NewMeasurement
        RoutingModule --> NewMold
        HomePage --> APIService
        LandingPage --> APIService
        InfoPage --> MeasureService
        NewMeasurement --> MeasureService
        NewMold --> MoldService
        Navbar --> APIService
        APIService --> MeasureService
        APIService --> MoldService
        DateUtil --> MeasureService
        Models --> MeasureService
        EnvConfig --> APIService
    end

    %% Server-side
    subgraph "Server-side" 
        direction TB
        ServerEntry["Server Entry\n(server.ts)"]:::backend
        PrismaInit["Prisma Init\n(prisma.ts)"]:::backend
        subgraph "API Gateway\n(Express Routes)"
            MeasureRoutes["Measurement Routes"]:::backend
            MoldRoutes["Mold Routes"]:::backend
        end
        subgraph "Controllers"
            MeasureController["Measurement Controller"]:::backend
            MoldController["Mold Controller"]:::backend
        end
        subgraph "Services"
            SBMeasureService["Measurement Service"]:::backend
            SBMoldService["Mold Service"]:::backend
        end
        Helpers["Utility Helpers\n(helpers.ts)"]:::utils
        ServerEntry --> MeasureRoutes
        ServerEntry --> MoldRoutes
        ServerEntry --> PrismaInit
        MeasureRoutes --> MeasureController
        MoldRoutes --> MoldController
        MeasureController --> SBMeasureService
        MoldController --> SBMoldService
        SBMeasureService --> PrismaInit
        SBMoldService --> PrismaInit
        Helpers --> SBMeasureService
        Helpers --> SBMoldService
    end

    %% Database
    subgraph "Database & ORM"
        direction TB
        Schema["Prisma Schema\n(schema.prisma)"]:::db
        Migrations["Prisma Migrations"]:::db
        GeneratedClient["Generated Prisma Client"]:::db
        Schema --> Migrations
        Migrations --> GeneratedClient
        PrismaInit --> GeneratedClient
    end

    DB["Relational Database"]:::db
    GeneratedClient -->|SQL| DB
    SBMeasureService -->|prisma client| DB
    SBMoldService -->|prisma client| DB
    DB -->|SQL response| GeneratedClient
    GeneratedClient -->|data| SBMeasureService
    SBMeasureService -->|response| MeasureController
    MeasureController -->|HTTP/JSON| APIService
    APIService -->|HTTP/JSON| Browser

    %% Click Events
    click AppComponent "https://github.com/mohamediliasskaddar/app-gestion-qualite/blob/master/frontend/src/app/app.component.ts"
    click RoutingModule "https://github.com/mohamediliasskaddar/app-gestion-qualite/blob/master/frontend/src/app/app.routes.ts"
    click Config "https://github.com/mohamediliasskaddar/app-gestion-qualite/blob/master/frontend/src/app/app.config.ts"
    click Bootstrap "https://github.com/mohamediliasskaddar/app-gestion-qualite/blob/master/frontend/src/main.ts"
    click IndexHTML "https://github.com/mohamediliasskaddar/app-gestion-qualite/blob/master/frontend/src/index.html"
    click Styles "https://github.com/mohamediliasskaddar/app-gestion-qualite/blob/master/frontend/src/styles.css"
    click CLIConfig "https://github.com/mohamediliasskaddar/app-gestion-qualite/blob/master/frontend/angular.json"
    click TSConfigs "https://github.com/mohamediliasskaddar/app-gestion-qualite/blob/master/frontend/tsconfig.app.json"
    click TSConfigs "https://github.com/mohamediliasskaddar/app-gestion-qualite/blob/master/frontend/tsconfig.json"
    click TSConfigs "https://github.com/mohamediliasskaddar/app-gestion-qualite/blob/master/frontend/tsconfig.spec.json"
    click HomePage "https://github.com/mohamediliasskaddar/app-gestion-qualite/blob/master/frontend/src/app/pages/home/home.component.ts"
    click LandingPage "https://github.com/mohamediliasskaddar/app-gestion-qualite/blob/master/frontend/src/app/pages/landing-page/landing-page.component.ts"
    click InfoPage "https://github.com/mohamediliasskaddar/app-gestion-qualite/blob/master/frontend/src/app/pages/mesure-info/mesure-info.component.ts"
    click NewMeasurement "https://github.com/mohamediliasskaddar/app-gestion-qualite/blob/master/frontend/src/app/pages/new-measurement/new-measurement.component.ts"
    click NewMold "https://github.com/mohamediliasskaddar/app-gestion-qualite/blob/master/frontend/src/app/pages/new-mold/new-mold.component.ts"
    click Navbar "https://github.com/mohamediliasskaddar/app-gestion-qualite/blob/master/frontend/src/app/shared/navbar/navbar.component.ts"
    click DateUtil "https://github.com/mohamediliasskaddar/app-gestion-qualite/blob/master/frontend/src/app/utils/date.ts"
    click Models "https://github.com/mohamediliasskaddar/app-gestion-qualite/blob/master/frontend/src/app/utils/models.ts"
    click EnvConfig "https://github.com/mohamediliasskaddar/app-gestion-qualite/blob/master/frontend/src/environments/environment.ts"
    click APIService "https://github.com/mohamediliasskaddar/app-gestion-qualite/blob/master/frontend/src/app/services/api.service.ts"
    click MeasureService "https://github.com/mohamediliasskaddar/app-gestion-qualite/blob/master/frontend/src/app/services/mesure.service.ts"
    click MoldService "https://github.com/mohamediliasskaddar/app-gestion-qualite/blob/master/frontend/src/app/services/moule.service.ts"
    click ServerEntry "https://github.com/mohamediliasskaddar/app-gestion-qualite/blob/master/backend/src/server.ts"
    click PrismaInit "https://github.com/mohamediliasskaddar/app-gestion-qualite/blob/master/backend/src/prisma.ts"
    click MeasureRoutes "https://github.com/mohamediliasskaddar/app-gestion-qualite/blob/master/backend/src/routes/mesure.routes.ts"
    click MoldRoutes "https://github.com/mohamediliasskaddar/app-gestion-qualite/blob/master/backend/src/routes/moule.routes.ts"
    click MeasureController "https://github.com/mohamediliasskaddar/app-gestion-qualite/blob/master/backend/src/controllers/mesure.controller.ts"
    click MoldController "https://github.com/mohamediliasskaddar/app-gestion-qualite/blob/master/backend/src/controllers/moule.controller.ts"
    click SBMeasureService "https://github.com/mohamediliasskaddar/app-gestion-qualite/blob/master/backend/src/services/mesure.service.ts"
    click SBMoldService "https://github.com/mohamediliasskaddar/app-gestion-qualite/blob/master/backend/src/services/moule.service.ts"
    click Helpers "https://github.com/mohamediliasskaddar/app-gestion-qualite/blob/master/backend/src/utils/helpers.ts"
    click Schema "https://github.com/mohamediliasskaddar/app-gestion-qualite/blob/master/backend/prisma/schema.prisma"
    click Migrations "https://github.com/mohamediliasskaddar/app-gestion-qualite/blob/master/backend/prisma/migrations/20250803140145_init/migration.sql"
    click GeneratedClient "https://github.com/mohamediliasskaddar/app-gestion-qualite/tree/master/backend/prisma/generated/prisma"

    %% Styles
    classDef frontend fill:#D6EAF8,stroke:#1B4F72,stroke-width:1px
    classDef backend fill:#D5F5E3,stroke:#196F3D,stroke-width:1px
    classDef db fill:#F9E79F,stroke:#B7950B,stroke-width:1px
    classDef utils fill:#E8DAEF,stroke:#6C3483,stroke-width:1px
    classDef user fill:#FADBD8,stroke:#922B21,stroke-width:1px
```
