# liam-prevelige/pageturner-frontend architecture

> Architecture diagram of the GitHub repository liam-prevelige/pageturner-frontend, 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/liam-prevelige/pageturner-frontend
- Repository: https://github.com/liam-prevelige/pageturner-frontend

## Overview

##### Main Components

Frontend Layer:
- React Single Page Application (SPA)
- Key feature modules:
- Authentication
- Book Management
- Social Features
- Search Functionality
- Profile Management
- Book Club Features

Backend Layer (to be represented although not in this repo):
- Express.js Server
- MongoDB Database
- Authentication Service (Google OAuth)
- External APIs (Amazon Books API)

##### Component Organization

A. Client-Side (React):
- Auth Module
- Book Management Module (BookInfo, Bookshelf)
- Social Module (Comments, ShareBox, Timeline)
- Search Module (DynamicSearch)
- Profile Module
- Book Clubs Module

B. Layout Components:
- Persistent components:
- Sidebar (Navigation)
- RightBar (Trending, WhoFollow)
- Main Content Area

C. Data Flow Layer:
- API communication layer (src/api.js)
- State management
- Authentication flow

##### Relationships to Highlight

- Auth flow between Google OAuth and frontend
- Data flow between components and API
- Component hierarchy and nesting
- User interaction flows
- Real-time updates for social features

##### Key Architectural Patterns to Emphasize

- Component-based architecture
- Container/Presenter pattern
- Route-based code splitting
- Reusable component library

**[Client Browser] <-> [Frontend (React SPA)] <-> [Backend API] <-> [Database]**

- [External Services]

**[App.js]**
- [Auth Module]
- [Layout Components]
- [Sidebar]
- [Main Content]
- [RightBar]
- [Feature Modules]
- [Book Management]
- [Social Features]
- [Search]
- [Book Clubs]

## Diagram (Mermaid)

```mermaid
flowchart TB
    subgraph Client
        Browser[Client Browser]
    end

    subgraph Frontend["Frontend Layer"]
        App["App Container"]:::main
        click App "https://github.com/liam-prevelige/pageturner-frontend/blob/main/src/App.js"

        subgraph Auth["Authentication Module"]
            AuthComp["Auth Component"]:::auth
            click AuthComp "https://github.com/liam-prevelige/pageturner-frontend/blob/main/src/components/Auth/Auth.js"
        end

        subgraph Layout["Layout Components"]
            SideNav["Sidebar Navigation"]:::layout
            MainContent["Main Content Area"]:::layout
            RightSidebar["Right Sidebar"]:::layout
            BackNavigation["Back Navigation"]:::layout
            click SideNav "https://github.com/liam-prevelige/pageturner-frontend/blob/main/src/components/Sidebar/SideBar.js"
            click RightSidebar "https://github.com/liam-prevelige/pageturner-frontend/blob/main/src/components/RightBar/index.jsx"
            click BackNavigation "https://github.com/liam-prevelige/pageturner-frontend/blob/main/src/components/BackNav/BackNav.js"
        end

        subgraph Features["Feature Modules"]
            BookMgmt["Book Management"]:::feature
            Social["Social Features"]:::feature
            Search["Search"]:::feature
            Profile["Profile Management"]:::feature
            BookClubs["Book Clubs"]:::feature
            click BookMgmt "https://github.com/liam-prevelige/pageturner-frontend/blob/main/src/components/BookInfo/index.jsx"
            click Social "https://github.com/liam-prevelige/pageturner-frontend/blob/main/src/components/ThreadView/ThreadView.js"
            click Search "https://github.com/liam-prevelige/pageturner-frontend/blob/main/src/components/Search/index.js"
            click Profile "https://github.com/liam-prevelige/pageturner-frontend/blob/main/src/components/ProfilePage/index.jsx"
            click BookClubs "https://github.com/liam-prevelige/pageturner-frontend/blob/main/src/components/BookClubsPage/index.jsx"
        end

        subgraph BookFeatures["Book Management Components"]
            BookInfo["Book Info"]:::book
            Bookshelf["Bookshelf"]:::book
            click BookInfo "https://github.com/liam-prevelige/pageturner-frontend/blob/main/src/components/BookInfo/index.jsx"
            click Bookshelf "https://github.com/liam-prevelige/pageturner-frontend/blob/main/src/components/ProfilePage/Bookshelf.js"
        end

        subgraph SocialFeatures["Social Components"]
            Timeline["Timeline"]:::social
            ShareBox["Share Box"]:::social
            Comments["Comments"]:::social
            AttachBook["Attach Book Popup"]:::social
            AttachBookshelf["Attach Bookshelf Popup"]:::social
            click Timeline "https://github.com/liam-prevelige/pageturner-frontend/blob/main/src/components/Comment/Timeline.js"
            click ShareBox "https://github.com/liam-prevelige/pageturner-frontend/blob/main/src/components/ShareBox/ShareBox.js"
            click AttachBook "https://github.com/liam-prevelige/pageturner-frontend/blob/main/src/components/ShareBox/AttachBookPopup.js"
            click AttachBookshelf "https://github.com/liam-prevelige/pageturner-frontend/blob/main/src/components/ShareBox/AttachBookshelfPopup.js"
        end

        subgraph SearchFeatures["Search Components"]
            SearchMain["Search"]:::search
            DynamicSearch["Dynamic Search"]:::search
            click SearchMain "https://github.com/liam-prevelige/pageturner-frontend/blob/main/src/components/Search/index.js"
            click DynamicSearch "https://github.com/liam-prevelige/pageturner-frontend/blob/main/src/components/DynamicSearch/index.js"
        end

        subgraph RightBarFeatures["Right Sidebar Components"]
            Trending["Trending"]:::rightbar
            WhoFollow["Who to Follow"]:::rightbar
            click Trending "https://github.com/liam-prevelige/pageturner-frontend/blob/main/src/components/RightBar/Trending.js"
            click WhoFollow "https://github.com/liam-prevelige/pageturner-frontend/blob/main/src/components/RightBar/WhoFollow.js"
        end

        APILayer["API Communication Layer"]:::api
        click APILayer "https://github.com/liam-prevelige/pageturner-frontend/blob/main/src/api.js"
    end

    subgraph External["External Services"]
        GoogleOAuth["Google OAuth"]:::external
        AmazonAPI["Amazon Books API"]:::external
    end

    subgraph Backend["Backend Layer"]
        ExpressServer["Express.js Server"]:::backend
        MongoDB["MongoDB Database"]:::database
    end

    %% Connections
    Browser <--> App
    App --> Auth
    App --> Layout
    App --> Features
    App --> APILayer
    APILayer <--> ExpressServer
    ExpressServer <--> MongoDB
    Auth <--> GoogleOAuth
    ExpressServer <--> AmazonAPI

    %% Component Relationships
    Features --> BookFeatures
    Features --> SocialFeatures
    Features --> SearchFeatures
    Layout --> RightBarFeatures

    %% Styling
    classDef main fill:#f9f,stroke:#333,stroke-width:2px
    classDef auth fill:#b19cd9,stroke:#333
    classDef layout fill:#90caf9,stroke:#333
    classDef feature fill:#81c784,stroke:#333
    classDef book fill:#fff176,stroke:#333
    classDef social fill:#ff8a65,stroke:#333
    classDef search fill:#4db6ac,stroke:#333
    classDef rightbar fill:#9575cd,stroke:#333
    classDef api fill:#aed581,stroke:#333
    classDef external fill:#ffb74d,stroke:#333
    classDef backend fill:#64b5f6,stroke:#333
    classDef database fill:#ce93d8,stroke:#333
```
