# xerberuz/frontend_faworki architecture

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

- Interactive diagram: https://gitdiagram.com/xerberuz/frontend_faworki
- Repository: https://github.com/xerberuz/frontend_faworki

## Overview

##### Project type and purpose
- This is a React single‐page application (SPA) scaffolded with Vite.
- It implements a multi‐role portal (Administrator, Client, Worker) with authentication, role‐based routing, and i18n.

##### File structure
- Top‐level config: package.json, pnpm-lock.yaml, vite.config.js, eslint.config.js, vercel.json
- Entry points: index.html → src/main.jsx
- UI layers:
- src/router/AppRouter.jsx (React Router setup + ProtectedRoute)
- src/layouts/MainLayout.jsx (global structure)
- src/pages/** (per‐role and generic pages)
- src/components/** (shared widgets: sidebars, forms, language switcher)
- Cross‐cutting concerns:
- src/hooks/useAuth.js (auth state & role detection)
- src/services/api.js (HTTP wrapper to backend)
- src/translate/i18n.js + resource files (en, es)

##### README
- Confirms minimal Vite+React template with HMR and ESLint.
- No built-in backend; services/api.js expects an external REST API.

## Diagram (Mermaid)

```mermaid
flowchart TD
    User["User Browser"]:::external
    ReactSPA["React SPA (Vite)"]:::client

    subgraph "Client Side"
        direction TB
        Entry["Entry Point\nindex.html → src/main.jsx → src/App.jsx"]:::client
        Routing["AppRouter"]:::client
        ProtectedRoute["ProtectedRoute"]:::client
        AuthHook["useAuth Hook"]:::client
        MainLayout["MainLayout"]:::client
        i18n["i18n Module"]:::client
        Resources["Translation Resources\n(en.jsx, es.jsx)"]:::client
        APIService["API Service"]:::client

        subgraph "UI Layer"
            direction TB
            subgraph "Public Pages"
                Home["Home"]:::client
                Login["Login"]:::client
                Register["Register"]:::client
                Processing["Processing"]:::client
                NotFound["NotFound"]:::client
                AccessDenied["AccessDenied"]:::client
            end
            subgraph "Protected Pages"
                AdminDashboard["Admin Dashboard"]:::client
                ClientDashboard["Client Dashboard"]:::client
                WorkerDashboard["Worker Dashboard"]:::client
            end
            subgraph "Shared Components"
                LanguageSwitcher["Language Switcher"]:::client
                LoginForm["Login Form"]:::client
                RegisterForm["Register Form"]:::client
            end
            subgraph "Role Sidebars"
                AdminSidebar["Admin Sidebar"]:::client
                ClientSidebar["Client Sidebar"]:::client
                WorkerSidebar["Worker Sidebar"]:::client
            end
        end
    end

    subgraph "Server Side"
        direction TB
        BackendAPI["Backend API"]:::backend
        AuthService["Auth Service"]:::backend
        UserService["User/Role Service"]:::backend
        RequestService["Request Service"]:::backend
        DB["Database"]:::database
    end

    User --> ReactSPA
    ReactSPA --> Entry
    Entry --> MainLayout
    MainLayout --> Routing
    Routing --> Home
    Routing --> Login
    Routing --> Register
    Routing --> Processing
    Routing --> AdminDashboard
    Routing --> ClientDashboard
    Routing --> WorkerDashboard
    Routing --> NotFound
    Routing --> AccessDenied
    ProtectedRoute -->|uses| AuthHook
    Login -->|calls API| APIService
    AdminDashboard -->|calls API| APIService
    APIService --> BackendAPI
    BackendAPI --> AuthService
    BackendAPI --> UserService
    BackendAPI --> RequestService
    AuthService --> DB
    UserService --> DB
    RequestService --> DB

    click Entry "https://github.com/xerberuz/frontend_faworki/blob/main/src/main.jsx"
    click Routing "https://github.com/xerberuz/frontend_faworki/blob/main/src/router/AppRouter.jsx"
    click ProtectedRoute "https://github.com/xerberuz/frontend_faworki/blob/main/src/components/ProtectedRoute/index.jsx"
    click MainLayout "https://github.com/xerberuz/frontend_faworki/blob/main/src/layouts/MainLayout.jsx"
    click AuthHook "https://github.com/xerberuz/frontend_faworki/blob/main/src/hooks/useAuth.js"
    click APIService "https://github.com/xerberuz/frontend_faworki/blob/main/src/services/api.js"
    click i18n "https://github.com/xerberuz/frontend_faworki/blob/main/src/translate/i18n.js"
    click Resources "https://github.com/xerberuz/frontend_faworki/blob/main/src/translate/language/en.jsx"
    click Resources "https://github.com/xerberuz/frontend_faworki/blob/main/src/translate/language/es.jsx"
    click LanguageSwitcher "https://github.com/xerberuz/frontend_faworki/blob/main/src/components/languageSwitcher/index.jsx"
    click LoginForm "https://github.com/xerberuz/frontend_faworki/blob/main/src/components/loginForm/index.jsx"
    click RegisterForm "https://github.com/xerberuz/frontend_faworki/blob/main/src/components/registerForm/index.jsx"
    click AdminSidebar "https://github.com/xerberuz/frontend_faworki/blob/main/src/components/AdminSidebar/index.jsx"
    click ClientSidebar "https://github.com/xerberuz/frontend_faworki/blob/main/src/components/ClientSidebar/index.jsx"
    click WorkerSidebar "https://github.com/xerberuz/frontend_faworki/blob/main/src/components/WorkerSidebar/index.jsx"
    click Home "https://github.com/xerberuz/frontend_faworki/blob/main/src/pages/Home/index.jsx"
    click Login "https://github.com/xerberuz/frontend_faworki/blob/main/src/pages/Login/index.jsx"
    click Register "https://github.com/xerberuz/frontend_faworki/blob/main/src/pages/Register/index.jsx"
    click Processing "https://github.com/xerberuz/frontend_faworki/blob/main/src/pages/Processing/index.jsx"
    click NotFound "https://github.com/xerberuz/frontend_faworki/blob/main/src/pages/NotFound/index.jsx"
    click AccessDenied "https://github.com/xerberuz/frontend_faworki/blob/main/src/pages/AccessDenied/index.jsx"
    click AdminDashboard "https://github.com/xerberuz/frontend_faworki/blob/main/src/pages/Admin/index.jsx"
    click ClientDashboard "https://github.com/xerberuz/frontend_faworki/blob/main/src/pages/Client/index.jsx"
    click WorkerDashboard "https://github.com/xerberuz/frontend_faworki/blob/main/src/pages/Worker/index.jsx"

    classDef client fill:#D6EAF8,stroke:#1B4F72,stroke-width:1px
    classDef backend fill:#D5F5E3,stroke:#196F3D,stroke-width:1px
    classDef database fill:#FCF3CF,stroke:#7D6608,stroke-width:1px
    classDef external fill:#FADBD8,stroke:#922B21,stroke-width:1px
```
