# msoq/react-gm-2020 architecture

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

- Interactive diagram: https://gitdiagram.com/msoq/react-gm-2020
- Repository: https://github.com/msoq/react-gm-2020

## Overview

##### Project type and purpose
- This is a full-stack mentoring project, combining a React single-page-application (SPA) front end with a lightweight Node/TypeScript mock API server.
- Purpose: display and manage a list of movies via React components, Redux-style state modules, and communicate with a local mock service for CRUD operations.

##### File structure
- Top-level directories:
– config: Webpack build configurations for dev, prod, and common settings
– server: Express-style TypeScript server with routes, services, and mockData
– shared: TypeScript interfaces shared between front and back ends
– src: React app source (assets, components, hooks, routes, store, styles, utils)
- Patterns & conventions:
– Front-end: component-driven, Redux-pattern modules (store/modules)
– Back-end: MVC-inspired layering (routes → service interfaces → implementations → mock data)
– Build/test tooling: Webpack, Babel, Jest, ESLint, Prettier, nodemon

##### Detail without over-splitting
- Every meaningful layer: UI, state/store, HTTP client, API routes, service, data.
- Don’t fragment each tiny component—group similar UI widgets or store modules into logical clusters.

## Diagram (Mermaid)

```mermaid
flowchart TD
    %% User Interaction
    User["User"]:::external
    User -->|"interacts with"| UIComponents

    subgraph "Frontend" 
        direction TB
        UIComponents["UI Components"]:::frontend
        subgraph "UI Components"
            direction TB
            AppComponent["App Component"]:::frontend
            HeaderComponent["Header Component"]:::frontend
            MainComponent["Main Component"]:::frontend
            subgraph "Movie Components"
                direction TB
                MovieListComponent["MovieList Component"]:::frontend
                MovieItemComponent["MovieItem Component"]:::frontend
            end
            subgraph "Modals"
                direction TB
                CoreModal["Core Modal"]:::frontend
                DeleteModal["Delete Movie Modal"]:::frontend
                DetailsModal["Movie Details Modal"]:::frontend
                SuccessModal["Success Modal"]:::frontend
            end
        end

        subgraph "State Management"
            direction TB
            StoreSetup["Store Setup"]:::frontend
            StoreInterface["Store Interface"]:::frontend
            InitModule["Init Module"]:::frontend
            MoviesModule["Movies Module"]:::frontend
            MoviesEvents["Movies Events"]:::frontend
        end

        FrontRoutes["Front-End Routes"]:::frontend
        HandleErrorUtil["HTTP Utils"]:::frontend

        IndexHTML["HTML Template"]:::frontend
        IndexTSX["SPA Entry Point"]:::frontend

        %% Connections in Frontend
        UIComponents -->|renders| StoreSetup
        UIComponents -->|uses| FrontRoutes
        UIComponents -->|calls| HandleErrorUtil
        StoreSetup -->|imports| StoreInterface
        StoreSetup -->|initializes| InitModule
        InitModule -->|dispatches| MoviesModule
        MoviesModule -->|emits| MoviesEvents
        StoreSetup -->|bundles via| IndexTSX
        IndexTSX -->|includes| IndexHTML

        %% Build and Test Sidebars
        subgraph "Build & Test Tools"
            direction TB
            WebpackCommon["webpack.common.js"]:::tool
            WebpackDev["webpack.dev.js"]:::tool
            WebpackProd["webpack.prod.js"]:::tool
            WebpackUtils["config Utils"]:::tool
            JestConfig["jest.config.ts"]:::tool
            TestSetup["Test Setup"]:::tool
            TestMoviesModule["movies.module.test.ts"]:::tool
            TestHandleError["handleError.test.ts"]:::tool
        end
        IndexTSX -->|built by| WebpackCommon
        WebpackCommon --> WebpackDev
        WebpackCommon --> WebpackProd
        WebpackCommon --> WebpackUtils
        StoreSetup -->|tested by| TestMoviesModule
        HandleErrorUtil -->|tested by| TestHandleError
        TestMoviesModule --> TestSetup
        TestHandleError --> TestSetup
    end

    %% Shared Interfaces
    subgraph "Shared Types" 
        direction TB
        CoreModalContext["coreModal.context.ts"]:::shared
        CoreModalInterface["coreModal.interface.ts"]:::shared
        MovieModel["movies.model.ts"]:::shared
    end
    UIComponents ---|uses types| CoreModalInterface
    MoviesModule ---|uses model| MovieModel
    CoreModal ---|uses context| CoreModalContext

    %% Backend Zone
    subgraph "Backend" 
        direction TB
        ServerIndex["Server Entry Point"]:::backend
        subgraph "API Routes Layer"
            direction TB
            ServerRoutesIndex["routes/index.ts"]:::backend
            ServerRoutes["routes/routes.ts"]:::backend
        end
        subgraph "Service Layer"
            direction TB
            ServiceInterface["movies.service.interface.ts"]:::backend
            ServiceImpl["movies.service.ts"]:::backend
            ServerUtils["services utils.ts"]:::backend
        end
        MockData["MockData Store"]:::data
        %% Backend flows
        ServerIndex -->|registers| ServerRoutesIndex
        ServerRoutesIndex -->|defines endpoints| ServerRoutes
        ServerRoutes -->|calls| ServiceInterface
        ServiceInterface -->|implemented by| ServiceImpl
        ServiceImpl -->|uses| ServerUtils
        ServiceImpl -->|reads/writes| MockData

        %% HTTP boundary
        FrontRoutes -->|"HTTP API"| ServerRoutes
    end

    %% Click Events
    click IndexTSX "https://github.com/msoq/react-gm-2020/blob/master/src/index.tsx"
    click IndexHTML "https://github.com/msoq/react-gm-2020/blob/master/src/index.html"
    click AppComponent "https://github.com/msoq/react-gm-2020/blob/master/src/components/app/app.component.tsx"
    click HeaderComponent "https://github.com/msoq/react-gm-2020/blob/master/src/components/header/header.component.tsx"
    click MainComponent "https://github.com/msoq/react-gm-2020/blob/master/src/components/main/main.component.tsx"
    click MovieListComponent "https://github.com/msoq/react-gm-2020/blob/master/src/components/moviesList/moviesList.component.tsx"
    click MovieItemComponent "https://github.com/msoq/react-gm-2020/blob/master/src/components/movieItem/movieItem.component.tsx"
    click CoreModal "https://github.com/msoq/react-gm-2020/blob/master/src/components/modals/coreModal/coreModal.component.tsx"
    click DeleteModal "https://github.com/msoq/react-gm-2020/blob/master/src/components/modals/deleteMovieModal/deleteMovieModal.component.tsx"
    click DetailsModal "https://github.com/msoq/react-gm-2020/blob/master/src/components/modals/movieDetailsModal/movieDetailsModal.component.tsx"
    click SuccessModal "https://github.com/msoq/react-gm-2020/blob/master/src/components/modals/successModal/successModal.component.tsx"
    click FrontRoutes "https://github.com/msoq/react-gm-2020/blob/master/src/routes/index.ts"
    click ClickOutsideHook "https://github.com/msoq/react-gm-2020/blob/master/src/hooks/clickOutside.ts"
    click StoreSetup "https://github.com/msoq/react-gm-2020/blob/master/src/store/store.ts"
    click StoreInterface "https://github.com/msoq/react-gm-2020/blob/master/src/store/store.interface.ts"
    click InitModule "https://github.com/msoq/react-gm-2020/blob/master/src/store/modules/init.module.ts"
    click MoviesModule "https://github.com/msoq/react-gm-2020/blob/master/src/store/modules/movies.module.ts"
    click MoviesEvents "https://github.com/msoq/react-gm-2020/blob/master/src/store/modules/movies.events.ts"
    click HandleErrorUtil "https://github.com/msoq/react-gm-2020/blob/master/src/utils/handleError.ts"
    click WebpackCommon "https://github.com/msoq/react-gm-2020/blob/master/config/webpack.common.js"
    click WebpackDev "https://github.com/msoq/react-gm-2020/blob/master/config/webpack.dev.js"
    click WebpackProd "https://github.com/msoq/react-gm-2020/blob/master/config/webpack.prod.js"
    click WebpackUtils "https://github.com/msoq/react-gm-2020/blob/master/config/utils.js"
    click ServerIndex "https://github.com/msoq/react-gm-2020/blob/master/server/index.ts"
    click ServerRoutesIndex "https://github.com/msoq/react-gm-2020/blob/master/server/routes/index.ts"
    click ServerRoutes "https://github.com/msoq/react-gm-2020/blob/master/server/routes/routes.ts"
    click ServiceInterface "https://github.com/msoq/react-gm-2020/blob/master/server/services/movies.service.interface.ts"
    click ServiceImpl "https://github.com/msoq/react-gm-2020/blob/master/server/services/movies.service.ts"
    click ServerUtils "https://github.com/msoq/react-gm-2020/blob/master/server/services/utils.ts"
    click MockData "https://github.com/msoq/react-gm-2020/blob/master/server/mockData/movies.ts"
    click CoreModalContext "https://github.com/msoq/react-gm-2020/blob/master/shared/interfaces/coreModal.context.ts"
    click CoreModalInterface "https://github.com/msoq/react-gm-2020/blob/master/shared/interfaces/coreModal.interface.ts"
    click MovieModel "https://github.com/msoq/react-gm-2020/blob/master/shared/interfaces/movies.model.ts"
    click JestConfig "https://github.com/msoq/react-gm-2020/blob/master/jest.config.ts"
    click TestSetup "https://github.com/msoq/react-gm-2020/blob/master/setupTests.ts"
    click TestMoviesModule "https://github.com/msoq/react-gm-2020/blob/master/src/store/modules/__tests__/movies.module.test.ts"
    click TestHandleError "https://github.com/msoq/react-gm-2020/blob/master/src/utils/__test__/handleError.test.ts"

    %% Styles
    classDef frontend fill:#bbdefb,stroke:#1e88e5,color:#0d47a1
    classDef backend fill:#c8e6c9,stroke:#43a047,color:#1b5e20
    classDef shared fill:#f3e5f5,stroke:#8e24aa,color:#4a148c
    classDef tool fill:#eeeeee,stroke:#bdbdbd,color:#424242
    classDef data fill:#ffe0b2,stroke:#fb8c00,color:#e65100
    classDef external fill:#ffffff,stroke:#000000,color:#000000,stroke-dasharray: 2 2
```
