# tremorlabs/tremor architecture

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

- Interactive diagram: https://gitdiagram.com/tremorlabs/tremor
- Repository: https://github.com/tremorlabs/tremor

## Overview

##### Project type and purpose
- This is an open-source React component library (“Tremor Raw”) that exposes 35+ reusable, accessible UI components (charts, form controls, layout pieces) for building dashboards and data-driven web apps.
- It bundles TypeScript-based React components styled with Tailwind CSS and built on Radix UI primitives.

##### File structure
- Top-level config: ESLint, Prettier, tsconfig, Vite, Vitest, Playwright, GitHub Actions.
- scripts/: scaffold utility for creating new component folders.
- public/: static assets (images, favicons) used by Storybook and docs.
- .storybook/: Storybook configuration (main.ts, manager.ts, preview.ts).
- src/
- components/[ComponentName]/: each component’s .tsx, unit tests (.spec.ts), stories (.stories.tsx), changelog.
- hooks/: shared React hooks.
- utils/: shared helper functions and tests.
- globals.css: Tailwind import and global resets.

##### README for additional insights
- Confirms it’s a “copy & paste” React component library built with Tailwind CSS and Radix UI.
- References installation docs, community channels, license.

##### Diagramming recommendations
- Use clear, concise labels for each component/module.
- from Developer → Source → Build → Dist → npm
- from CI → clone → lint/test → build → publish
- from Consumer App → npm → Tremor (dist)
- from Storybook → serves docs from Source
- Blue for source modules (components/hooks/utils)
- Green for infrastructure (Vite, Storybook, CI/CD)
- Orange for external dependencies (Tailwind, Radix, npm)
- Gray for consumer applications and environment
- Rectangles for code repositories and modules
- Clouds for CI/CD and external services

## Diagram (Mermaid)

```mermaid
flowchart TD
    %% Developer Environment
    subgraph "Developer Environment"
        direction TB
        IDE["IDE"]:::env
        NodeJS["Node.js (Local)"]:::env
        GitClient["Git Client"]:::env
    end

    %% Source Modules
    subgraph "Source Modules"
        direction TB
        Components["Components"]:::source
        Hooks["Hooks"]:::source
        Utils["Utils"]:::source
    end

    %% Styling & Primitives
    StylingEngine["Tailwind CSS"]:::external
    UIPrimitives["Radix UI"]:::external

    %% Build & Bundler
    Vite["Vite (Dev & Build)"]:::infra

    %% Documentation Site
    Storybook["Storybook"]:::infra

    %% Testing Frameworks
    subgraph "Testing Frameworks"
        direction TB
        Vitest["Vitest (Unit Tests)"]:::infra
        Playwright["Playwright (E2E)"]:::infra
    end

    %% CI/CD Pipeline
    CICD["CI/CD Pipeline\n(GitHub Actions)"]:::infra

    %% Package Registry
    NPM["npm Registry"]:::external

    %% Consumer
    Consumer["Consumer Application"]:::env

    %% Relationships
    IDE -->|"edits source"| Components
    IDE --> Hooks
    IDE --> Utils
    NodeJS --> Vite
    GitClient --> CICD

    Components -->|"styled by"| StylingEngine
    Hooks --> StylingEngine
    Utils --> StylingEngine

    StylingEngine --> Vite
    UIPrimitives --> Vite
    Components --> Vite
    Hooks --> Vite
    Utils --> Vite

    Vite -->|"builds dist"| NPM
    Vite --> Consumer
    Vite --> Storybook

    Storybook --> Components
    Storybook --> Hooks
    Storybook --> Utils

    Vitest --> Components
    Vitest --> Utils
    Playwright --> Components

    CICD -->|"runs lint/test"| Vitest
    CICD --> Playwright
    CICD -->|"runs build"| Vite
    CICD -->|"publishes"| NPM

    Consumer -->|"installs"| NPM
    Consumer -->|"peer deps"| StylingEngine
    Consumer --> UIPrimitives

    %% Click Events
    click Components "https://github.com/tremorlabs/tremor/tree/main/src/components/"
    click Hooks "https://github.com/tremorlabs/tremor/tree/main/src/hooks/"
    click Utils "https://github.com/tremorlabs/tremor/tree/main/src/utils/"
    click StylingEngine "https://github.com/tremorlabs/tremor/blob/main/postcss.config.js"
    click StylingEngine "https://github.com/tremorlabs/tremor/blob/main/src/globals.css"
    click UIPrimitives "https://github.com/tremorlabs/tremor/blob/main/package.json"
    click Vite "https://github.com/tremorlabs/tremor/blob/main/vite.config.ts"
    click Storybook "https://github.com/tremorlabs/tremor/tree/main/.storybook/"
    click Vitest "https://github.com/tremorlabs/tremor/blob/main/vitest.config.ts"
    click Playwright "https://github.com/tremorlabs/tremor/blob/main/playwright.config.ts"
    click CICD "https://github.com/tremorlabs/tremor/tree/main/.github/workflows/"
    click NPM "https://github.com/tremorlabs/tremor/blob/main/package.json"
    click IDE "https://github.com/tremorlabs/tremor/blob/main/.eslintrc.cjs"

    %% Styles
    classDef source fill:#cce5ff,stroke:#004085,color:#004085;
    classDef infra fill:#d4edda,stroke:#155724,color:#155724;
    classDef external fill:#fff3cd,stroke:#856404,color:#856404;
    classDef env fill:#e2e3e5,stroke:#6c757d,color:#6c757d;
```
