# graphif/project-graph architecture

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

- Interactive diagram: https://gitdiagram.com/graphif/project-graph
- Repository: https://github.com/graphif/project-graph

## Overview

##### Project type and purpose
- This is a pnpm/turborepo monorepo hosting three main concerns:
– “app”: a cross-platform desktop/web graph‐editing application built with React + TypeScript (Vite) and Tauri (Rust)
– “docs” (and “docs-pg”): a Next.js-based documentation site

##### File structure
Top-level
- pnpm-workspace.yaml, turbo.json, GitHub workflows → monorepo orchestration & CI/CD
- app/ → main application
– src/ → React UI components, core engine (renderers, services, controllers, plugins)
– src-tauri/ → Rust backend (Tauri configuration, build.rs, capabilities, Android template)
– package.json, tsconfig, vite.config.ts → JS build & dev tooling
- docs/ & docs-pg/ → Next.js docs site (content, localization, MDX)
- packages/ → independently versioned npm packages:
– api (JS wrapper for Tauri commands)
– data-structures (Queue, Stack, Vector, etc.)
– serializer (serialize/deserialize stage data)
– unplugin-original-class-name (build-tool plugin)

##### README for additional insights
(app/README.md describes Tauri setup, Vite dev, build targets, key features: rendering engines, plugin API, file import/export, AI integrations, Android generation.)

## Diagram (Mermaid)

```mermaid
flowchart TB
  %% App Frontend
  subgraph "app/src"
    subgraph "React UI Layer"
      UI["Components"]:::ui
      UIT["UI Toolkit"]:::ui
      Editor["Editor Surface"]:::ui
      EditorP["Editor Plugins"]:::ui
    end
    subgraph "Core Engine"
      Control["Control Service"]:::engine
      DataGen["Data Generate Service"]:::engine
      DataMng["Data Manage Service"]:::engine
      Feedback["Feedback Service"]:::engine
      StageMgr["Stage Manager"]:::engine
      StageObj["Stage Objects"]:::engine
      Render["Renderers (Canvas2D, SVG, 3D)"]:::engine
      PluginSub["Plugin Subsystem"]:::engine
      FSProv["File System Provider"]:::engine
    end
    Entry["Main Entry & Config"]:::ui
  end

  %% Tauri Backend
  subgraph "Tauri Backend (app/src-tauri)"
    TauriCmd["IPC Commands"]:::tauri
    TauriMain["main.rs"]:::tauri
    TauriConf["tauri.conf.json"]:::tauri
    Capabilities["Native Capabilities"]:::tauri
    Android["Android Codegen"]:::tauri
    NSIS["NSIS Installer Config"]:::tauri
  end

  %% Shared Packages
  subgraph "Shared Packages (packages)"
    API["API Client"]:::shared
    DS["Data Structures"]:::shared
    Ser["Serializer"]:::shared
    Shp["Shapes"]:::shared
    PluginPkg["Build-Tool Plugin"]:::shared
  end

  %% Documentation
  subgraph "Docs Sites"
    Docs["docs"]:::external
    DocsPG["docs-pg"]:::external
  end

  %% External Systems
  FS["OS File System & Dialogs"]:::external
  Third["Third-Party Integrations"]:::external
  CI["CI/CD Workflows"]:::external
  MonoConfig["pnpm-workspace.yaml & turbo.json"]:::external

  %% Connections
  UI -->|dispatch events| Control
  UI -->|renders via| Render
  Control -->|manages| StageMgr
  DataGen -->|generates data for| StageMgr
  DataMng -->|manages graph data| StageMgr
  Feedback -->|provides feedback to| StageMgr
  StageMgr -->|holds| StageObj
  StageMgr -->|drives| Render
  PluginSub -->|executes plugins for| Control
  PluginSub -->|returns results to| StageMgr
  FSProv -->|reads/writes via| TauriCmd
  Entry -->|bootstraps UI & Core| UI
  Entry -->|bootstraps UI & Core| Control

  TauriCmd -->|invokes| FS
  TauriCmd -->|uses| Capabilities
  Capabilities -->|define native APIs| TauriCmd
  TauriCmd -->|generates Android code| Android
  TauriCmd -->|configures installer| NSIS
  TauriMain -->|initializes| TauriCmd
  TauriConf -->|configures| TauriMain

  API -->|imported by| UI
  API -->|imported by| Control
  DS -->|used in| StageMgr
  Ser -->|serializes via| FSProv
  Shp -->|shapes for| Render
  PluginPkg -->|build plugin for| AppFrontend["app/src"]:::ui

  API -->|imported by| Docs
  DS -->|imported by| Docs
  Ser -->|imported by| Docs
  Shp -->|imported by| Docs
  PluginPkg -->|imported by| Docs

  MonoConfig -->|orchestrates| UI
  MonoConfig -->|orchestrates| Control
  CI -->|builds & tests| UI
  CI -->|builds & tests| TauriCmd
  CI -->|builds docs| Docs

  %% Click Events
  click UI "https://github.com/graphif/project-graph/tree/master/app/src/components"
  click UIT "https://github.com/graphif/project-graph/tree/master/app/src/components/ui"
  click Editor "https://github.com/graphif/project-graph/tree/master/app/src/components/editor"
  click EditorP "https://github.com/graphif/project-graph/tree/master/app/src/components/editor/plugins"
  click Control "https://github.com/graphif/project-graph/tree/master/app/src/core/service/controlService"
  click DataGen "https://github.com/graphif/project-graph/tree/master/app/src/core/service/dataGenerateService"
  click DataMng "https://github.com/graphif/project-graph/tree/master/app/src/core/service/dataManageService"
  click Feedback "https://github.com/graphif/project-graph/tree/master/app/src/core/service/feedbackService"
  click StageMgr "https://github.com/graphif/project-graph/tree/master/app/src/core/stage/stageManager"
  click StageObj "https://github.com/graphif/project-graph/tree/master/app/src/core/stage/stageObject"
  click Render "https://github.com/graphif/project-graph/tree/master/app/src/core/render"
  click PluginSub "https://github.com/graphif/project-graph/tree/master/app/src/core/plugin"
  click FSProv "https://github.com/graphif/project-graph/tree/master/app/src/core/fileSystemProvider"
  click Entry "https://github.com/graphif/project-graph/blob/master/app/src/main.tsx"
  click TauriCmd "https://github.com/graphif/project-graph/tree/master/app/src-tauri/src/cmd"
  click TauriMain "https://github.com/graphif/project-graph/blob/master/app/src-tauri/src/main.rs"
  click TauriConf "https://github.com/graphif/project-graph/blob/master/app/src-tauri/tauri.conf.json"
  click Capabilities "https://github.com/graphif/project-graph/tree/master/app/src-tauri/capabilities"
  click Android "https://github.com/graphif/project-graph/tree/master/app/src-tauri/gen/android"
  click NSIS "https://github.com/graphif/project-graph/tree/master/app/src-tauri/nsis"
  click API "https://github.com/graphif/project-graph/tree/master/packages/api"
  click DS "https://github.com/graphif/project-graph/tree/master/packages/data-structures"
  click Ser "https://github.com/graphif/project-graph/tree/master/packages/serializer"
  click Shp "https://github.com/graphif/project-graph/tree/master/packages/shapes"
  click PluginPkg "https://github.com/graphif/project-graph/tree/master/packages/unplugin-original-class-name"
  click Docs "https://github.com/graphif/project-graph/tree/master/docs/app"
  click DocsPG "https://github.com/graphif/project-graph/tree/master/docs-pg"
  click CI "https://github.com/graphif/project-graph/tree/master/.github/workflows"
  click MonoConfig "https://github.com/graphif/project-graph/blob/master/pnpm-workspace.yaml"

  %% Styles
  classDef ui fill:#D0E8FF,stroke:#0366d6,color:#0366d6;
  classDef engine fill:#E6F4EA,stroke:#22863a,color:#22863a;
  classDef tauri fill:#FFEBC1,stroke:#D69F2E,color:#D69F2E;
  classDef shared fill:#F0F0F0,stroke:#6a737d,color:#6a737d;
  classDef external fill:#FFFFFF,stroke-dasharray: 5 5,stroke:#6a737d,color:#6a737d;
```
