# divyanshunegi/capiq architecture

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

- Interactive diagram: https://gitdiagram.com/divyanshunegi/capiq
- Repository: https://github.com/divyanshunegi/capiq

## Overview

##### Project type and purpose
- This is a Turborepo-managed monorepo containing two primary applications:
- A cross-platform desktop application (“CapIQ Desktop”) built with Tauri (Rust backend) and React + TypeScript frontend, for automated photo/video organization.
- A static landing/marketing site (“CapIQ Web”) built with Next.js.
- The desktop app uses AI services to analyze media, organizes files locally, and presents a user interface in React. The web app is purely informational.

##### File structure
- Top level:
- pnpm-workspace.yaml & turbo.json → monorepo orchestration.
- apps/desktop → Tauri project (Cargo.toml, Rust code, React code under src/).
- apps/web → Next.js static site (pages under src/app, CSS, Tailwind).
- Desktop substructure:
- src-tauri/ → Rust backend: command definitions (lib.rs), main.rs, build.rs, capabilities JSON, auto-generated schemas.
- src/ → React app: components, hooks, stores, layouts, pages.
- configuration: vite.config.ts, Tailwind, ESLint, Prettier.
- No separate backend service outside Tauri; no external database server. State stored locally (via Tauri APIs).
- Other files: Gitignore, LICENSE, CONTRIBUTING, build logs under .turbo.

##### README for additional insights
- Confirms Tauri + React + TypeScript + TailwindCSS for the desktop app.
- Highlights AI integration for media analysis.
- Turborepo for local development with pnpm desktop and pnpm web commands.

##### Diagramming conventions
- UI → Bridge → Backend → File System
- Backend → AI Service (HTTP)
- Turborepo → Build processes for Desktop & Web
- Green rectangles for frontend UIs
- Blue rectangles for backends

##### Thoroughness
- Every component: monorepo, dev tools, CI/CD (if any), local vs. remote services.
- State flows: how media goes from disk → AI → storage → UI.
- Do not over-abstract: include the Tauri IPC layer, local store, AI API, frontend, and static site.

## Diagram (Mermaid)

```mermaid
flowchart TD
    %% Monorepo orchestration
    MT["pnpm & Turborepo"]:::tool

    %% Build processes
    MT --> Desktop_Build["Build Desktop App"]:::build
    MT --> Web_Build["Build Web App"]:::build

    %% Desktop App Components
    subgraph "Desktop App"
        Desktop_Build --> DUI["React UI"]:::frontend
        Desktop_Build --> TRBridge["Tauri IPC Bridge"]:::bridge
        Desktop_Build --> RBE["Rust Backend"]:::backend
        DUI --> TRBridge --> RBE
        RBE --> FS["Local File System"]:::storage
        RBE --> LS["Local Storage (SQLite/JSON)"]:::storage
        RBE --> AI["External AI Service"]:::cloud
    end

    %% React UI Code
    subgraph "React UI Code"
        Entry["main.tsx"]:::file
        Components["components/"]:::file
        Layout1["AppLayout.tsx"]:::file
        Layout2["OnboardingLayout.tsx"]:::file
        Pages["pages/"]:::file
        Styles["index.css"]:::file
        TailwindC["tailwind.config.js"]:::file
        ViteC["vite.config.ts"]:::file
        ESLint[".eslintrc.js"]:::file
        Prettier[".prettierrc.json5"]:::file
    end
    DUI --> Entry --> Components --> Layout1 --> Layout2 --> Pages --> Styles --> TailwindC --> ViteC --> ESLint --> Prettier

    %% Tauri & Rust Code
    subgraph "Tauri & Rust Code"
        TauriConfig["tauri.conf.json"]:::file
        MainRs["main.rs"]:::file
        LibRs["lib.rs"]:::file
        BuildRs["build.rs"]:::file
        Capabilities["capabilities/default.json"]:::file
        Schemas["gen/schemas/*.json"]:::file
        CargoT["Cargo.toml"]:::file
        CargoL["Cargo.lock"]:::file
    end
    RBE --> TauriConfig --> MainRs --> LibRs --> BuildRs --> Capabilities --> Schemas --> CargoT --> CargoL

    %% Stores & Utils
    subgraph "Stores & Utils"
        DBStore["databaseStore.ts"]:::file
        Utils["projectUtils.ts"]:::file
    end
    RBE --> DBStore
    RBE --> Utils

    %% Web App Components
    subgraph "Web App"
        Web_Build --> NUI["Next.js Static Site"]:::frontend
        NUI --> CDN["CDN / Static Host"]:::cloud
    end

    %% Web Code
    subgraph "Web Code"
        WebEntry["page.tsx"]:::file
        WebLayout["layout.tsx"]:::file
        WebCSS["globals.css"]:::file
        Public["public/"]:::file
        NextC["next.config.js"]:::file
        TailwindW["tailwind.config.ts"]:::file
        PostCSS["postcss.config.mjs"]:::file
        ESLintW[".eslintrc.json"]:::file
        Package["package.json"]:::file
    end
    NUI --> WebEntry --> WebLayout --> WebCSS --> Public --> NextC --> TailwindW --> PostCSS --> ESLintW --> Package

    %% Click Events
    click Entry "https://github.com/divyanshunegi/capiq/blob/main/apps/desktop/src/main.tsx"
    click Components "https://github.com/divyanshunegi/capiq/tree/main/apps/desktop/src/components"
    click Layout1 "https://github.com/divyanshunegi/capiq/blob/main/apps/desktop/src/layouts/AppLayout.tsx"
    click Layout2 "https://github.com/divyanshunegi/capiq/blob/main/apps/desktop/src/layouts/OnboardingLayout.tsx"
    click Pages "https://github.com/divyanshunegi/capiq/tree/main/apps/desktop/src/pages"
    click Styles "https://github.com/divyanshunegi/capiq/blob/main/apps/desktop/src/index.css"
    click TailwindC "https://github.com/divyanshunegi/capiq/blob/main/apps/desktop/tailwind.config.js"
    click ViteC "https://github.com/divyanshunegi/capiq/blob/main/apps/desktop/vite.config.ts"
    click ESLint "https://github.com/divyanshunegi/capiq/blob/main/apps/desktop/.eslintrc.js"
    click Prettier "https://github.com/divyanshunegi/capiq/blob/main/apps/desktop/.prettierrc.json5"
    click TauriConfig "https://github.com/divyanshunegi/capiq/blob/main/apps/desktop/src-tauri/tauri.conf.json"
    click MainRs "https://github.com/divyanshunegi/capiq/blob/main/apps/desktop/src-tauri/src/main.rs"
    click LibRs "https://github.com/divyanshunegi/capiq/blob/main/apps/desktop/src-tauri/src/lib.rs"
    click BuildRs "https://github.com/divyanshunegi/capiq/blob/main/apps/desktop/src-tauri/build.rs"
    click Capabilities "https://github.com/divyanshunegi/capiq/blob/main/apps/desktop/src-tauri/capabilities/default.json"
    click Schemas "https://github.com/divyanshunegi/capiq/tree/main/apps/desktop/src-tauri/gen/schemas"
    click CargoT "https://github.com/divyanshunegi/capiq/blob/main/apps/desktop/src-tauri/Cargo.toml"
    click CargoL "https://github.com/divyanshunegi/capiq/blob/main/apps/desktop/src-tauri/Cargo.lock"
    click DBStore "https://github.com/divyanshunegi/capiq/blob/main/apps/desktop/src/stores/databaseStore.ts"
    click Utils "https://github.com/divyanshunegi/capiq/blob/main/apps/desktop/src/utils/projectUtils.ts"
    click WebEntry "https://github.com/divyanshunegi/capiq/blob/main/apps/web/src/app/page.tsx"
    click WebLayout "https://github.com/divyanshunegi/capiq/blob/main/apps/web/src/app/layout.tsx"
    click WebCSS "https://github.com/divyanshunegi/capiq/blob/main/apps/web/src/app/globals.css"
    click Public "https://github.com/divyanshunegi/capiq/tree/main/apps/web/public"
    click NextC "https://github.com/divyanshunegi/capiq/blob/main/apps/web/next.config.js"
    click TailwindW "https://github.com/divyanshunegi/capiq/blob/main/apps/web/tailwind.config.ts"
    click PostCSS "https://github.com/divyanshunegi/capiq/blob/main/apps/web/postcss.config.mjs"
    click ESLintW "https://github.com/divyanshunegi/capiq/blob/main/apps/web/.eslintrc.json"
    click Package "https://github.com/divyanshunegi/capiq/blob/main/apps/web/package.json"

    %% Styles
    classDef tool fill:#f9f,stroke:#333,stroke-width:1px;
    classDef build fill:#bbf,stroke:#333;
    classDef frontend fill:#b2f5ea,stroke:#333;
    classDef backend fill:#bee3f8,stroke:#333;
    classDef bridge fill:#fefcbf,stroke:#333;
    classDef storage fill:#c6f6d5,stroke:#333;
    classDef cloud fill:#faf089,stroke:#333;
    classDef file fill:#fff5f5,stroke:#333,stroke-dasharray:2 2;
```
