# skgezhil/insiit-h-react architecture

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

- Interactive diagram: https://gitdiagram.com/skgezhil/insiit-h-react
- Repository: https://github.com/skgezhil/insiit-h-react

## Overview

##### Project type and purpose
- This is a full-stack-style single-page application (SPA) built entirely on the frontend (React + TypeScript) with no in-repo backend code.
- Its purpose is to provide a content-driven platform: blog posts (rich text via EditorJS), Q&A/forum, admin review (approval queue, flagged content), user profiles, search, and Google OAuth authentication.

##### File structure
- Top-level files: configuration (.babelrc, jest.config.ts, vite.config.ts, tsconfig.json), build scripts, public/index.html.
- src/ contains all application code:
- components/ — UI widgets (header, footer, paginators, protected routes, accordions, editor, rendering elements).
- pages/ — route targets (HomePage, ForumPage, BlogPage, AdminPage, QuestionPage, etc.).
- layouts/ — higher-order wrappers (mainLayout, forumLayout, blogPageLayout, ProtectedRoute).
- store/ — Redux Toolkit slices and actions for app state (questions, blogs, users, admin queues, navigation).
- services/ — API integration layers (questionServices, blogServices, userService, adminServices, faqServices, tagService).
- context/ — React Context for cross-cutting concerns (authContext, toastContext).
- hooks/ — custom hooks for data fetching/progress.
- utils/ — pure helpers (formatDate, markdown/GraphQL string conversion).
- models/ — TypeScript data models (Question, User, Block).
- config/ — constants.

##### README for additional insights
- Confirms use of React 18, Vite, Redux Toolkit, React Router v6, Tailwind CSS, Material Tailwind, EditorJS with plugins, Fuse.js search, Google OAuth, TypeScript, Jest + RTL testing.
- No backend code in-repo; services likely wrap HTTP/GraphQL calls to an external API.

## Diagram (Mermaid)

```mermaid
flowchart TD
    %% Client Browser
    subgraph "Browser / Client" 
        direction TB
        CLIENT_ENTRY["public/index.html \n src/main.tsx \n src/App.tsx"]:::frontend
        subgraph "UI Components" 
            direction TB
            HEADER["Header"]:::frontend
            FOOTER["Footer"]:::frontend
            PAGINATOR["Pagination"]:::frontend
            PROTECTED_UI["Protected Helpers"]:::frontend
            SEARCHBAR["SearchBar"]:::frontend
            TAGCOMP["Tag Component"]:::frontend
            QLISTITEM["Question List Item"]:::frontend
            SIDEPANEL["Side Panel"]:::frontend
        end
        subgraph "Page Views"
            direction TB
            HOMEPAGE["HomePage"]:::frontend
            FORUMPAGE["ForumPage"]:::frontend
            FAQPAGE["FAQPage"]:::frontend
            QUESTIONPAGE["QuestionPage"]:::frontend
            ADMINPAGE["AdminPage"]:::frontend
            SEARCHPAGE["SearchPage"]:::frontend
            PROFILEPAGE["ProfilePage"]:::frontend
        end
        subgraph "Layouts & Guards"
            direction TB
            MAINLAYOUT["Main Layout"]:::frontend
            FORUMLAYOUT["Forum Layout"]:::frontend
            BLOGLAYOUT["Blog Page Layout"]:::frontend
            PROTECTEDROUTE["ProtectedRoute"]:::frontend
        end
        subgraph "EditorJS Subsystem"
            direction TB
            EDITORTOOLS["Editor Tools & Plugins"]:::frontend
            EDITORCOMP["Editor Component"]:::frontend
            ELEMENTRENDER["Element Renderer"]:::frontend
        end
        subgraph "Custom Hooks"
            direction TB
            USEGETQ["useGetQuestion"]:::logic
            USEPROGRESS["useProgress"]:::logic
        end
        subgraph "Utils & Models"
            direction TB
            FORMATDATE["formatDate"]:::logic
            GQLSTRING["GraphQL Conversion"]:::logic
            BLOCKMODEL["Block Model"]:::logic
        end
        ROUTES["Routing Definition"]:::frontend
    end

    %% State & Context
    subgraph "State Management & Context"
        direction TB
        STORE["Redux Store"]:::state
        AUTHCTX["Auth Context"]:::state
        TOASTCTX["Toast Context"]:::state
    end

    %% Services Layer
    subgraph "Services Layer"
        direction TB
        BLOGSERV["blogServices"]:::logic
        QUESTIONSERV["questionServices"]:::logic
        USERSERV["userService"]:::logic
        ADMINSERV["adminServices"]:::logic
        FAQSERV["faqServices"]:::logic
        TAGSERV["tagService"]:::logic
    end

    %% External Systems
    subgraph "External APIs"
        direction TB
        CONTENTAPI["Content API"]:::external
        OAUTH["Google OAuth"]:::external
        SEARCHENGINE["Client Fuse.js"]:::external
    end

    %% Build & Deployment
    subgraph "Build & Deployment"
        direction TB
        VITE["Vite"]:::state
        VERCEL["Vercel"]:::external
    end

    %% Connections
    CLIENT_ENTRY -->|loads| HEADER
    HEADER --> HOMEPAGE
    PAGINATOR --> QUESTIONPAGE
    PROTECTED_UI --> PROTECTEDROUTE
    SEARCHBAR -->|input| STORE
    CLIENT_ENTRY --> ROUTES
    ROUTES --> HOMEPAGE
    ROUTES --> FORUMPAGE
    ROUTES --> FAQPAGE

    HEADER --> STORE
    FOOTER --> STORE
    SIDEPANEL --> STORE

    HOMEPAGE -->|uses| STORE
    FORUMPAGE -->|dispatch| STORE
    QUESTIONPAGE -->|dispatch| STORE
    ADMINPAGE -->|reads| STORE

    MAINLAYOUT --> HOMEPAGE
    FORUMLAYOUT --> FORUMPAGE
    BLOGLAYOUT --> FAQPAGE

    EDITORCOMP --> EDITORTOOLS
    EDITORCOMP --> ELEMENTRENDER
    EDITORCOMP -->|save| BLOGSERV

    USEGETQ --> QUESTIONSERV
    USEPROGRESS --> STORE

    STORE -->|calls| BLOGSERV
    STORE -->|calls| QUESTIONSERV
    STORE -->|calls| USERSERV
    STORE -->|calls| ADMINSERV

    AUTHCTX -->|initiate| OAUTH
    OAUTH -->|callback| AUTHCTX
    AUTHCTX --> STORE

    BLOGSERV -->|HTTP| CONTENTAPI
    QUESTIONSERV -->|HTTP| CONTENTAPI
    ADMINSERV -->|HTTP| CONTENTAPI
    USERSERV -->|HTTP| CONTENTAPI

    SEARCHBAR --> SEARCHENGINE

    VITE --> CLIENT_ENTRY
    VITE --> ROUTES
    VITE --> STORE
    VITE --> BLOGSERV
    VERCEL -->|deploys| VITE

    %% Click Events
    click CLIENT_ENTRY "https://github.com/skgezhil/insiit-h-react/blob/main/public/index.html"
    click CLIENT_ENTRY "https://github.com/skgezhil/insiit-h-react/blob/main/src/main.tsx"
    click CLIENT_ENTRY "https://github.com/skgezhil/insiit-h-react/blob/main/src/App.tsx"
    click HEADER "https://github.com/skgezhil/insiit-h-react/blob/main/src/components/headerComponent.tsx"
    click FOOTER "https://github.com/skgezhil/insiit-h-react/blob/main/src/components/footerComponent.tsx"
    click PAGINATOR "https://github.com/skgezhil/insiit-h-react/blob/main/src/components/paginatorComponent.tsx"
    click PROTECTED_UI "https://github.com/skgezhil/insiit-h-react/blob/main/src/components/protectedComponent.tsx"
    click SEARCHBAR "https://github.com/skgezhil/insiit-h-react/blob/main/src/components/searchBar.tsx"
    click TAGCOMP "https://github.com/skgezhil/insiit-h-react/blob/main/src/components/tagComponent.tsx"
    click QLISTITEM "https://github.com/skgezhil/insiit-h-react/blob/main/src/components/questionListItem.tsx"
    click SIDEPANEL "https://github.com/skgezhil/insiit-h-react/blob/main/src/components/sideComponent.tsx"
    click HOMEPAGE "https://github.com/skgezhil/insiit-h-react/blob/main/src/pages/HomePage.tsx"
    click FORUMPAGE "https://github.com/skgezhil/insiit-h-react/blob/main/src/pages/ForumPage.tsx"
    click FAQPAGE "https://github.com/skgezhil/insiit-h-react/blob/main/src/pages/FAQPage.tsx"
    click QUESTIONPAGE "https://github.com/skgezhil/insiit-h-react/blob/main/src/pages/QuestionPage.tsx"
    click ADMINPAGE "https://github.com/skgezhil/insiit-h-react/blob/main/src/pages/AdminPage.tsx"
    click SEARCHPAGE "https://github.com/skgezhil/insiit-h-react/blob/main/src/pages/SearchPage.tsx"
    click PROFILEPAGE "https://github.com/skgezhil/insiit-h-react/blob/main/src/pages/ProfilePage.tsx"
    click MAINLAYOUT "https://github.com/skgezhil/insiit-h-react/blob/main/src/layouts/mainLayout.tsx"
    click FORUMLAYOUT "https://github.com/skgezhil/insiit-h-react/blob/main/src/layouts/forumLayout.tsx"
    click BLOGLAYOUT "https://github.com/skgezhil/insiit-h-react/blob/main/src/layouts/blogPageLayout.tsx"
    click PROTECTEDROUTE "https://github.com/skgezhil/insiit-h-react/blob/main/src/layouts/ProtectedRoute.tsx"
    click STORE "https://github.com/skgezhil/insiit-h-react/blob/main/src/store/store.ts"
    click AUTHCTX "https://github.com/skgezhil/insiit-h-react/blob/main/src/context/authContext.tsx"
    click TOASTCTX "https://github.com/skgezhil/insiit-h-react/blob/main/src/context/toastContext.tsx"
    click BLOGSERV "https://github.com/skgezhil/insiit-h-react/blob/main/src/services/blogServices.ts"
    click QUESTIONSERV "https://github.com/skgezhil/insiit-h-react/blob/main/src/services/questionServices.ts"
    click USERSERV "https://github.com/skgezhil/insiit-h-react/blob/main/src/services/userService.ts"
    click ADMINSERV "https://github.com/skgezhil/insiit-h-react/blob/main/src/services/adminServices.ts"
    click FAQSERV "https://github.com/skgezhil/insiit-h-react/blob/main/src/services/faqServices.ts"
    click TAGSERV "https://github.com/skgezhil/insiit-h-react/blob/main/src/services/tagService.ts"
    click EDITORTOOLS "https://github.com/skgezhil/insiit-h-react/blob/main/src/editorTools.js"
    click USEGETQ "https://github.com/skgezhil/insiit-h-react/blob/main/src/hooks/useGetQuestion.ts"
    click FORMATDATE "https://github.com/skgezhil/insiit-h-react/blob/main/src/utils/formatDate.ts"
    click GQLSTRING "https://github.com/skgezhil/insiit-h-react/blob/main/src/utils/graphqlStringConversion.ts"
    click BLOCKMODEL "https://github.com/skgezhil/insiit-h-react/blob/main/src/models/blockModel.ts"
    click ROUTES "https://github.com/skgezhil/insiit-h-react/blob/main/src/routes.tsx"

    %% Styles
    classDef frontend fill:#D0E8FF,stroke:#0D47A1,stroke-width:1px
    classDef state fill:#E0F2F1,stroke:#00695C,stroke-width:1px
    classDef external fill:#FFF3E0,stroke:#E65100,stroke-width:1px
    classDef logic fill:#FFF9C4,stroke:#F57F17,stroke-width:1px
```
