# mohammedaoudi/abes-qr-attendance architecture

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

- Interactive diagram: https://gitdiagram.com/mohammedaoudi/abes-qr-attendance
- Repository: https://github.com/mohammedaoudi/abes-qr-attendance

## Overview

##### High-Level Architecture Components

The system should be represented with these main components:
- Frontend Layer (Web & Mobile)
- Backend API Layer
- Database Layer
- Authentication Layer
- QR Code Service

##### Detailed Component Breakdown

a) Client Applications:
- Web Application (React.js)
- Admin Dashboard
- Professor Portal
- Authentication Module
- QR Code Generation Interface

- Mobile Application (React Native)
- Student Portal
- QR Code Scanner
- Attendance Tracking
- Schedule Viewer

b) Backend Services:
- Express.js Server
- Authentication Middleware
- Controllers Layer
- Routes Layer
- Models Layer

c) Database:
- MongoDB Collections
- Users
- Students
- Professors
- Seances (Sessions)
- QR Codes
- Attendance Records
- Courses/Modules

- [Web Application (React)] ---- [Mobile Application (React Native)]

- [Express.js API Server]
- Authentication Service
- QR Code Service
- Attendance Service
- User Management Service

##### In the Data Layer
- [MongoDB Database]

##### Interaction flows
- Blue: User authentication flows
- Green: QR code operations
- Orange: Attendance tracking
- Purple: Data management operations

##### Specific architectural patterns
- MVC pattern in backend structure
- Repository pattern for data access
- JWT authentication flow
- Real-time updates for attendance

##### Security Layer
- JWT token flow
- Authentication middleware
- Secure endpoints

##### QR Code Flow
- Professor generates QR code
- Student scans QR code
- Attendance verification process

##### Data Flow
- How attendance data moves from mobile to database
- Real-time updates to web dashboard
- Report generation flow

##### Integration Points
- API endpoints
- Mobile-specific endpoints
- Admin dashboard connections

Use clear visual hierarchy:
- Consistent spacing and alignment
- Clear labels for all components
- Numbered sequence flows for complex operations

Remember to maintain a balance between detail and clarity, focusing on the core architectural components while providing enough detail to understand the system's operation.

## Diagram (Mermaid)

```mermaid
graph TB
    %% Styles and Classes
    classDef frontend fill:#e1f5fe,stroke:#01579b
    classDef backend fill:#e8f5e9,stroke:#1b5e20
    classDef database fill:#fff3e0,stroke:#e65100
    classDef auth fill:#f3e5f5,stroke:#4a148c
    classDef qr fill:#fbe9e7,stroke:#bf360c

    %% Client Layer
    subgraph ClientLayer["Client Applications"]
        WebApp["Web Application (React)"]:::frontend
        MobileApp["Mobile Application (React Native)"]:::frontend
        
        subgraph WebComponents["Web Components"]
            Dashboard["Admin Dashboard"]:::frontend
            AuthModule["Authentication Module"]:::frontend
            QRInterface["QR Generation Interface"]:::frontend
        end
        
        subgraph MobileComponents["Mobile Components"]
            Scanner["QR Scanner"]:::frontend
            StudentPortal["Student Portal"]:::frontend
        end
    end

    %% Application Layer
    subgraph AppLayer["Application Layer"]
        Express["Express.js Server"]:::backend
        
        subgraph Services["Core Services"]
            AuthService["Authentication Service"]:::auth
            QRService["QR Code Service"]:::qr
            AttendanceService["Attendance Service"]:::backend
        end
        
        subgraph Controllers["Controllers"]
            UserCtrl["User Controller"]:::backend
            QRCtrl["QR Controller"]:::backend
            SeanceCtrl["Seance Controller"]:::backend
        end
    end

    %% Data Layer
    subgraph DataLayer["Data Layer"]
        MongoDB[(MongoDB Database)]:::database
        
        subgraph Models["Database Models"]
            Users[("Users")]:::database
            Students[("Students")]:::database
            Professors[("Professors")]:::database
            Seances[("Seances")]:::database
            QRCodes[("QR Codes")]:::database
        end
    end

    %% Relationships
    WebApp --> AuthService
    MobileApp --> AuthService
    AuthService --> Express
    Express --> MongoDB
    QRInterface --> QRService
    Scanner --> QRService
    QRService --> QRCodes
    AttendanceService --> Seances

    %% Click Events
    click Express "https://github.com/Mohammedaoudi/abes-qr-attendance/blob/main/backend/app.js"
    click AuthService "https://github.com/Mohammedaoudi/abes-qr-attendance/blob/main/backend/middleware/auth.js"
    click AuthModule "https://github.com/Mohammedaoudi/abes-qr-attendance/blob/main/web/src/views/Authentification/SignInSignUpForm.jsx"
    click QRService "https://github.com/Mohammedaoudi/abes-qr-attendance/blob/main/backend/controllers/QrcodeCtrl.js"
    click Scanner "https://github.com/Mohammedaoudi/abes-qr-attendance/blob/main/mobile/components/BarcodeScanner.tsx"
    click QRInterface "https://github.com/Mohammedaoudi/abes-qr-attendance/blob/main/web/src/views/ListeAbs/QRPAGE/QrPage.js"
    click WebApp "https://github.com/Mohammedaoudi/abes-qr-attendance/blob/main/web/src/App.js"
    click MobileApp "https://github.com/Mohammedaoudi/abes-qr-attendance/blob/main/mobile/app/index.tsx"
    click UserCtrl "https://github.com/Mohammedaoudi/abes-qr-attendance/blob/main/backend/controllers/usersCtrls.js"
    click QRCtrl "https://github.com/Mohammedaoudi/abes-qr-attendance/blob/main/backend/controllers/QrcodeCtrl.js"
    click SeanceCtrl "https://github.com/Mohammedaoudi/abes-qr-attendance/blob/main/backend/controllers/SeancesCtrls.js"
    click Users "https://github.com/Mohammedaoudi/abes-qr-attendance/blob/main/backend/models/Users.js"
    click Students "https://github.com/Mohammedaoudi/abes-qr-attendance/blob/main/backend/models/Students.js"
    click Professors "https://github.com/Mohammedaoudi/abes-qr-attendance/blob/main/backend/models/Professeurs.js"
    click Seances "https://github.com/Mohammedaoudi/abes-qr-attendance/blob/main/backend/models/Seances.js"
    click QRCodes "https://github.com/Mohammedaoudi/abes-qr-attendance/blob/main/backend/models/QrCodes.js"

    %% Legend
    subgraph Legend["Legend"]
        Frontend["Frontend Component"]:::frontend
        Backend["Backend Component"]:::backend
        DB["Database Component"]:::database
        AuthComp["Auth Component"]:::auth
        QRComp["QR Component"]:::qr
    end
```
