# pharouqy/moprice-app architecture

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

- Interactive diagram: https://gitdiagram.com/pharouqy/moprice-app
- Repository: https://github.com/pharouqy/moprice-app

## Overview

##### Main System Components

a) Client-Side Architecture:
- Inside this container, create three main sections:

b) Core Application Layers (arranged vertically):
##### Routing Layer
- Router configuration (src/router/index.jsx)
- Route definitions for all pages

##### Component Layer
- Authentication Components (authCheck.jsx)
- Layout Components (layout.jsx)
- PDF Rendering Components (pdfRendering.jsx)

##### Pages Layer
- User Authentication Pages (login, register, forgotPassword, resetPassword)
- Main Application Pages (home, contact, profil)
- Error Handling (errors.jsx)

c) External Interactions:
- API Communication (show connection to VITE_API_URL)
- Authentication Service Integration

##### Component Relationships

- Data flow between components
- Authentication flow
- Route navigation paths
- API calls to backend services

##### Technical Stack Indicators

A "Technology Stack" section showing:
- React 18.3.1
- Vite 5.4.1
- React Router 6.26.1
- Axios for API communication

##### Specific Elements

a) Authentication Flow:
**Login/Register Page → AuthCheck Component → Protected Routes**

b) Layout Structure:
**Layout Component**
- Header
- Main Content (Router Outlet)
- Footer

c) State Management:
- Custom hooks (useLogout.jsx)
- Component-level state
- Props flow

##### Important Notes

- Clear separation between public and protected routes
- Role of the layout component as a wrapper
- Where PDF rendering occurs
- How the custom hooks integrate with components
- Static assets handling (public folder)

## Diagram (Mermaid)

```mermaid
graph TB
    subgraph Client["Client Application"]
        subgraph UI["UI Layer"]
            Pages["Pages Components"]:::ui
            Layout["Layout Components"]:::ui
            PDF["PDF Renderer"]:::ui
            Auth["Authentication UI"]:::ui
        end

        subgraph Logic["Application Logic"]
            Router["Router"]:::logic
            Hooks["Custom Hooks"]:::logic
            AuthLogic["Auth Logic"]:::logic
            AppCore["App Core"]:::logic
        end

        subgraph External["External Communication"]
            API["Axios API Client"]:::external
        end
    end

    %% Relationships
    Pages --> Router
    Layout --> Pages
    PDF --> Pages
    Auth --> AuthLogic
    Router --> AuthLogic
    AuthLogic --> API
    Hooks --> API
    AppCore --> Router
    AppCore --> AuthLogic

    %% Click Events
    click AppCore "https://github.com/pharouqy/MoPrice-App/blob/main/src/App.jsx"
    click Router "https://github.com/pharouqy/MoPrice-App/blob/main/src/router/index.jsx"
    click AuthLogic "https://github.com/pharouqy/MoPrice-App/blob/main/src/components/authCheck.jsx"
    click Auth "https://github.com/pharouqy/MoPrice-App/blob/main/src/pages/login.jsx"
    click PDF "https://github.com/pharouqy/MoPrice-App/blob/main/src/components/pdfRendering.jsx"
    click Layout "https://github.com/pharouqy/MoPrice-App/blob/main/src/components/layout.jsx"
    click Pages "https://github.com/pharouqy/MoPrice-App/tree/main/src/pages"
    click Hooks "https://github.com/pharouqy/MoPrice-App/blob/main/src/hooks/useLogout.jsx"

    %% Styles
    classDef ui fill:#3498db,stroke:#2980b9,color:white
    classDef logic fill:#2ecc71,stroke:#27ae60,color:white
    classDef external fill:#e67e22,stroke:#d35400,color:white

    %% Legend
    subgraph Legend
        UI_Component["UI Component"]:::ui
        Logic_Component["Logic Component"]:::logic
        External_Component["External Component"]:::external
    end
```
