# daisyui/react-daisyui architecture

> Architecture diagram of the GitHub repository daisyui/react-daisyui, 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/daisyui/react-daisyui
- Repository: https://github.com/daisyui/react-daisyui

## Overview

##### Project type and purpose
- This is a front-end component library (“react-daisyui”) written in React + TypeScript + TailwindCSS.
- It ships as an NPM package of reusable UI components, and publishes a Storybook-based documentation site.

##### High-level file/dir analysis
- src/… – each component in its own folder: .tsx entry, .stories.tsx, .test.tsx, index.tsx
- .storybook/… – Storybook configuration & theming for local dev and docs build
- docs/ & public/… – statically built Storybook site (deployed e.g. via GitHub Pages)
- generators/ & plopfile.js – code-generation templates for scaffolding new components
- CI workflows in .github/workflows – lint, test, static-site build, release/publish
- build configs: vite.config.ts (bundler), babel.config.cjs, tsconfig.json, tailwind.config.cjs, postcss.config.cjs

##### Key insights from README
- Core deliverable: React components styled by DaisyUI/Tailwind
- Docs live via Storybook; NPM publishes library for consumption in Next.js or plain React apps
- Provides a code generator to scaffold new components + stories + tests

##### Be detailed and comprehensive
- Break out major subsystems: Development Environment, Build System, Testing, CI/CD, Documentation Hosting, Package Publishing
- Co-locate related components (e.g. all Storybook files in one region)

## Diagram (Mermaid)

```mermaid
flowchart TD
    subgraph "Development Environment"
        IDE["Developer Workstation<br>(IDE + CLI)"]:::orange
        CLI["npm run dev"]:::orange
        buildCmd["npm run build"]:::orange
        docsCmd["npm run build:docs"]:::orange
    end

    subgraph "Source Modules"
        compFolder["src/[ComponentName]"]:::blue
        index["src/index.ts"]:::blue
        styles["src/styles.css"]:::blue
        utils["src/utils.ts<br>src/constants.ts<br>src/defaultThemes.ts<br>src/types.ts"]:::blue
        testSetup["src/test-setup.ts"]:::blue
        storybookConfig[".storybook/"]:::blue
    end

    subgraph "Configurations"
        viteConfig["vite.config.ts"]:::blue
        babelConfig["babel.config.cjs<br>tsconfig.json"]:::blue
        cssConfig["tailwind.config.cjs<br>postcss.config.cjs"]:::blue
        jestConfig["jest.config.cjs"]:::blue
        mocks["__mocks__/fileMock.js<br>__mocks__/styleMock.js"]:::blue
    end

    subgraph "Code Generation" 
        plopfile["plopfile.js"]:::green
        generators["generators/"]:::green
    end

    subgraph "Build System"
        viteDev["Vite Dev Server"]:::green
        storybookDev["Storybook Dev Server"]:::green
        viteBuild["Vite Build<br>→ dist/"]:::green
        storybookBuild["Storybook Build<br>→ docs/"]:::green
    end

    subgraph "Testing"
        jest["Jest Tests<br>+ RTL"]:::green
    end

    subgraph "CI/CD (GitHub Actions)"
        workflows[".github/workflows/"]:::orange
    end

    subgraph "External Services"
        npm["NPM Registry"]:::purple
        ghPages["GitHub Pages"]:::purple
        docsOutput["docs/ & public/"]:::purple
    end

    IDE --> CLI
    IDE --> buildCmd
    IDE --> docsCmd

    CLI --> viteDev
    CLI --> storybookDev

    compFolder --> viteDev
    styles --> viteDev
    index --> viteDev
    utils --> viteDev

    compFolder --> storybookDev
    storybookConfig --> storybookDev

    buildCmd --> viteBuild
    docsCmd --> storybookBuild

    viteBuild --> npm
    storybookBuild --> docsOutput

    CLI --> plopfile
    plopfile --> generators
    generators --> compFolder

    workflows --> jest
    workflows --> viteBuild
    workflows --> storybookBuild
    workflows --> npm
    workflows --> ghPages

    classDef blue fill:#D0E8FF,stroke:#0366d6
    classDef green fill:#D0FFD6,stroke:#22863a
    classDef orange fill:#FFE4B3,stroke:#d73a49
    classDef purple fill:#E5D4FF,stroke:#6f42c1

    click compFolder "https://github.com/daisyui/react-daisyui/tree/main/src/Button"
    click index "https://github.com/daisyui/react-daisyui/blob/main/src/index.ts"
    click styles "https://github.com/daisyui/react-daisyui/blob/main/src/styles.css"
    click utils "https://github.com/daisyui/react-daisyui/blob/main/src/utils.ts"
    click testSetup "https://github.com/daisyui/react-daisyui/blob/main/src/test-setup.ts"
    click storybookConfig "https://github.com/daisyui/react-daisyui/tree/main/.storybook/"
    click plopfile "https://github.com/daisyui/react-daisyui/blob/main/plopfile.js"
    click generators "https://github.com/daisyui/react-daisyui/tree/main/generators/"
    click viteConfig "https://github.com/daisyui/react-daisyui/blob/main/vite.config.ts"
    click babelConfig "https://github.com/daisyui/react-daisyui/blob/main/babel.config.cjs"
    click babelConfig "https://github.com/daisyui/react-daisyui/blob/main/tsconfig.json"
    click cssConfig "https://github.com/daisyui/react-daisyui/blob/main/tailwind.config.cjs"
    click cssConfig "https://github.com/daisyui/react-daisyui/blob/main/postcss.config.cjs"
    click jestConfig "https://github.com/daisyui/react-daisyui/blob/main/jest.config.cjs"
    click mocks "https://github.com/daisyui/react-daisyui/blob/main/__mocks__/fileMock.js"
    click mocks "https://github.com/daisyui/react-daisyui/blob/main/__mocks__/styleMock.js"
    click workflows "https://github.com/daisyui/react-daisyui/blob/main/.github/workflows/commit-lint.yml"
    click workflows "https://github.com/daisyui/react-daisyui/blob/main/.github/workflows/test.yml"
    click workflows "https://github.com/daisyui/react-daisyui/blob/main/.github/workflows/static.yml"
    click workflows "https://github.com/daisyui/react-daisyui/blob/main/.github/workflows/release.yml"
    click docsOutput "https://github.com/daisyui/react-daisyui/tree/main/docs/"
```
