# backofficeproject/frontend architecture

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

- Interactive diagram: https://gitdiagram.com/backofficeproject/frontend
- Repository: https://github.com/backofficeproject/frontend

## Overview

##### Project type and purpose
- This is a React-based single-page “Backoffice” frontend application (no backend code here) whose role is to provide HR dashboards (Attendance, Benefits, Employees, Performance, Recruitment, Reports) behind an authentication layer.

##### File structure
- Top-level build & config:
- index.html, public/ (fonts, static assets)
- vite.config.js, postcss.config.js, tailwind.config.js, eslint.config.js
- Application entry & styling:
- src/main.jsx (mounts App into index.html)
- src/App.jsx + App.css + index.css
- Routing & navigation:
- src/router/ (routes.js, index.jsx, PrivateRoutes.jsx)
- Global state & auth:
- src/store/AuthContext.jsx
- Pages (one per feature):
- src/pages/{Attendance, Benefits, Dashboard, Employees, Performance, Recruitment, Reports}.jsx
- UI components organized by domain:
- src/components/auth (LoginPage, ProtectedRoute)
- src/components/layout (Header, Sidebar, Layout)
- src/components/common (Card, Stats)
- src/components/dashboard, employees
- Utilities & abstractions:
- src/hooks (custom React hooks)
- src/lib (API clients, helpers)

##### README.md
- Confirms this is the “Backoffice frontend App.” No additional architecture docs, so we infer based on code.

##### Diagramming essentials
- User → Browser → App
- App → Router → Pages
- Pages → Hooks/Lib → External API
- External API → Pages → UI components → Browser render
- Blue for UI (Layout, Pages, Components)
- Green for Logic (AuthContext, Hooks, Lib)
- Orange for Routing (Router, PrivateRoutes)
- Gray for Tools/Pipeline (Vite, Tailwind, ESLint)

## Diagram (Mermaid)

```mermaid
flowchart TD
    classDef ui fill:#cce5ff,stroke:#004085,color:#004085
    classDef logic fill:#d4edda,stroke:#155724,color:#155724
    classDef routing fill:#fff3cd,stroke:#856404,color:#856404
    classDef tools fill:#e2e3e5,stroke:#6c757d,color:#6c757d
    classDef external fill:#f8d7da,stroke:#721c24,color:#721c24

    Browser["User Browser"]:::external
    Browser -->|opens| HTML["index.html"]:::tools
    click HTML "https://github.com/backofficeproject/frontend/blob/dev/index.html"

    HTML --> Vite["Vite Bundler"]:::tools
    subgraph "Build Tools & Asset Pipeline"
        ViteConfig["vite.config.js"]:::tools
        PostCSS["postcss.config.js"]:::tools
        TailwindCfg["tailwind.config.js"]:::tools
        ESLintCfg["eslint.config.js"]:::tools
        Public["public/"]:::tools
    end
    click ViteConfig "https://github.com/backofficeproject/frontend/blob/dev/vite.config.js"
    click PostCSS "https://github.com/backofficeproject/frontend/blob/dev/postcss.config.js"
    click TailwindCfg "https://github.com/backofficeproject/frontend/blob/dev/tailwind.config.js"
    click ESLintCfg "https://github.com/backofficeproject/frontend/blob/dev/eslint.config.js"
    click Public "https://github.com/backofficeproject/frontend/tree/dev/public/"

    Vite --> Main["src/main.jsx"]:::logic
    click Main "https://github.com/backofficeproject/frontend/blob/dev/src/main.jsx"
    Main --> App["src/App.jsx"]:::logic
    click App "https://github.com/backofficeproject/frontend/blob/dev/src/App.jsx"
    App --> Styles1["src/index.css"]:::tools
    click Styles1 "https://github.com/backofficeproject/frontend/blob/dev/src/index.css"
    App --> Styles2["src/App.css"]:::tools
    click Styles2 "https://github.com/backofficeproject/frontend/blob/dev/src/App.css"

    App --> AuthCTX["src/store/AuthContext.jsx"]:::logic
    click AuthCTX "https://github.com/backofficeproject/frontend/blob/dev/src/store/AuthContext.jsx"

    subgraph "Routing Layer"
        RouterIndex["src/router/index.jsx"]:::routing
        RoutesDef["src/router/routes.js"]:::routing
        ProtectedRouteDef["src/router/PrivateRoutes.jsx"]:::routing
    end
    click RouterIndex "https://github.com/backofficeproject/frontend/blob/dev/src/router/index.jsx"
    click RoutesDef "https://github.com/backofficeproject/frontend/blob/dev/src/router/routes.js"
    click ProtectedRouteDef "https://github.com/backofficeproject/frontend/blob/dev/src/router/PrivateRoutes.jsx"

    AuthCTX --> RouterIndex
    RouterIndex -->|public| LoginPage
    RouterIndex -->|private| ProtectedWrap

    subgraph "Authentication UI"
        LoginPage["src/components/auth/LoginPage.jsx"]:::ui
        click LoginPage "https://github.com/backofficeproject/frontend/blob/dev/src/components/auth/LoginPage.jsx"
        ProtectedWrap["src/components/auth/ProtectedRoute.jsx"]:::routing
        click ProtectedWrap "https://github.com/backofficeproject/frontend/blob/dev/src/components/auth/ProtectedRoute.jsx"
    end

    ProtectedWrap --> LayoutComp

    subgraph "UI & Layout Components"
        LayoutComp["src/components/layout/Layout.jsx"]:::ui
        Header["src/components/layout/Header.jsx"]:::ui
        Sidebar["src/components/layout/Sidebar.jsx"]:::ui
    end
    click LayoutComp "https://github.com/backofficeproject/frontend/blob/dev/src/components/layout/Layout.jsx"
    click Header "https://github.com/backofficeproject/frontend/blob/dev/src/components/layout/Header.jsx"
    click Sidebar "https://github.com/backofficeproject/frontend/blob/dev/src/components/layout/Sidebar.jsx"

    LayoutComp --> Header
    LayoutComp --> Sidebar
    LayoutComp --> Attendance
    LayoutComp --> Benefits
    LayoutComp --> Dashboard
    LayoutComp --> Employees
    LayoutComp --> Performance
    LayoutComp --> Recruitment
    LayoutComp --> Reports

    subgraph "Pages"
        Attendance["src/pages/Attendance.jsx"]:::ui
        Benefits["src/pages/Benefits.jsx"]:::ui
        Dashboard["src/pages/Dashboard.jsx"]:::ui
        Employees["src/pages/Employees.jsx"]:::ui
        Performance["src/pages/Performance.jsx"]:::ui
        Recruitment["src/pages/Recruitment.jsx"]:::ui
        Reports["src/pages/Reports.jsx"]:::ui
    end
    click Attendance "https://github.com/backofficeproject/frontend/blob/dev/src/pages/Attendance.jsx"
    click Benefits "https://github.com/backofficeproject/frontend/blob/dev/src/pages/Benefits.jsx"
    click Dashboard "https://github.com/backofficeproject/frontend/blob/dev/src/pages/Dashboard.jsx"
    click Employees "https://github.com/backofficeproject/frontend/blob/dev/src/pages/Employees.jsx"
    click Performance "https://github.com/backofficeproject/frontend/blob/dev/src/pages/Performance.jsx"
    click Recruitment "https://github.com/backofficeproject/frontend/blob/dev/src/pages/Recruitment.jsx"
    click Reports "https://github.com/backofficeproject/frontend/blob/dev/src/pages/Reports.jsx"

    subgraph "Domain-specific UI"
        DashWidget["src/components/dashboard/Dashboard.jsx"]:::ui
        EmpList["src/components/employees/EmployeeList.jsx"]:::ui
    end
    click DashWidget "https://github.com/backofficeproject/frontend/blob/dev/src/components/dashboard/Dashboard.jsx"
    click EmpList "https://github.com/backofficeproject/frontend/blob/dev/src/components/employees/EmployeeList.jsx"

    subgraph "Common UI Components"
        Card["src/components/common/Card.jsx"]:::ui
        Stats["src/components/common/Stats.jsx"]:::ui
    end
    click Card "https://github.com/backofficeproject/frontend/blob/dev/src/components/common/Card.jsx"
    click Stats "https://github.com/backofficeproject/frontend/blob/dev/src/components/common/Stats.jsx"

    Hooks["src/hooks/"]:::logic
    Lib["src/lib/"]:::logic
    click Hooks "https://github.com/backofficeproject/frontend/tree/dev/src/hooks/"
    click Lib "https://github.com/backofficeproject/frontend/tree/dev/src/lib/"

    ExternalAPI["External REST API"]:::external

    Attendance -->|uses| Hooks
    Benefits -->|uses| Hooks
    Dashboard -->|uses| Hooks
    Employees -->|uses| Hooks
    Performance -->|uses| Hooks
    Recruitment -->|uses| Hooks
    Reports -->|uses| Hooks

    Attendance -->|calls| Lib
    Benefits -->|calls| Lib
    Dashboard -->|calls| Lib
    Employees -->|calls| Lib
    Performance -->|calls| Lib
    Recruitment -->|calls| Lib
    Reports -->|calls| Lib

    Hooks -->|fetch/post| ExternalAPI
    Lib -->|request| ExternalAPI

    Dashboard --> DashWidget
    Employees --> EmpList

    Attendance --> Card
    Benefits --> Card
    Dashboard --> Card
    Employees --> Card
    Performance --> Card
    Recruitment --> Card
    Reports --> Card

    Attendance --> Stats
    Benefits --> Stats
    Dashboard --> Stats
    Employees --> Stats
    Performance --> Stats
    Recruitment --> Stats
    Reports --> Stats
```
