# umttikhinadasha/it-bookstore architecture

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

- Interactive diagram: https://gitdiagram.com/umttikhinadasha/it-bookstore
- Repository: https://github.com/umttikhinadasha/it-bookstore

## Overview

##### Project type and purpose
- This is a single-page front-end application (no back-end code in this repo) for browsing and searching a catalog of IT books and authors.
- Built with React + TypeScript + Vite, uses Redux Toolkit for state management, React Router for navigation, Sass for styling, and follows the Feature-Sliced Design (FSD) methodology.
- Its main responsibilities:
- Render pages (home, search results, book details, categories, cart)
- Fetch data from external APIs (books, categories, authors, search) via the shared/api layer
- Manage UI state (themes, cart contents, search queries) in Redux
- Provide routing and theming

##### File structure and key directories
- src/app: application root
- App.tsx: mounts providers (Redux Provider, ThemeProvider, Router)
- layout/: global layout components (header, footer, main wrapper)
- routers/: React Router setup and route definitions
- providers/: context and service providers (theme, any future contexts)
- store.ts: Redux store configuration
- src/pages: page-level components, one directory per route
- src/features: reusable UI-behavior blocks with their own state slices and thunks
- search, cart features for dispatching actions and deriving selectors
- src/entities: domain-centric modules (author, book, category, cart, theme)
- Each entity contains model (Redux slice + thunks + selectors) and ui components
- src/widgets: higher-level UI components composed of entities and shared/UI elements
- src/shared: cross-cutting concerns
- api/: HTTP clients and endpoints for book, category, search
- lib/: utility hooks (debounce, media queries, price formatting)
- ui/: design system primitives (buttons, inputs, loaders, etc.)
- types, consts, assets

##### README for additional insights
- Clearly lists features: search, categories, author pages, cart, theming
- Technology stack confirms React, TS, Redux Toolkit, React Router, Sass, Vite
- FSD badge indicates how code is organized into layers (app, pages, features, entities, shared, widgets)

## Diagram (Mermaid)

```mermaid
flowchart TD
    %% App Layer
    subgraph "App Layer"
        direction TB
        AppShell["App Shell"]:::app
        GlobalLayout["Global Layout"]:::app
        Providers["Providers (Redux & Theme)"]:::app
        Router["Routing Layer"]:::app
        Store["Redux Store"]:::db
    end

    %% Pages Layer
    subgraph "Pages" 
        direction TB
        HomePage["Home Page"]:::pages
        SearchResultsPage["Search Results Page"]:::pages
        BookDescriptionPage["Book Description Page"]:::pages
        CategoriesPage["Categories Page"]:::pages
        CategoryPage["Category Page"]:::pages
        CartPage["Cart Page"]:::pages
    end

    %% Features Layer
    subgraph "Features"
        direction TB
        SearchSlice["Search Feature Slice"]:::feature
        SearchThunk["Search Feature Thunk"]:::feature
        SearchUI["Search UI Component"]:::feature
        CartUI["Cart Feature UI (Add to Cart)"]:::feature
    end

    %% Entities Layer
    subgraph "Entities"
        direction TB
        BookListSlice["Book List Slice"]:::entity
        BookListThunk["Book List Thunk"]:::entity
        BookPreviewUI["Book Preview UI"]:::entity
        BookDescSlice["Book Description Slice"]:::entity
        BookDescThunk["Book Description Thunk"]:::entity
        AuthorUI["Author UI Component"]:::entity
        CategoryPreviewSlice["Category Preview Slice"]:::entity
        ThemeUI["Theme Provider UI"]:::entity
        ThemeConfig["Theme Context Config"]:::entity
        UseTheme["useTheme Hook"]:::entity
    end

    %% Shared Layer
    subgraph "Shared"
        direction TB
        subgraph "API Clients"
            BaseClient["Base HTTP Client"]:::shared
            BookAPI["Book API"]:::shared
            CategoryAPI["Category API"]:::shared
            SearchAPI["Search API"]:::shared
        end
        subgraph "Utility Hooks"
            Debounce["useDebounce"]:::shared
            MediaQuery["useMediaQuery"]:::shared
        end
        subgraph "UI Primitives"
            Button["Button"]:::shared
            Input["Input"]:::shared
            Loader["Loader (Book List)"]:::shared
        end
    end

    %% Widgets Layer
    subgraph "Widgets"
        direction TB
        Header["Header Widget"]:::ui
        Footer["Footer Widget"]:::ui
        BookDetailsWidget["Book Details Widget"]:::ui
        PaginationWidget["Book List Pagination Widget"]:::ui
        SliderWidget["Slider Widget"]:::ui
        ProductCategoryWidget["Product Category Widget"]:::ui
    end

    %% External Services
    subgraph "External Services"
        direction TB
        BookService["Book API Service"]:::external
        CategoryService["Category API Service"]:::external
        SearchService["Search API Service"]:::external
    end

    %% Connections
    AppShell --> Providers
    Providers --> Store
    AppShell --> GlobalLayout
    AppShell --> Router
    Router --> HomePage
    Router --> SearchResultsPage
    Router --> BookDescriptionPage
    Router --> CategoriesPage
    Router --> CategoryPage
    Router --> CartPage

    HomePage -->|dispatches| SearchUI
    HomePage -->|uses| BookPreviewUI
    SearchResultsPage -->|dispatches| SearchThunk
    SearchResultsPage -->|selects| BookListSlice
    BookDescriptionPage -->|dispatches| BookDescThunk
    CategoriesPage -->|selects| CategoryPreviewSlice
    CategoryPage -->|dispatches| CategoryPreviewSlice
    CartPage -->|dispatches| CartUI
    CartUI -->|updates| Store

    SearchUI -->|uses| SearchSlice
    SearchSlice -->|calls| SearchThunk
    SearchThunk -->|calls| SearchAPI
    SearchAPI -->|HTTP| SearchService

    BookListThunk -->|calls| BookAPI
    BookAPI -->|HTTP| BookService
    BookDescThunk -->|calls| BookAPI
    CategoryAPI -->|HTTP| CategoryService

    ThemeUI -->|uses| ThemeConfig
    ThemeConfig -->|provides| UseTheme

    BookPreviewUI -->|uses| Button
    BookPreviewUI -->|uses| Loader
    SearchUI -->|uses| Input
    Header -->|uses| Button
    SliderWidget -->|uses| Debounce
    MediaQuery -->|used by| UI

    %% Click Events
    click AppShell "https://github.com/umttikhinadasha/it-bookstore/blob/main/src/app/App.tsx"
    click GlobalLayout "https://github.com/umttikhinadasha/it-bookstore/blob/main/src/app/layout/layout.tsx"
    click Providers "https://github.com/umttikhinadasha/it-bookstore/blob/main/src/app/providers/providers.tsx"
    click Router "https://github.com/umttikhinadasha/it-bookstore/blob/main/src/app/routers/appRouter.tsx"
    click Store "https://github.com/umttikhinadasha/it-bookstore/blob/main/src/app/store.ts"

    click HomePage "https://github.com/umttikhinadasha/it-bookstore/blob/main/src/pages/homePage/ui/homePage.tsx"
    click SearchResultsPage "https://github.com/umttikhinadasha/it-bookstore/blob/main/src/pages/searchResults/ui/searchResults.tsx"
    click BookDescriptionPage "https://github.com/umttikhinadasha/it-bookstore/blob/main/src/pages/bookDescription/ui/bookDescription.tsx"
    click CategoriesPage "https://github.com/umttikhinadasha/it-bookstore/blob/main/src/pages/categories/ui/categories.tsx"
    click CategoryPage "https://github.com/umttikhinadasha/it-bookstore/blob/main/src/pages/category/ui/category.tsx"
    click CartPage "https://github.com/umttikhinadasha/it-bookstore/blob/main/src/pages/cart/ui/cart.tsx"

    click SearchSlice "https://github.com/umttikhinadasha/it-bookstore/blob/main/src/features/search/model/searchSlice.ts"
    click SearchThunk "https://github.com/umttikhinadasha/it-bookstore/blob/main/src/features/search/model/searchThunk.ts"
    click SearchUI "https://github.com/umttikhinadasha/it-bookstore/blob/main/src/features/search/ui/search/search.tsx"
    click CartUI "https://github.com/umttikhinadasha/it-bookstore/blob/main/src/features/cart/ui/addToCart.tsx"

    click BookListSlice "https://github.com/umttikhinadasha/it-bookstore/blob/main/src/entities/book/bookList/model/bookListSlice.ts"
    click BookListThunk "https://github.com/umttikhinadasha/it-bookstore/blob/main/src/entities/book/bookList/model/bookListThunk.ts"
    click BookPreviewUI "https://github.com/umttikhinadasha/it-bookstore/blob/main/src/entities/book/bookPreview/ui/bookPreview.tsx"
    click BookDescSlice "https://github.com/umttikhinadasha/it-bookstore/blob/main/src/entities/book/bookDescripton/model/bookDescriptionSlice.ts"
    click BookDescThunk "https://github.com/umttikhinadasha/it-bookstore/blob/main/src/entities/book/bookDescripton/model/bookDescriptionThunk.ts"
    click AuthorUI "https://github.com/umttikhinadasha/it-bookstore/blob/main/src/entities/author/ui/author.tsx"
    click CategoryPreviewSlice "https://github.com/umttikhinadasha/it-bookstore/blob/main/src/entities/categoryPreview/model/categoryPreviewSlice.ts"
    click ThemeUI "https://github.com/umttikhinadasha/it-bookstore/blob/main/src/entities/theme/ui/themeProvider.tsx"
    click ThemeConfig "https://github.com/umttikhinadasha/it-bookstore/blob/main/src/entities/theme/config/themeContext.ts"
    click UseTheme "https://github.com/umttikhinadasha/it-bookstore/blob/main/src/entities/theme/lib/useTheme.tsx"

    click BaseClient "https://github.com/umttikhinadasha/it-bookstore/blob/main/src/shared/api/base.ts"
    click BookAPI "https://github.com/umttikhinadasha/it-bookstore/blob/main/src/shared/api/book/index.ts"
    click CategoryAPI "https://github.com/umttikhinadasha/it-bookstore/blob/main/src/shared/api/category/index.ts"
    click SearchAPI "https://github.com/umttikhinadasha/it-bookstore/blob/main/src/shared/api/search/index.ts"
    click Debounce "https://github.com/umttikhinadasha/it-bookstore/blob/main/src/shared/lib/debounce/useDebounce.ts"
    click MediaQuery "https://github.com/umttikhinadasha/it-bookstore/blob/main/src/shared/lib/media/useMediaQuery.ts"

    click Button "https://github.com/umttikhinadasha/it-bookstore/blob/main/src/shared/ui/button/button.tsx"
    click Input "https://github.com/umttikhinadasha/it-bookstore/blob/main/src/shared/ui/input/input.tsx"
    click Loader "https://github.com/umttikhinadasha/it-bookstore/blob/main/src/shared/ui/loaders/loaderBookList/loaderBookList.tsx"

    click Header "https://github.com/umttikhinadasha/it-bookstore/blob/main/src/widgets/header/ui/header.tsx"
    click Footer "https://github.com/umttikhinadasha/it-bookstore/blob/main/src/widgets/footer/ui/footer.tsx"
    click BookDetailsWidget "https://github.com/umttikhinadasha/it-bookstore/blob/main/src/widgets/bookDetails/ui/bookDetails.tsx"
    click PaginationWidget "https://github.com/umttikhinadasha/it-bookstore/blob/main/src/widgets/bookListPagination/ui/bookListPagination.tsx"
    click SliderWidget "https://github.com/umttikhinadasha/it-bookstore/blob/main/src/widgets/slider/ui/slider.tsx"
    click ProductCategoryWidget "https://github.com/umttikhinadasha/it-bookstore/blob/main/src/widgets/productСategory/ui/productСategory.tsx"

    %% Styles
    classDef app fill:#daf1fd,stroke:#0275d8,color:#000
    classDef pages fill:#dff6dd,stroke:#28a745,color:#000
    classDef feature fill:#fff4d6,stroke:#f0ad4e,color:#000
    classDef entity fill:#fff4d6,stroke:#f0ad4e,color:#000
    classDef shared fill:#e2e3e5,stroke:#6c757d,color:#000
    classDef ui fill:#f8f9fa,stroke:#343a40,color:#000
    classDef db fill:#fff0f0,stroke:#d9534f,color:#000
    classDef external fill:#f3e5f5,stroke:#6f42c1,color:#000
```
