# autoinvent/conveyor architecture

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

- Interactive diagram: https://gitdiagram.com/autoinvent/conveyor
- Repository: https://github.com/autoinvent/conveyor

## Overview

##### Project type and purpose
- Conveyor is an open-source React UI component library (not a full-stack app) aimed at simplifying CRUD interactions with GraphQL APIs generated by Magql.
- It packages a set of prebuilt, configurable components (tables, forms, inputs, displays, actions, etc.), supports UMD and ES modules, and comes with Storybook examples and a CDN distribution.

##### File structure
- Top-level build/config files:
– package.json, pnpm-lock.yaml, vite.config.ts (build/bundle)
– tailwind.config.js, postcss.config.cjs, biome.json (styles & linting)
– .github/workflows/storybook-deploy.yaml (CI/CD)
- Examples folder: sample integrations (CDN, Vite React TS)
- docs & examples: usage instructions, publishing guide
- src folder: main library source, subdivided by feature areas:
– Actions, BasicDisplays, BasicInputs, Conveyor (core wrapper), Data, Form, Header, Lenses, ModelCheckDelete, ModelForm, ModelTable, Pagination, SearchResults, Slots, Table
– lib/components/ui: underlying primitive UI building blocks
– styles, types, utils: cross-cutting concerns
- Storybook configs under .storybook; backlog contains prototypes.

##### README insights
- Conveyor is installed via pnpm/npm or included via CDN.
- React is a peer dependency.
- Scripts define build, CSS build, Storybook local server, format, lint, packaging.

a. Main components:
- Source code modules (Actions, Displays, Inputs, Table, Form, Conveyor core, etc.)
- UI primitives (lib/components/ui)
- Shared layers (utils, types, styles)
- Build pipeline (Vite/Rollup bundle, Tailwind CSS)
- Storybook server for cataloging components
- CI/CD workflow (GitHub Actions deploy to Storybook, publish to npm)
- Distribution outputs: dist/ (UMD + ES modules), CSS file
- Consumers: npm package users, CDN users, example apps (Vite React TS)

b. Relationships & interactions:
- All src modules import from lib/ui primitives + utils + types + styles
- Conveyor core orchestrates context providers (Data, Form, ConveyorStore, Lenses, Table, Slots)
- Build pipeline ingests src + styles → outputs dist artifacts
- Storybook reads distilled component exports + MDX to render documentation
- CI/CD pushes dist to npm registry and publishes Storybook site
- Consumer apps import from '@autoinvent/conveyor' (ES/UMD) or reference CDN → integrate into their React code; GraphQL queries flow to Magql API

c. Architectural patterns & principles:
- Modular feature-based decomposition (one folder per feature)
- Context + hooks for state management in each module (useDataStore, useFormStore, useTableStore, etc.)
- Composition over inheritance: base UI primitives in lib/components/ui, extended by feature modules
- Separation of concerns: pure UI primitives vs. domain-specific feature components
- Peer dependency model for React and GraphQL client

d. Key technologies/frameworks:
- React + TSX, pnpm, Vite/Rollup, Tailwind CSS, Biome linter/formatter, Storybook, GitHub Actions, Magql

## Diagram (Mermaid)

```mermaid
flowchart TB
    %% Source Code Layer
    subgraph "Source Code Layer"
        direction TB
        subgraph "Feature Modules" 
            direction TB
            A1["Actions Module"]:::srcLayer
            B1["Basic Displays Module"]:::srcLayer
            C1["Basic Inputs Module"]:::srcLayer
            D1["Data Store Module"]:::srcLayer
            E1["Form Module"]:::srcLayer
            F1["Header Component"]:::srcLayer
            G1["Lenses Module"]:::srcLayer
            H1["Model Check/Delete"]:::srcLayer
            I1["Model Form Module"]:::srcLayer
            J1["Model Table Module"]:::srcLayer
            K1["Pagination Component"]:::srcLayer
            L1["Search Results Component"]:::srcLayer
            M1["Slots Module"]:::srcLayer
            N1["Table Module"]:::srcLayer
        end
        subgraph "Core & Orchestration"
            direction TB
            O1["Conveyor Core"]:::srcLayer
        end
        subgraph "Foundation & Shared"
            direction TB
            P1["UI Primitives"]:::srcLayer
            Q1["Shared Utilities"]:::srcLayer
            R1["Shared Types"]:::srcLayer
            S1["Global Styles"]:::srcLayer
        end
    end

    %% Build & CI/CD Layer
    subgraph "Build & CI/CD" 
        direction TB
        T1["Build Pipeline (Vite/Rollup, Tailwind)"]:::buildLayer
        U1["CI/CD Workflow"]:::buildLayer
    end

    %% Distribution Layer
    subgraph "Distribution Outputs"
        direction TB
        V1["Dist Artifacts (UMD, ES)"]:::distLayer
        W1["CSS Output"]:::distLayer
    end

    %% Documentation & Storybook
    subgraph "Documentation & Storybook"
        direction TB
        X1["Storybook Server"]:::consumerLayer
        Y1["Documentation (docs)"]:::consumerLayer
    end

    %% Consumers
    subgraph "Consumers"
        direction TB
        Z1["Example App: CDN"]:::consumerLayer
        Z2["Example App: Vite React TS"]:::consumerLayer
        Z3["End User Apps"]:::consumerLayer
    end

    %% Relationships
    %% Modules import foundation
    A1 -->|"imports from"|P1
    B1 -->|"imports from"|P1
    C1 -->|"imports from"|P1
    D1 -->|"imports from"|Q1
    E1 -->|"imports from"|Q1
    F1 -->|"imports from"|R1
    G1 -->|"imports from"|Q1
    H1 -->|"imports from"|Q1
    I1 -->|"imports from"|R1
    J1 -->|"imports from"|R1
    K1 -->|"imports from"|S1
    L1 -->|"imports from"|Q1
    M1 -->|"imports from"|Q1
    N1 -->|"imports from"|P1

    %% Core orchestrates feature stores
    O1 -->|"uses context"|D1
    O1 -->|"uses context"|E1
    O1 -->|"uses context"|N1
    O1 -->|"uses context"|M1
    O1 -->|"uses context"|G1

    %% Build pipeline uses source & styles
    T1 -->|"builds"|V1
    T1 -->|"generates"|W1
    P1 --> T1
    Q1 --> T1
    R1 --> T1
    S1 --> T1
    A1 --> T1

    %% CI/CD publishes Storybook & npm
    U1 -->|"deploys"|X1
    U1 -->|"publishes"|V1

    %% Distribution to consumers
    V1 -->|"published to npm"|Z3
    V1 -->|"served via CDN"|Z1
    W1 -->|"served via CDN"|Z1
    W1 -->|"bundled in app"|Z2

    %% Storybook and docs
    X1 -->|"renders"|A1
    X1 -->|"renders"|B1
    X1 -->|"renders"|C1
    X1 -->|"renders"|... 
    Y1 -->|"documents guide"|Z3

    %% Example apps import package
    Z2 -->|"imports @autoinvent/conveyor"|V1

    %% Click Events
    click A1 "https://github.com/autoinvent/conveyor/tree/main/src/Actions"
    click B1 "https://github.com/autoinvent/conveyor/tree/main/src/BasicDisplays"
    click C1 "https://github.com/autoinvent/conveyor/tree/main/src/BasicInputs"
    click D1 "https://github.com/autoinvent/conveyor/tree/main/src/Data"
    click E1 "https://github.com/autoinvent/conveyor/tree/main/src/Form"
    click F1 "https://github.com/autoinvent/conveyor/tree/main/src/Header"
    click G1 "https://github.com/autoinvent/conveyor/tree/main/src/Lenses"
    click H1 "https://github.com/autoinvent/conveyor/tree/main/src/ModelCheckDelete"
    click I1 "https://github.com/autoinvent/conveyor/tree/main/src/ModelForm"
    click J1 "https://github.com/autoinvent/conveyor/tree/main/src/ModelTable"
    click K1 "https://github.com/autoinvent/conveyor/tree/main/src/Pagination"
    click L1 "https://github.com/autoinvent/conveyor/tree/main/src/SearchResults"
    click M1 "https://github.com/autoinvent/conveyor/tree/main/src/Slots"
    click N1 "https://github.com/autoinvent/conveyor/tree/main/src/Table"
    click P1 "https://github.com/autoinvent/conveyor/tree/main/src/lib/components/ui"
    click Q1 "https://github.com/autoinvent/conveyor/tree/main/src/utils"
    click R1 "https://github.com/autoinvent/conveyor/tree/main/src/types"
    click S1 "https://github.com/autoinvent/conveyor/blob/main/src/styles/tailwind.css"
    click S1 "https://github.com/autoinvent/conveyor/blob/main/tailwind.config.js"
    click S1 "https://github.com/autoinvent/conveyor/blob/main/postcss.config.cjs"
    click T1 "https://github.com/autoinvent/conveyor/blob/main/vite.config.ts"
    click T1 "https://github.com/autoinvent/conveyor/blob/main/package.json"
    click X1 "https://github.com/autoinvent/conveyor/blob/main/.storybook"
    click U1 "https://github.com/autoinvent/conveyor/blob/main/.github/workflows/storybook-deploy.yaml"
    click Y1 "https://github.com/autoinvent/conveyor/tree/main/docs"
    click Z1 "https://github.com/autoinvent/conveyor/tree/main/examples/cdn"
    click Z2 "https://github.com/autoinvent/conveyor/tree/main/examples/vite-react-ts"

    %% Styles
    classDef srcLayer fill:#D0E8FF,stroke:#024A86,color:#024A86
    classDef buildLayer fill:#DFF8D0,stroke:#0B6623,color:#0B6623
    classDef distLayer fill:#FFE0B3,stroke:#A65E00,color:#A65E00
    classDef consumerLayer fill:#E8D0FF,stroke:#511374,color:#511374
```
