# idandavid1/my-day architecture

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

- Interactive diagram: https://gitdiagram.com/idandavid1/my-day
- Repository: https://github.com/idandavid1/my-day

## Overview

##### Project Type and Purpose
- The project is a full-stack web application inspired by Monday.com. Its primary purpose is to offer a table-style, drag-and-drop project management board with real-time collaboration. The clone (named “MyDay”) replicates the core functionalities of Monday.com, including boards, groups, tasks with detailed properties, and live updates via web sockets.
- The README confirms the use of a MERN stack (MongoDB, Express, React, Node.js) with additional tools like SASS for styling, Google Login for authentication, and third-party libraries (e.g., lodash, D&D libraries).

##### File Structure
- The top-level structure separates the project neatly into two directories: “backend” and “frontend”.
- In the “backend” directory, observe:
- API subdirectories for “auth”, “board”, and “user” under backend/api, each containing controllers, routes, and service files; this suggests a RESTful API architecture.
- Configuration files (in backend/config) for environment-specific settings (development, production).
- Middlewares (logging, authentication, setting up async local storage) that handle request pre-processing.
- Services handling database connections (db.service.js), WebSocket interactions (socket.service.js), logging, and utilities.
- A public directory holding static assets for potential serving of a client bundle.
- The main server file (server.js) that initializes the Express server.
- In the “frontend” directory, notice:
- A typical React project structure with a “src” folder containing components (“cmps”), pages, custom hooks, services, and a store (Redux).
- Extensive styling included in SCSS organized by component types.
- Public assets and media for the UI.
- This separation emphasizes a clear client–server architecture with REST APIs on the backend and a responsive, feature-rich React UI on the frontend.

##### README for Additional Insights
- The README provides an overview outlining the project’s features (boards, tasks, D&D, real-time updates, advanced modals for editing tasks, etc.) and describes the employed technologies including the WebSockets layer for live updates.
- It clarifies that the backend provides REST API endpoints while the frontend handles the user interface and state management.

a. Main Components to Include:
- Frontend (React SPA):
- Components, Pages, and UI Management (illustrated via "cmps", "pages", and "store").
- Communication with backend via HTTP REST calls and WebSocket live updates.
- Backend (Express Server):
- API Layer: Distinct services for Authentication, Boards, and Users.
- Middlewares for logging, authorization, and async local storage.
- Business Logic Layer: Controllers and Services managing business rules.
- Static File Serving (in the “public” folder) for frontend assets if they are served from the backend.
- Database (MongoDB): (While not explicitly shown in the file tree, the MERN stack implies MongoDB usage.)
- WebSocket Service: Manages real-time board updates and chat features.
- External Integration: Google Login service and potentially third-party libraries (like lodash, drag-and-drop libraries).

b. Relationships and Interactions:
- Connections from the Backend to the Database (MongoDB) for data persistence.
- How middlewares intercept requests before reaching controllers.

c. Architectural Patterns & Design Principles:
- Separation of concerns between client and server.
- Use of MVC-like architecture on the backend (Controllers, Services, Routes) and component-based architecture in the frontend.
- The use of middleware in Express for request handling/processing.
- Real-time update mechanism using WebSockets.

d. Relevant Technologies & Frameworks:
- Node.js, Express for the backend.
- React and Redux for the frontend.
- SASS for styling.
- Third-party libraries such as lodash and D&D libraries.
- WebSocket implementation for real-time communication.
- MongoDB as the data store.

##### Specific Elements
- Use clear labels for each component (e.g., “React Frontend”, “Express API: Auth/Board/User”, “MongoDB Database”, “WebSocket Service”, “Middleware”).
- From the Frontend to API endpoints (for CRUD operations).
- Including additional annotations such as major endpoints, lifecycle flows (request => middleware => controller => service => database), and interactions between modules.

## Diagram (Mermaid)

```mermaid
flowchart TD
    %% Frontend Layer
    subgraph "Frontend Layer"
        A["React Frontend"]:::frontend
        B["Frontend Components"]:::frontend
        C["Frontend Pages"]:::frontend
        W["Socket Service (Frontend)"]:::frontend
    end

    %% Backend Layer
    subgraph "Backend Layer"
        subgraph "Express Server"
            H["Middlewares"]:::middleware
            subgraph "REST API"
                E["Auth API"]:::backend
                F["Boards API"]:::backend
                G["Users API"]:::backend
            end
            I["Business Logic & Utility Services"]:::backend
            J["Socket Service (Backend)"]:::backend
            K["Static File Serving"]:::backend
        end
        N["Google Auth Service"]:::external
    end

    %% Database
    M["Database (MongoDB)"]:::db

    %% Connections - Frontend to REST API
    A -->|"REST"| E
    A -->|"REST"| F
    A -->|"REST"| G

    %% Middlewares processing API requests
    H -->|"processes"| E
    H -->|"processes"| F
    H -->|"processes"| G

    %% API to Business Logic then Database
    E -->|"logic"| I
    F -->|"logic"| I
    G -->|"logic"| I
    I -->|"db call"| M

    %% WebSocket Connections
    A -->|"WS_connect"| W
    W <-->|"live_updates"| J

    %% External Authentication
    E -->|"OAuth"| N

    %% Static File Serving to Frontend assets
    K -->|"serves"| A

    %% Click Events
    click A "https://github.com/idandavid1/my-day/tree/main/frontend/src"
    click B "https://github.com/idandavid1/my-day/tree/main/frontend/src/cmps"
    click C "https://github.com/idandavid1/my-day/tree/main/frontend/src/pages"
    click E "https://github.com/idandavid1/my-day/tree/main/backend/api/auth"
    click F "https://github.com/idandavid1/my-day/tree/main/backend/api/board"
    click G "https://github.com/idandavid1/my-day/tree/main/backend/api/user"
    click H "https://github.com/idandavid1/my-day/tree/main/backend/middlewares"
    click J "https://github.com/idandavid1/my-day/blob/main/backend/services/socket.service.js"
    click W "https://github.com/idandavid1/my-day/blob/main/frontend/src/services/socket.service.js"
    click I "https://github.com/idandavid1/my-day/tree/main/backend/services"
    click K "https://github.com/idandavid1/my-day/tree/main/backend/public"

    %% Styles
    classDef frontend fill:#cce5ff,stroke:#0056b3,stroke-width:2px;
    classDef backend fill:#d4edda,stroke:#155724,stroke-width:2px;
    classDef middleware fill:#fff3cd,stroke:#856404,stroke-width:2px;
    classDef external fill:#f8d7da,stroke:#721c24,stroke-width:2px;
    classDef db fill:#e2e3e5,stroke:#6c757d,stroke-width:2px;
```
