# chadha-glaied/supportify_project architecture

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

- Interactive diagram: https://gitdiagram.com/chadha-glaied/supportify_project
- Repository: https://github.com/chadha-glaied/supportify_project

## Overview

##### Project Type Analysis
This is a frontend Angular application with authentication functionality. The presence of auth.guard, auth.service, and components like login and register indicates it's a Single Page Application (SPA) with user authentication features.

##### Main Components

A. Client-Side Components (Angular):
- Core Components Layer
- Feature Components Layer
- Services Layer
- Guards Layer
- Models Layer

B. External Systems:
- Backend API Server (implied by db.json)
- Browser Local Storage (for auth tokens)

##### Top Layer (UI Components)
- Login Component
- Register Component
- Home Component
- User Component
- Customer Component
- UpdatePopup Component

##### Middle Layer (Services & Guards)
- Auth Service
- Auth Guard

##### Bottom Layer (Data & Models)
- UserModel

##### External Systems
- REST API (db.json)
- Browser Storage

##### Interactions

Specific Implementation Instructions:

- ┌─────────────────────────────────┐
- UI Components            │
- ┤
- Services & Guards           │
- ┤
- Data Layer              │
- ┘

##### External systems on the right side
- [Browser Storage]
- [REST API (db.json)]

##### Use the following symbols
- Rectangles: Components
- Hexagons: Services
- Shields: Guards
- Diamonds: Models

##### Authentication Flow
- Login/register flow
- Token storage and verification
- Protected route handling

##### Component Dependencies
- Which components are protected by AuthGuard
- Shared service usage
- Component hierarchy

##### Data Flow
- User input handling
- API communication
- Token management
- State management

- Grouping related components
- Using consistent spacing
- Adding clear labels
- Including brief descriptions for complex interactions

## Diagram (Mermaid)

```mermaid
graph TB
    %% Styles
    classDef component fill:#e6f3ff,stroke:#666
    classDef service fill:#fff3cc,stroke:#666
    classDef guard fill:#ffe6cc,stroke:#666
    classDef model fill:#e6ffe6,stroke:#666
    classDef external fill:#f2f2f2,stroke:#666
    classDef module fill:#f0e6ff,stroke:#666

    %% Main Application Modules
    AppModule["App Module"]:::module
    AppRouting["App Routing Module"]:::module

    %% UI Components Layer
    subgraph Components
        Login["Login Component"]:::component
        Register["Register Component"]:::component
        Home["Home Component"]:::component
        User["User Component"]:::component
        Customer["Customer Component"]:::component
        UpdatePopup["UpdatePopup Component"]:::component
    end

    %% Services & Guards Layer
    subgraph Services
        AuthService["Auth Service"]:::service
        AuthGuard["Auth Guard"]:::guard
    end

    %% Data Layer
    subgraph Data
        UserModel["User Model"]:::model
    end

    %% External Systems
    subgraph External
        BrowserStorage[("Browser Storage")]:::external
        RestAPI[("REST API")]:::external
    end

    %% Relationships
    AppModule --> AppRouting
    AppRouting --> AuthGuard
    
    Login --> AuthService
    Register --> AuthService
    Home --> AuthService
    User --> AuthService
    Customer --> AuthService
    UpdatePopup --> AuthService
    
    AuthGuard --> AuthService
    AuthService --> UserModel
    AuthService --> BrowserStorage
    AuthService --> RestAPI

    %% Protected Routes
    AuthGuard -.->|Protects| Home
    AuthGuard -.->|Protects| User
    AuthGuard -.->|Protects| Customer

    %% Click Events
    click Login "https://github.com/chadha-glaied/Supportify_Project/blob/main/src/app/login/login.component.ts"
    click Register "https://github.com/chadha-glaied/Supportify_Project/blob/main/src/app/register/register.component.ts"
    click Home "https://github.com/chadha-glaied/Supportify_Project/blob/main/src/app/home/home.component.ts"
    click User "https://github.com/chadha-glaied/Supportify_Project/blob/main/src/app/user/user.component.ts"
    click Customer "https://github.com/chadha-glaied/Supportify_Project/blob/main/src/app/customer/customer.component.ts"
    click UpdatePopup "https://github.com/chadha-glaied/Supportify_Project/blob/main/src/app/updatepopup/updatepopup.component.ts"
    click AuthService "https://github.com/chadha-glaied/Supportify_Project/blob/main/src/app/service/auth.service.ts"
    click AuthGuard "https://github.com/chadha-glaied/Supportify_Project/blob/main/src/app/guard/auth.guard.ts"
    click UserModel "https://github.com/chadha-glaied/Supportify_Project/blob/main/src/app/model/usermodel.ts"
    click RestAPI "https://github.com/chadha-glaied/Supportify_Project/blob/main/db.json"
    click AppModule "https://github.com/chadha-glaied/Supportify_Project/blob/main/src/app/app.module.ts"
    click AppRouting "https://github.com/chadha-glaied/Supportify_Project/blob/main/src/app/app-routing.module.ts"

    %% Legend
    subgraph Legend
        L1["Component"]:::component
        L2["Service"]:::service
        L3["Guard"]:::guard
        L4["Model"]:::model
        L5[("External System")]:::external
        L6["Module"]:::module
    end
```
