# dev-enforced/mi-stream architecture

> Architecture diagram of the GitHub repository dev-enforced/mi-stream, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2025-06-06). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/dev-enforced/mi-stream
- Repository: https://github.com/dev-enforced/mi-stream

## Overview

##### Project type and purpose
- This is a full-stack monolithic video library application (“MI STREAM”) built with a React front end and a small Express.js-based mock backend.
- The README describes features such as user authentication, liking videos, watch-later, playlists, history tracking, and category filtering.

##### File structure
- Top-level “public” folder holds static assets and the single-page entrypoint (index.html).
- “src” holds everything else, divided into:
- /backend – an Express server (server.js), organized into controllers, in-memory “db” modules, and utility functions.
- /components, /pages, /routes – the React UI, composed of presentational components and page-level containers.
- /services – a client-side API layer that wraps HTTP calls to backend endpoints.
- /reduxFiles – Redux Toolkit slices and store setup for state management.
- /utilities, /hooks, /constants – shared helper logic, custom hooks, and constant definitions.
- There are also config files (jsconfig.json), package.json, and build/deployment config under “public.”

##### README for additional insights
- The README confirms the tech stack (ReactJS, React Router, Redux Toolkit, Express via Mockbee data).
- No external persistent database—data is served from in-memory JS files in /src/backend/db.
- No microservices or external authentication providers; everything runs in one Node process.

## Diagram (Mermaid)

```mermaid
flowchart TB
    %% Client Side
    subgraph "Client-Side"
        direction TB
        subgraph "Presentation UI"
            UIComponents["UI Components"]:::client
            PageContainers["Page Containers"]:::client
        end
        subgraph "Routing"
            AppRoutes["AppRoutes.jsx"]:::client
            ProtectedRoutes["ProtectedRoutes.jsx"]:::client
        end
        subgraph "State Management"
            ReduxStore["Redux Store"]:::client
            StateSlices["State Slices"]:::client
        end
        subgraph "Service Layer"
            Services["API Services"]:::client
        end
        subgraph "Utilities & Hooks"
            Utilities["Utilities & Hooks & Constants"]:::client
        end
        UIComponents -->|renders pages| PageContainers
        PageContainers -->|uses| AppRoutes
        PageContainers -->|uses| ProtectedRoutes
        PageContainers -->|dispatches actions| ReduxStore
        ReduxStore -->|manages| StateSlices
        StateSlices -->|calls| Services
        Services -->|sends HTTP requests| ServerEntry
        PageContainers -->|uses| Utilities
    end

    %% Server Side
    subgraph "Server-Side"
        direction TB
        ServerEntry["server.js"]:::server
        subgraph "Controllers"
            AuthController["AuthController.js"]:::server
            VideoController["VideoController.js"]:::server
            CategoryController["CategoryController.js"]:::server
            HistoryController["HistoryController.js"]:::server
            LikeController["LikeController.js"]:::server
            WatchLaterController["WatchLaterController.js"]:::server
            PlaylistController["PlaylistController.js"]:::server
        end
        AuthUtils["authUtils.js"]:::server
        ServerEntry -->|routes to| AuthController
        ServerEntry -->|routes to| VideoController
        ServerEntry -->|routes to| CategoryController
        ServerEntry -->|routes to| HistoryController
        ServerEntry -->|routes to| LikeController
        ServerEntry -->|routes to| WatchLaterController
        ServerEntry -->|routes to| PlaylistController
        AuthController -->|verifies tokens| AuthUtils
        VideoController -->|reads/writes| DBVideos
        CategoryController -->|reads/writes| DBCategories
        HistoryController -->|reads/writes| DBUsers
        LikeController -->|reads/writes| DBUsers
        WatchLaterController -->|reads/writes| DBUsers
        PlaylistController -->|reads/writes| DBUsers
    end

    %% In-Memory Database
    subgraph "In-Memory DB Modules"
        direction TB
        DBUsers["users.js"]:::db
        DBVideos["videos.js"]:::db
        DBCategories["categories.js"]:::db
    end

    %% External Dependencies
    subgraph "External Dependencies"
        direction TB
        YouTube["YouTube Embed"]:::external
        CDN["CDN Resources"]:::external
    end

    PlaylistController -->|embeds videos| YouTube

    %% Click Events
    click UIComponents "https://github.com/dev-enforced/mi-stream/tree/development/src/components"
    click PageContainers "https://github.com/dev-enforced/mi-stream/tree/development/src/pages"
    click AppRoutes "https://github.com/dev-enforced/mi-stream/blob/development/src/routes/AppRoutes.jsx"
    click ProtectedRoutes "https://github.com/dev-enforced/mi-stream/blob/development/src/routes/ProtectedRoutes.jsx"
    click ReduxStore "https://github.com/dev-enforced/mi-stream/blob/development/src/reduxFiles/store/index.js"
    click StateSlices "https://github.com/dev-enforced/mi-stream/tree/development/src/reduxFiles/reducers"
    click Services "https://github.com/dev-enforced/mi-stream/tree/development/src/services"
    click Utilities "https://github.com/dev-enforced/mi-stream/tree/development/src/utilities"
    click ServerEntry "https://github.com/dev-enforced/mi-stream/blob/development/src/server.js"
    click AuthController "https://github.com/dev-enforced/mi-stream/tree/development/src/backend/controllers"
    click VideoController "https://github.com/dev-enforced/mi-stream/tree/development/src/backend/controllers"
    click CategoryController "https://github.com/dev-enforced/mi-stream/tree/development/src/backend/controllers"
    click HistoryController "https://github.com/dev-enforced/mi-stream/tree/development/src/backend/controllers"
    click LikeController "https://github.com/dev-enforced/mi-stream/tree/development/src/backend/controllers"
    click WatchLaterController "https://github.com/dev-enforced/mi-stream/tree/development/src/backend/controllers"
    click PlaylistController "https://github.com/dev-enforced/mi-stream/tree/development/src/backend/controllers"
    click AuthUtils "https://github.com/dev-enforced/mi-stream/blob/development/src/backend/utils/authUtils.js"
    click DBUsers "https://github.com/dev-enforced/mi-stream/tree/development/src/backend/db"
    click DBVideos "https://github.com/dev-enforced/mi-stream/tree/development/src/backend/db"
    click DBCategories "https://github.com/dev-enforced/mi-stream/tree/development/src/backend/db"

    %% Styles
    classDef client fill:#bbdefb,stroke:#0d47a1,stroke-width:1px
    classDef server fill:#c8e6c9,stroke:#1b5e20,stroke-width:1px
    classDef db fill:#ffe0b2,stroke:#e65100,stroke-width:1px
    classDef external fill:#ffcc80,stroke:#ef6c00,stroke-width:1px
```
