# nianyi778/flowmaster architecture

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

- Interactive diagram: https://gitdiagram.com/nianyi778/flowmaster
- Repository: https://github.com/nianyi778/flowmaster

## Overview

##### Project Type Analysis
This is a desktop application built with Electron, combining a React frontend with a local database backend. It's a full-stack desktop application with features like todo management, quadrant views, and planned features such as Pomodoro focus and calendar integration.

##### Main Components

A. Frontend Layer (React Application)
- Components Structure
- Store Management (src/store)
- Routing System (src/router)
- Pages and Features

B. Electron Layer
- Main Process
- Renderer Process
- IPC Communication
- Database Services

C. Database Layer
- Entity Management
- Controllers
- Services
- Data Access Objects (DAO)

**┌─────────────────────────────────────────────────┐**
- Frontend (React)                  │
- ┌─────────────┐ ┌─────────────┐ ┌─────────────┐ │
- Pages     │ │  Components │ │    Store    │ │
- ┘ └─────────────┘ └─────────────┘ │
- ┬─────────────────────────┘

**┌───────────────────────┼─────────────────────────┐**
- Electron      │      Infrastructure      │
- ┌─────────────┐ ┌────┴────────┐ ┌─────────────┐ │
- Main Process │ │     IPC     │ │  Preload    │ │
- ┘ └─────────────┘ └─────────────┘ │
- ┬─────────────────────────┘

**┌───────────────────────┼─────────────────────────┐**
- Database Services                   │
- ┌─────────────┐ ┌─────────────┐ ┌─────────────┐ │
- Entities   │ │Controllers  │ │    DAOs     │ │
- ┘ └─────────────┘ └─────────────┘ │
- ┘

##### Component Details

Frontend Layer:
- Main pages: Home, AddTodo, Quest
- Store management (todo.ts)
- Component hierarchy

Electron Layer:
- IPC communication channels
- Main process and preload scripts
- Window management

Database Layer:
- Todo entity structure
- CRUD operations flow
- Service layer architecture

##### Data Flow Indicators

- IPC communication between frontend and backend
- Database operations flow
- User interaction paths

##### Technical Stack Indicators

- React
- Electron
- TypeScript
- Less for styling
- Tailwind CSS
- Local database system

## Diagram (Mermaid)

```mermaid
flowchart TB
    %% Styles
    classDef frontend fill:#e1f5fe,stroke:#01579b
    classDef electron fill:#e8f5e9,stroke:#1b5e20
    classDef database fill:#fff3e0,stroke:#e65100
    classDef communication fill:#f3e5f5,stroke:#4a148c

    %% Frontend Layer
    subgraph Frontend
        Pages["Pages"]:::frontend
        Components["Components"]:::frontend
        Store["Store Management"]:::frontend
        Router["Routing System"]:::frontend
        Layout["Layout Components"]:::frontend
        
        subgraph Pages
            HomePage["Home Page<br/>(Quadrant View)"]:::frontend
            AddTodoPage["Add Todo Page"]:::frontend
            QuestPage["Quest Page"]:::frontend
        end
    end

    %% Electron Layer
    subgraph Electron
        MainProcess["Main Process"]:::electron
        IPCComm["IPC Communication"]:::electron
        Preload["Preload Script"]:::electron
        WinManagement["Window Management"]:::electron
    end

    %% Database Layer
    subgraph Database
        DBInit["Database Services<br/>Initialization"]:::database
        Entity["Todo Entity"]:::database
        Controller["Todo Controller"]:::database
        DAO["Todo DAO"]:::database
        TodoCRUD["Todo CRUD<br/>Operations"]:::database
    end

    %% Relationships
    Pages --> IPCComm
    Components --> Store
    Router --> Pages
    Layout --> Pages
    
    IPCComm --> MainProcess
    MainProcess --> WinManagement
    MainProcess --> Preload
    
    IPCComm --> TodoCRUD
    TodoCRUD --> Controller
    Controller --> DAO
    DAO --> Entity
    DBInit --> Entity

    %% Click Events
    click Components "https://github.com/nianyi778/FlowMaster/tree/master/src/components/"
    click Store "https://github.com/nianyi778/FlowMaster/blob/master/src/store/todo.ts"
    click Router "https://github.com/nianyi778/FlowMaster/blob/master/src/router/index.tsx"
    click Pages "https://github.com/nianyi778/FlowMaster/tree/master/src/pages/"
    click MainProcess "https://github.com/nianyi778/FlowMaster/blob/master/electron/main.ts"
    click IPCComm "https://github.com/nianyi778/FlowMaster/tree/master/electron/ipc/"
    click Entity "https://github.com/nianyi778/FlowMaster/blob/master/electron/dbServices/db/entity/Todo.ts"
    click Controller "https://github.com/nianyi778/FlowMaster/blob/master/electron/dbServices/db/controller/Todo.ts"
    click DAO "https://github.com/nianyi778/FlowMaster/blob/master/electron/dbServices/db/dao/Todo.ts"
    click DBInit "https://github.com/nianyi778/FlowMaster/blob/master/electron/dbServices/dbServicesInit.ts"
    click Preload "https://github.com/nianyi778/FlowMaster/blob/master/electron/preload.ts"
    click TodoCRUD "https://github.com/nianyi778/FlowMaster/blob/master/electron/ipc/todoCurd.ts"
    click WinManagement "https://github.com/nianyi778/FlowMaster/blob/master/electron/ipc/createWin.ts"
    click Layout "https://github.com/nianyi778/FlowMaster/tree/master/src/components/Layout/"
    click HomePage "https://github.com/nianyi778/FlowMaster/tree/master/src/pages/Home/"
    click AddTodoPage "https://github.com/nianyi778/FlowMaster/tree/master/src/pages/AddTodo/"
    click QuestPage "https://github.com/nianyi778/FlowMaster/tree/master/src/pages/Quest/"

    %% Legend
    subgraph Legend
        Frontend_L["Frontend Component"]:::frontend
        Electron_L["Electron Component"]:::electron
        Database_L["Database Component"]:::database
    end
```
