# yzuagile/2025-team-b architecture

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

- Interactive diagram: https://gitdiagram.com/yzuagile/2025-team-b
- Repository: https://github.com/yzuagile/2025-team-b

## Overview

##### Project type and purpose
- Purpose: manage notes (create, find, get, update) via controllers (`RecentlyEditedController`, `ShowTitle`) backed by a file-system utility.

##### Top-level components
a. Renderer (React UI) – `src/renderer`
b. Preload script (IPC bridge) – `src/preload/preload.ts`
c. Main process (Node backend) – `src/main/index.ts`
d. Business logic (“backend”) – `src/backend`
- Controllers (`controller/…`)
- Models (`model/…`)
- Interfaces (`interfaces/Note.d.ts`)
- Utilities (`utils/FileManager.ts`)
e. Data store – local file system via `FileManager`
f. Test harness – `__test__`, Jest config

##### Key interactions & dataflow
1. User interacts with the UI (React components in `App.tsx`).
2. UI invokes exposed APIs on `window` (set up in `preload.ts`).
3. Preload forwards calls over IPC to the Main process.
4. Main process receives IPC, delegates to controller in `src/backend/controller`.
5. Controller uses model functions in `src/backend/model` (create/find/get/update).
6. Model calls into `FileManager` to read/write JSON or other files.
7. Responses bubble back through controller → main → preload → renderer, updating the UI.

##### Architectural patterns & principles
- Electron’s multi-process architecture: Renderer vs. Main
- MVC-style separation in the backend: Controllers → Models → Data Utils
- IPC boundary clearly enforced by the preload script
- File-based persistence via a utility layer (`FileManager`) instead of a separate DB

##### Technologies & frameworks
- Electron (main, preload, renderer)
- React + Vite (`vite.config.ts`) in the renderer
- TypeScript throughout
- Jest for unit tests, 100% coverage enforced
- Node.js file‐system APIs in `FileManager`

## Diagram (Mermaid)

```mermaid
flowchart TD
    %% Renderer Layer
    subgraph "Renderer (React UI)"
        direction TB
        App["App.tsx"]:::ui
        Entry["main.tsx"]:::ui
        HTML["index.html"]:::ui
        Boot["renderer.ts"]:::ui
        Style["style.css"]:::ui
    end

    %% IPC Bridge
    Preload["Preload (IPC Bridge)"]:::ipc

    %% Main Process
    Main["Main Process"]:::main

    %% Backend Logic
    subgraph "Backend Logic"
        direction TB
        subgraph "Controllers"
            direction TB
            REC["RecentlyEditedController"]:::main
            Show["ShowTitle"]:::main
        end
        subgraph "Models"
            direction TB
            Create["create.ts"]:::main
            Find["find.ts"]:::main
            Get["get.ts"]:::main
            Update["update.ts"]:::main
        end
        NoteIF["Note.d.ts"]:::main
        subgraph "Utilities"
            FileMgr["FileManager.ts"]:::main
            FileMgrTypes["FileManager.d.ts"]:::main
        end
    end

    %% Data Store
    FS["File System"]:::data

    %% Test Suite
    subgraph "Test Suite"
        direction TB
        FMTest["FileManager.test.ts"]:::test
        RECt["RecentlyEditedController.test.ts"]:::test
        Showt["ShowTitle.test.ts"]:::test
        Crt["create.test.ts"]:::test
        Findt["find.test.ts"]:::test
        Gett["get.test.ts"]:::test
        Upt["update.test.ts"]:::test
        TD["TestData.ts"]:::test
    end

    %% Configuration
    subgraph "Config & Metadata"
        direction TB
        JestCfg["jest.config.js"]:::test
        TSConfig["tsconfig.json"]:::test
        ViteCfg["vite.config.ts"]:::test
        PKG["package.json"]:::test
        PKGLock["package-lock.json"]:::test
    end

    %% Flows
    App -->|UI invokes| Preload
    Entry -->|bootstrap| App
    Preload -->|IPC invoke| Main
    Main -->|delegate| REC
    Main -->|delegate| Show
    REC -->|uses| Create
    REC -->|uses| Find
    Show -->|uses| Get
    Show -->|uses| Update
    Create -->|read/write| FileMgr
    Find -->|read/write| FileMgr
    Get -->|read/write| FileMgr
    Update -->|read/write| FileMgr
    FileMgr -->|fs operations| FS

    %% Response flows (dashed back)
    FS -.-> FileMgr
    FileMgr -.-> Create
    Create -.-> REC
    REC -.-> Main
    Main -.-> Preload
    Preload -.-> App

    %% Click Events
    click App "https://github.com/yzuagile/2025-team-b/blob/main/src/renderer/App.tsx"
    click Entry "https://github.com/yzuagile/2025-team-b/blob/main/src/renderer/main.tsx"
    click HTML "https://github.com/yzuagile/2025-team-b/blob/main/src/renderer/index.html"
    click Boot "https://github.com/yzuagile/2025-team-b/blob/main/src/renderer/renderer.ts"
    click Style "https://github.com/yzuagile/2025-team-b/blob/main/src/renderer/style.css"
    click Preload "https://github.com/yzuagile/2025-team-b/blob/main/src/preload/preload.ts"
    click Main "https://github.com/yzuagile/2025-team-b/blob/main/src/main/index.ts"
    click REC "https://github.com/yzuagile/2025-team-b/blob/main/src/backend/controller/RecentlyEditedController.ts"
    click Show "https://github.com/yzuagile/2025-team-b/blob/main/src/backend/controller/ShowTitle.ts"
    click Create "https://github.com/yzuagile/2025-team-b/blob/main/src/backend/model/create.ts"
    click Find "https://github.com/yzuagile/2025-team-b/blob/main/src/backend/model/find.ts"
    click Get "https://github.com/yzuagile/2025-team-b/blob/main/src/backend/model/get.ts"
    click Update "https://github.com/yzuagile/2025-team-b/blob/main/src/backend/model/update.ts"
    click NoteIF "https://github.com/yzuagile/2025-team-b/blob/main/src/backend/interfaces/Note.d.ts"
    click FileMgr "https://github.com/yzuagile/2025-team-b/blob/main/src/backend/utils/FileManager.ts"
    click FileMgrTypes "https://github.com/yzuagile/2025-team-b/blob/main/src/backend/utils/FileManager.d.ts"
    click FMTest "https://github.com/yzuagile/2025-team-b/blob/main/__test__/FileManager.test.ts"
    click RECt "https://github.com/yzuagile/2025-team-b/blob/main/__test__/RecentlyEditedController.test.ts"
    click Showt "https://github.com/yzuagile/2025-team-b/blob/main/__test__/ShowTitle.test.ts"
    click Crt "https://github.com/yzuagile/2025-team-b/blob/main/__test__/create.test.ts"
    click Findt "https://github.com/yzuagile/2025-team-b/blob/main/__test__/find.test.ts"
    click Gett "https://github.com/yzuagile/2025-team-b/blob/main/__test__/get.test.ts"
    click Upt "https://github.com/yzuagile/2025-team-b/blob/main/__test__/update.test.ts"
    click TD "https://github.com/yzuagile/2025-team-b/blob/main/__test__/TestData.ts"

    %% Styles
    classDef ui fill:#D6EAF8,stroke:#1B4F72,color:#1B2631
    classDef ipc fill:#F9E79F,stroke:#7D6608,color:#1B2631
    classDef main fill:#A9DFBF,stroke:#145A32,color:#1B2631
    classDef data fill:#F5CBA7,stroke:#7E5109,color:#1B2631
    classDef test fill:#D5D8DC,stroke:#4D5656,color:#1B2631
```
