# josephayo/bibliotheque-e-frontend architecture

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

- Interactive diagram: https://gitdiagram.com/josephayo/bibliotheque-e-frontend
- Repository: https://github.com/josephayo/bibliotheque-e-frontend

## Overview

##### Main System Components

a) Client-Side Application (Next.js)
- This as the main container
- That it supports both client-side and server-side rendering

b) Core Application Layers (show as nested containers):

##### Detailed Component Breakdown

a) Page Routes Structure
- Authentication routes (login, signup, verification)
- Library management routes (books, curations, genres)
- User management routes (account, manage)
- As hierarchical components

b) Component Architecture
- Layout components (AuthPageLayout, LibraryPageLayout)
- Reusable UI components (Cards, Buttons, Inputs)
- Feature-specific components (Banners, Tables)

##### Data Flow Patterns

a) API Integration
- Connection to external API (src/services/api)
- Query patterns for different entities (users, library, genre, curation)

b) State Management
- Redux store (src/lib/store.js)
- Slice patterns (createUserSlice)
- Context providers (GenreContextProvider)

##### Cross-Cutting Concerns

Overlays or side panels showing:

a) Authentication & Authorization
- AuthorizationGate
- UserAuthWrapper
- How these interact with protected routes

b) Configuration & Theming
- Chakra UI theme configuration
- Axios configuration
- As utility services

##### Specific Implementation Details

Technical details such as:

- Next.js API routes (/api)
- Custom hooks (useCurrentUserLoader, useUserRoles)
- Service layer organization
- Component composition patterns

## Diagram (Mermaid)

```mermaid
graph TB
    subgraph Client["Next.js Frontend Application"]
        subgraph Pages["Pages Layer"]
            Auth["Authentication Routes"]:::pages
            LibRoutes["Library Routes"]:::pages
            UserRoutes["User Management Routes"]:::pages

            Auth --> |contains| Login["Login"]:::page
            Auth --> |contains| Signup["Signup"]:::page
            Auth --> |contains| Verify["Verification"]:::page

            LibRoutes --> |contains| Books["Books"]:::page
            LibRoutes --> |contains| Curations["Curations"]:::page
            LibRoutes --> |contains| Genres["Genres"]:::page
        end

        subgraph Components["Components Layer"]
            Layouts["Layout Components"]:::component
            UIComps["UI Components"]:::component
            AuthComps["Authentication Components"]:::component

            Layouts --> AuthLayout["AuthPageLayout"]:::component
            Layouts --> LibLayout["LibraryPageLayout"]:::component

            UIComps --> Buttons["Buttons"]:::component
            UIComps --> Cards["Cards"]:::component
            UIComps --> Inputs["Inputs"]:::component
            UIComps --> Tables["Tables"]:::component

            AuthComps --> AuthGate["AuthorizationGate"]:::component
            AuthComps --> UserWrapper["UserAuthWrapper"]:::component
        end

        subgraph Services["Services Layer"]
            API["API Integration"]:::service
            API --> LibQuery["Library Queries"]:::service
            API --> UserQuery["User Queries"]:::service
            API --> GenreQuery["Genre Queries"]:::service
            API --> CurQuery["Curation Queries"]:::service
        end

        subgraph State["State Management Layer"]
            Store["Redux Store"]:::state
            Slices["Redux Slices"]:::state
            Context["Context Providers"]:::state

            Store --> Slices
            Store --> UserSlice["User Slice"]:::state
            Context --> GenreContext["Genre Context"]:::state
        end

        subgraph Config["Configuration Layer"]
            ChakraConfig["Chakra UI Theme"]:::config
            AxiosConfig["Axios Config"]:::config
            LayoutConfig["Layout Config"]:::config
        end
    end

    %% Click Events
    click Pages "https://github.com/JosephAyo/bibliotheque-e-frontend/tree/main//src/pages"
    click Login "https://github.com/JosephAyo/bibliotheque-e-frontend/blob/main//src/pages/login.jsx"
    click Signup "https://github.com/JosephAyo/bibliotheque-e-frontend/blob/main//src/pages/signup.jsx"
    click Verify "https://github.com/JosephAyo/bibliotheque-e-frontend/blob/main//src/pages/verification.jsx"
    click Books "https://github.com/JosephAyo/bibliotheque-e-frontend/tree/main//src/pages/library/books"
    click Curations "https://github.com/JosephAyo/bibliotheque-e-frontend/tree/main//src/pages/curations"
    click Genres "https://github.com/JosephAyo/bibliotheque-e-frontend/tree/main//src/pages/genres"
    click Components "https://github.com/JosephAyo/bibliotheque-e-frontend/tree/main//src/components"
    click Layouts "https://github.com/JosephAyo/bibliotheque-e-frontend/tree/main//src/components/Layouts"
    click Buttons "https://github.com/JosephAyo/bibliotheque-e-frontend/tree/main//src/components/Buttons"
    click Cards "https://github.com/JosephAyo/bibliotheque-e-frontend/tree/main//src/components/Cards"
    click Inputs "https://github.com/JosephAyo/bibliotheque-e-frontend/tree/main//src/components/Inputs"
    click Tables "https://github.com/JosephAyo/bibliotheque-e-frontend/tree/main//src/components/Tables"
    click AuthComps "https://github.com/JosephAyo/bibliotheque-e-frontend/tree/main//src/components/Wrappers"
    click API "https://github.com/JosephAyo/bibliotheque-e-frontend/tree/main//src/services/api"
    click LibQuery "https://github.com/JosephAyo/bibliotheque-e-frontend/blob/main//src/services/api/queries/library.js"
    click UserQuery "https://github.com/JosephAyo/bibliotheque-e-frontend/blob/main//src/services/api/queries/users.js"
    click GenreQuery "https://github.com/JosephAyo/bibliotheque-e-frontend/blob/main//src/services/api/queries/genre.js"
    click CurQuery "https://github.com/JosephAyo/bibliotheque-e-frontend/blob/main//src/services/api/queries/curation.js"
    click Store "https://github.com/JosephAyo/bibliotheque-e-frontend/blob/main//src/lib/store.js"
    click UserSlice "https://github.com/JosephAyo/bibliotheque-e-frontend/blob/main//src/lib/slices/createUserSlice.js"
    click GenreContext "https://github.com/JosephAyo/bibliotheque-e-frontend/blob/main//src/contexts/GenreContextProvider.jsx"
    click ChakraConfig "https://github.com/JosephAyo/bibliotheque-e-frontend/blob/main//src/config/chakraTheme.js"
    click AxiosConfig "https://github.com/JosephAyo/bibliotheque-e-frontend/blob/main//src/config/axios.js"
    click LayoutConfig "https://github.com/JosephAyo/bibliotheque-e-frontend/blob/main//src/config/layout.js"
    click AuthGate "https://github.com/JosephAyo/bibliotheque-e-frontend/blob/main//src/components/Wrappers/AuthorizationGate.jsx"
    click UserWrapper "https://github.com/JosephAyo/bibliotheque-e-frontend/blob/main//src/components/Wrappers/UserAuthWrapper.jsx"
    click AuthLayout "https://github.com/JosephAyo/bibliotheque-e-frontend/blob/main//src/components/Layouts/AuthPageLayout.jsx"
    click LibLayout "https://github.com/JosephAyo/bibliotheque-e-frontend/blob/main//src/components/Layouts/LibraryPageLayout.jsx"
    click Tables "https://github.com/JosephAyo/bibliotheque-e-frontend/blob/main//src/components/Tables/TableListContainer.jsx"

    %% Styling
    classDef pages fill:#e1f5fe,stroke:#01579b
    classDef page fill:#b3e5fc,stroke:#0288d1
    classDef component fill:#e8f5e9,stroke:#2e7d32
    classDef service fill:#fff3e0,stroke:#ef6c00
    classDef state fill:#f3e5f5,stroke:#7b1fa2
    classDef config fill:#fce4ec,stroke:#c2185b

    %% Legend
    subgraph Legend
        L1["Pages"]:::pages
        L2["Components"]:::component
        L3["Services"]:::service
        L4["State"]:::state
        L5["Config"]:::config
    end
```
