# yunusshaikh29/white-board architecture

> Architecture diagram of the GitHub repository yunusshaikh29/white-board, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2025-04-03). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/yunusshaikh29/white-board
- Repository: https://github.com/yunusshaikh29/white-board

## Overview

##### Overall Monorepo Structure
- Inside this container, create two distinct sections: one for “Apps” and another for “Packages.”

##### Main Components
a. Apps:

b. Packages:
- packages/backend-common: Contains shared backend utilities and common logic that might be used by the HTTP and WebSocket services.
- packages/common: Provides shared types and utilities used throughout the monorepo.
- packages/db: Contains all database related code, including the Prisma schema and migrations. It interfaces with your database.
- packages/eslint-config & packages/typescript-config: These provide standard linting and TypeScript configuration across the projects.
- packages/ui: A shared UI component library that the whiteboard app (and potentially other front-end projects) can reuse. It also includes a turbo generators folder to assist with generating UI components.

##### Relationships & Data Flow
- Whiteboard App depending on the shared UI components (packages/ui) as well as any common utilities (packages/common).

##### Architectural Patterns & Design Principles
- Separation of concerns: backend (HTTP/WS) vs. frontend (Whiteboard App).
- Modular and reusable nature of the monorepo approach, where shared packages provide common functionality across all services.
- An annotation that points out the use of TypeScript across the board, along with support for code linting (ESLint) and formatting (Prettier).
- Mention that the project uses Turborepo’s caching and task running mechanisms (shown by files like turbo.json, pnpm-workspace.yaml) to optimize builds and development workflows.

##### Additional Details
- Don’t forget to note the presence of both front-end and back-end functionality; in this case, the whiteboard app shows full Next.js routing (pages, layouts, components) while the HTTP and WebSocket apps provide backend services.
- A section noting build and development support (e.g., use of PNPM for package management, Turborepo for task running) as part of the overall system design.

## Diagram (Mermaid)

```mermaid
graph TD
    M["Monorepo (Turborepo Starter)"]
    
    subgraph "Apps"
        HTTP["apps/http – HTTP Service"]
        WS["apps/websocket – WebSocket Service"]
        WB["apps/whiteboard – Whiteboard App (Web Client)"]
    end
    
    subgraph "Packages"
        BComm["packages/backend-common – Backend Common"]
        CommonPkg["packages/common – Common Utilities"]
        DBPkg["packages/db – Database (Prisma)"]
        ESL["packages/eslint-config – ESLint Config"]
        TSC["packages/typescript-config – TypeScript Config"]
        UIPkg["packages/ui – UI Component Library"]
    end

    %% Monorepo contains both Apps and Packages
    M --> HTTP
    M --> WS
    M --> WB
    M --> BComm
    M --> CommonPkg
    M --> DBPkg
    M --> ESL
    M --> TSC
    M --> UIPkg

    %% Dependencies and Data Flow for backend services
    HTTP -->|"uses"| BComm
    HTTP -->|"uses"| CommonPkg
    HTTP -->|"accesses"| DBPkg

    WS -->|"uses"| BComm
    WS -->|"uses"| CommonPkg
    WS -->|"accesses"| DBPkg

    %% Dependencies for the Whiteboard Web Client
    WB -->|"uses"| UIPkg
    WB -->|"uses"| CommonPkg

    %% Styling Classes
    classDef monorepo fill:#F5B7B1,stroke:#C0392B,stroke-width:2px;
    classDef apps fill:#AED6F1,stroke:#1F618D,stroke-width:2px;
    classDef packages fill:#ABEBC6,stroke:#27AE60,stroke-width:2px;
    classDef database fill:#FAD7A0,stroke:#D35400,stroke-width:2px;

    class M monorepo;
    class HTTP,WS,WB apps;
    class BComm,CommonPkg,ESL,TSC,UIPkg packages;
    class DBPkg database;

    %% Click Events for Components
    click M "https://github.com/yunusshaikh29/white-board/blob/master/."
    click HTTP "https://github.com/yunusshaikh29/white-board/tree/master/apps/http"
    click WS "https://github.com/yunusshaikh29/white-board/tree/master/apps/websocket"
    click WB "https://github.com/yunusshaikh29/white-board/tree/master/apps/whiteboard"
    click BComm "https://github.com/yunusshaikh29/white-board/tree/master/packages/backend-common"
    click CommonPkg "https://github.com/yunusshaikh29/white-board/tree/master/packages/common"
    click DBPkg "https://github.com/yunusshaikh29/white-board/tree/master/packages/db"
    click ESL "https://github.com/yunusshaikh29/white-board/tree/master/packages/eslint-config"
    click TSC "https://github.com/yunusshaikh29/white-board/tree/master/packages/typescript-config"
    click UIPkg "https://github.com/yunusshaikh29/white-board/tree/master/packages/ui"
```
