# lobehub/lobe-icons architecture

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

- Interactive diagram: https://gitdiagram.com/lobehub/lobe-icons
- Repository: https://github.com/lobehub/lobe-icons

## Overview

##### Project Type and Purpose
- It provides:
- A tree-shakable React/TypeScript component API (src folder).
- Static asset packages (packages/static-png, static-svg, static-webp).
- Documentation site and demos (docs folder).
- Build and publish workflows (scripts + .github/workflows).
- CDN distribution via NPM, unpkg, npmmirror, Vercel.

##### File Structure Analysis
- Top-level directories:
- packages: Three static asset packages (png/svg/webp) with their own package.json, CHANGELOG, README.
- docs: Markdown/TSX documentation and demos for features.
- scripts: Custom CLI workflows (readmeGeneration, SVG workflow, TOC generation, vectorizer).
- public: Static assets for docs site (robots.txt).
- Configuration and tooling files:
- pnpm-workspace.yaml: Monorepo package definition.
- .github/workflows/*.yml: CI steps for testing, release, issue management.
- bundler configs (.fatherrc.ts, tsconfig.json, vitest.config.ts, lint configs).
- build tool chain: Bun (bunfig.toml), Babel/ESLint/Prettier, TypeScript, Vitest tests.
- Patterns:
- Monorepo grouping of packages and central src.
- Separate static-asset packages built from src vector assets.

##### Key Architecture Elements from README
- CDN usage examples for SVG, PNG, WEBP.
- Next.js SSR compatibility with transpilePackages.
- Local development enabled by Bun and GitHub Codespaces.

##### Final Advice
- Essential components without overcrowding.
- Package (React, static-svg, static-png, static-webp) as distinct nodes.
- Data flows are clear: from source → build → publish → consume.

## Diagram (Mermaid)

```mermaid
flowchart TD
    %% Monorepo Source
    subgraph "Monorepo Source"
        SRC["Icon Component Library (src)"]:::source
        PNG["Static Asset Package - PNG"]:::source
        SVG["Static Asset Package - SVG"]:::source
        WEBP["Static Asset Package - WEBP"]:::source
        DOCS["Documentation Site (docs)"]:::source
        PNPM["Monorepo Definition (pnpm-workspace.yaml)"]:::source
    end

    %% Build & Packaging Pipeline
    subgraph "Build & Packaging Pipeline"
        BUNDLER["Bundler Configs"]:::build
        SCRIPTS["Code Generation & Asset Pipelines"]:::build
        LINT["Lint & Formatting"]:::build
        TEST["Test Runner (Vitest)"]:::build
    end

    %% CI/CD Workflows
    CI["GitHub Actions CI"]:::build

    %% Distribution Channels
    subgraph "Distribution Channels"
        NPM["NPM Registry"]:::dist
        CDN["CDN Endpoints (unpkg, npmmirror)"]:::dist
        VERCEL["Docs Hosting (Vercel)"]:::dist
    end

    %% Consumers
    subgraph "Consumers"
        APP["Frontend Applications"]:::external
        DEVS["Developers (CDN embeds)"]:::external
    end

    %% Connections
    PNPM -->|workspace setup| SRC
    PNPM --> PNG
    PNPM --> SVG
    PNPM --> WEBP
    PNPM --> DOCS

    %% CI Trigger
    commit["Commit/Push"]:::external
    commit -->|triggers| CI
    CI -->|run build/test/lint| BUNDLER
    CI --> SCRIPTS
    CI --> LINT
    CI --> TEST

    %% Pipeline outputs
    BUNDLER -->|compile React API| SRC
    SCRIPTS -->|generate assets & docs| PNG
    SCRIPTS --> SVG
    SCRIPTS --> WEBP
    SCRIPTS --> DOCS

    %% Publish and distribution
    BUNDLER -->|publish| NPM
    PNG --> NPM
    SVG --> NPM
    WEBP --> NPM
    NPM --> CDN
    DOCS -->|deploy| VERCEL

    %% Consumption
    APP -->|install from| NPM
    APP -->|import React components| SRC
    DEVS -->|embed| CDN

    DOCS -->|view| APP

    %% Click Events
    click SRC "https://github.com/lobehub/lobe-icons/blob/master/src/index.ts"
    click PNG "https://github.com/lobehub/lobe-icons/tree/master/packages/static-png/"
    click SVG "https://github.com/lobehub/lobe-icons/tree/master/packages/static-svg/"
    click WEBP "https://github.com/lobehub/lobe-icons/tree/master/packages/static-webp/"
    click DOCS "https://github.com/lobehub/lobe-icons/tree/master/docs/"
    click PNPM "https://github.com/lobehub/lobe-icons/blob/master/pnpm-workspace.yaml"
    click BUNDLER "https://github.com/lobehub/lobe-icons/blob/master/.fatherrc.ts"
    click SCRIPTS "https://github.com/lobehub/lobe-icons/blob/master/scripts/readmeWorkflow/index.ts"
    click LINT "https://github.com/lobehub/lobe-icons/blob/master/.eslintrc.js"
    click TEST "https://github.com/lobehub/lobe-icons/blob/master/vitest.config.ts"
    click CI "https://github.com/lobehub/lobe-icons/blob/master/.github/workflows/test.yml"

    %% Styles
    classDef source fill:#D0E8FF,stroke:#003366,color:#000;
    classDef build fill:#FFD8A8,stroke:#995500,color:#000;
    classDef dist fill:#D0FFD8,stroke:#006600,color:#000;
    classDef external fill:#E0E0E0,stroke:#666666,color:#000;
```
