# pawankolhe/bold-ui architecture

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

- Interactive diagram: https://gitdiagram.com/pawankolhe/bold-ui
- Repository: https://github.com/pawankolhe/bold-ui

## Overview

##### Project Root & Monorepo Structure
- Overall monorepo that uses pnpm as the package manager.
- Two main packages: “packages/react” (the component library) and “packages/website” (the demo/documentation site).

##### Component Library (packages/react)
a. src/components – This is the heart of the library. Inside, each component (Avatar, Button, Checkbox, Drawer, Grid, Input, Modal, Radio, Stack, etc.) is organized into its own folder, typically containing the main component file (tsx), stories (for Storybook), styles (SCSS modules), type definitions, and utility files.
b. Plop Templates – Represent the “plop-templates” directory as an automated code generation tool for creating new components.
c. Rollup Configuration – Include “rollup.config.mjs” and the “rollup-plugin” folder that indicate how the library is bundled for distribution.
d. Storybook Integration – Emphasize the “.storybook” folder which provides a configuration for previewing and testing UI components.
e. Context, Hooks, Utils, Constants, and Types – Show these as supporting modules that play a significant role in shared functionality (e.g., “ThemeContext”, custom hooks, utility functions, common constants).

##### Demo Website (packages/website)
- A separate module representing the Next.js based website.
- That this package has its own configuration files (e.g., next.config.js, tsconfig.json) and a structured “pages” directory for routing.
- That it likely serves as both documentation and live demo (with Storybook embedded or linked) of the Bold UI components.

##### Interactions and Data Flow
- Development workflow where “pnpm” commands (install, dev, generate) trigger changes in the component library that subsequently update the live documentation/demo.

##### Technological & Architectural Patterns
- Modular architecture: The monorepo is clearly separated into multiple packages sharing a common codebase.
- Component-based approach: Each UI component is isolated in its own directory with encapsulated styles, stories, and types.
- Automated scaffolding: Use of plop templates for consistent component generation.
- Bundling & Transpilation: Use of Rollup for bundling the React library.
- Storybook for isolated component development and documentation.
- Next.js framework for the website integration.

## Diagram (Mermaid)

```mermaid
flowchart TD
    PNPM["PNPM"]:::external
    A["Monorepo Root"]:::external
    B["Component Library (packages/react)"]:::ui
    C["Demo Website (packages/website)"]:::website

    PNPM -->|"manages"| A
    A --> B
    A --> C

    subgraph "Component Library (packages/react)"
        direction TB
        B1["UI Components (src/components)"]:::ui
        B2["Plop Templates"]:::config
        B3["Rollup Config (rollup.config.mjs)"]:::config
        B4["Rollup Plugins (rollup-plugin)"]:::config
        B5["Storybook Integration"]:::config

        subgraph "Supporting Modules"
            direction TB
            B6["Context"]:::utils
            B7["Hooks"]:::utils
            B8["Utils"]:::utils
            B9["Constants"]:::utils
            B10["Types"]:::utils
        end

        B11["Library Build Output"]:::config

        B2 -->|"generates"| B1
        B6 --> B1
        B7 --> B1
        B8 --> B1
        B9 --> B1
        B10 --> B1

        B1 -->|"builds"| B11
        B3 --> B11
        B4 --> B11
        B1 -->|"previewed in"| B5
    end

    subgraph "Demo Website (packages/website)"
        direction TB
        C1["Next.js Config & Pages"]:::website
    end

    B11 -->|"consumed by"| C1
    PNPM -->|"triggers dev workflow"| B1

    click A "https://github.com/pawankolhe/bold-ui/blob/main/pnpm-workspace.yaml"
    click B "https://github.com/pawankolhe/bold-ui/tree/main/packages/react"
    click C "https://github.com/pawankolhe/bold-ui/tree/main/packages/website"
    click B1 "https://github.com/pawankolhe/bold-ui/tree/main/packages/react/src/components"
    click B2 "https://github.com/pawankolhe/bold-ui/tree/main/packages/react/plop-templates"
    click B3 "https://github.com/pawankolhe/bold-ui/blob/main/packages/react/rollup.config.mjs"
    click B4 "https://github.com/pawankolhe/bold-ui/tree/main/packages/react/rollup-plugin"
    click B5 "https://github.com/pawankolhe/bold-ui/blob/main/packages/react/.storybook"
    click B6 "https://github.com/pawankolhe/bold-ui/tree/main/packages/react/src/context"
    click B7 "https://github.com/pawankolhe/bold-ui/tree/main/packages/react/src/hooks"
    click B8 "https://github.com/pawankolhe/bold-ui/tree/main/packages/react/src/utils"
    click B9 "https://github.com/pawankolhe/bold-ui/tree/main/packages/react/src/constants"
    click B10 "https://github.com/pawankolhe/bold-ui/tree/main/packages/react/src/types"
    click C1 "https://github.com/pawankolhe/bold-ui/tree/main/packages/website"

    classDef external fill:#FFD700,stroke:#DAA520,stroke-width:2px;
    classDef ui fill:#AEDFF7,stroke:#1E90FF,stroke-width:2px;
    classDef config fill:#C3FDB8,stroke:#3CB371,stroke-width:2px;
    classDef utils fill:#F7D794,stroke:#ED9121,stroke-width:2px;
    classDef website fill:#D1C4E9,stroke:#7E57C2,stroke-width:2px;
```
