# brightlab/core architecture

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

- Interactive diagram: https://gitdiagram.com/brightlab/core
- Repository: https://github.com/brightlab/core

## Overview

##### Project type and purpose
- Bright Lab Core is an open-source React UI component library built on top of Material UI.
- It exposes reusable UI building blocks (Form, TextField, Select, RadioGroup, etc.) to speed up feature development across applications.

##### File structure
- Top-level build/configuration files:
- babel.config.json / .babelrc, tsconfig.json, tslint.json, .prettierrc
- package.json / package-lock.json
- .github/workflows/release-package.yml (CI/CD pipeline for publishing)
- Source code: `/src` contains per-component folders (CheckBox, FileUpload, Form, List, Popup, RadioGroup, Select, TextField) each with a single `index.tsx` or helper file.
- Declaration file: `src/declaration.d.ts` for any global type overrides.
- Entry point: `src/index.ts` aggregates and re-exports components.
- Distribution: `/dist` mirrors `/src` output in JS and .d.ts form after build.
- Stories: `/stories` contains Storybook stories to document and test each component.

##### README for additional insights
- Purpose: package UI primitives for React, based on Material UI.
- Installation instructions and a usage example of the Form component.
- It hints at a CI/CD flow (releases on GitHub, NPM publishing) and versioning.

## Diagram (Mermaid)

```mermaid
flowchart TD
    %% Component Library Source
    subgraph "Component Library Source"
        direction TB
        CB_SRC["CheckBox"]:::source
        FU_SRC["FileUpload"]:::source
        FORM_SRC["Form"]:::source
        PLUS_SRC["PlusButton"]:::source
        LIST_SRC["List"]:::source
        POPUP_SRC["Popup"]:::source
        RG_SRC["RadioGroup"]:::source
        SEL_SRC["Select"]:::source
        TF_SRC["TextField"]:::source
        ENTRY_SRC["index.ts"]:::source
        DECL_SRC["declaration.d.ts"]:::source
    end

    %% External Dependency
    MUI["Material UI"]:::external

    %% Build & CI Pipeline
    subgraph "Build & CI Pipeline"
        direction TB
        BABEL["Babel"]:::build
        TSC["TypeScript Compiler"]:::build
        LINT["TSLint"]:::build
        PRETTIER["Prettier"]:::build
        GHA["GitHub Actions"]:::ci
        STORYBOOK_CFG["Storybook Config"]:::docs
        STORYBOOK["Storybook"]:::docs
    end

    %% Distribution Package
    subgraph "Distribution (dist)"
        direction TB
        CB_DIST["CheckBox"]:::dist
        FU_DIST["FileUpload"]:::dist
        FORM_DIST["Form"]:::dist
        PLUS_DIST["PlusButton"]:::dist
        LIST_DIST["List"]:::dist
        POPUP_DIST["Popup"]:::dist
        RG_DIST["RadioGroup"]:::dist
        SEL_DIST["Select"]:::dist
        TF_DIST["TextField"]:::dist
        ENTRY_DIST["index.js/.d.ts"]:::dist
    end

    %% Registry & Consumer
    NPM["NPM Registry"]:::external
    CONSUMER["Consumer App"]:::external

    %% Connections: Source to MUI
    CB_SRC -->|"uses"| MUI
    FU_SRC -->|"uses"| MUI
    FORM_SRC -->|"uses"| MUI
    PLUS_SRC -->|"uses"| MUI
    LIST_SRC -->|"uses"| MUI
    POPUP_SRC -->|"uses"| MUI
    RG_SRC -->|"uses"| MUI
    SEL_SRC -->|"uses"| MUI
    TF_SRC -->|"uses"| MUI

    %% Source to Build
    CB_SRC --> TSC
    FU_SRC --> TSC
    FORM_SRC --> TSC
    PLUS_SRC --> TSC
    LIST_SRC --> TSC
    POPUP_SRC --> TSC
    RG_SRC --> TSC
    SEL_SRC --> TSC
    TF_SRC --> TSC
    ENTRY_SRC --> TSC
    DECL_SRC --> TSC
    BABEL --> ENTRY_SRC

    TSC --> CB_DIST
    TSC --> FU_DIST
    TSC --> FORM_DIST
    TSC --> PLUS_DIST
    TSC --> LIST_DIST
    TSC --> POPUP_DIST
    TSC --> RG_DIST
    TSC --> SEL_DIST
    TSC --> TF_DIST
    TSC --> ENTRY_DIST

    %% Lint & Prettier
    CB_SRC --> LINT
    FU_SRC --> LINT
    FORM_SRC --> LINT
    PLUS_SRC --> LINT
    LIST_SRC --> LINT
    POPUP_SRC --> LINT
    RG_SRC --> LINT
    SEL_SRC --> LINT
    TF_SRC --> LINT
    ENTRY_SRC --> LINT
    DECL_SRC --> LINT
    CB_SRC --> PRETTIER
    FU_SRC --> PRETTIER
    FORM_SRC --> PRETTIER
    PLUS_SRC --> PRETTIER
    LIST_SRC --> PRETTIER
    POPUP_SRC --> PRETTIER
    RG_SRC --> PRETTIER
    SEL_SRC --> PRETTIER
    TF_SRC --> PRETTIER
    ENTRY_SRC --> PRETTIER
    DECL_SRC --> PRETTIER

    %% Storybook
    STORYBOOK_CFG --> STORYBOOK
    CB_SRC --> STORYBOOK
    FU_SRC --> STORYBOOK
    FORM_SRC --> STORYBOOK
    PLUS_SRC --> STORYBOOK
    LIST_SRC --> STORYBOOK
    POPUP_SRC --> STORYBOOK
    RG_SRC --> STORYBOOK
    SEL_SRC --> STORYBOOK
    TF_SRC --> STORYBOOK

    %% CI actions
    GHA -->|"triggers build"| BABEL
    GHA -->|"runs lint/typecheck"| LINT
    GHA -->|"publishes dist"| NPM

    %% Dist to Registry & Consumer
    ENTRY_DIST --> NPM
    CB_DIST --> NPM
    FU_DIST --> NPM
    FORM_DIST --> NPM
    PLUS_DIST --> NPM
    LIST_DIST --> NPM
    POPUP_DIST --> NPM
    RG_DIST --> NPM
    SEL_DIST --> NPM
    TF_DIST --> NPM

    CONSUMER -->|"installs/imports @bright-lab/core"| NPM

    %% Click events
    click CB_SRC "https://github.com/brightlab/core/blob/main/src/CheckBox/index.tsx"
    click FU_SRC "https://github.com/brightlab/core/blob/main/src/FileUpload/index.tsx"
    click FORM_SRC "https://github.com/brightlab/core/blob/main/src/Form/index.tsx"
    click PLUS_SRC "https://github.com/brightlab/core/blob/main/src/Form/PlusBotton.tsx"
    click LIST_SRC "https://github.com/brightlab/core/blob/main/src/List/index.tsx"
    click POPUP_SRC "https://github.com/brightlab/core/blob/main/src/Popup/index.tsx"
    click RG_SRC "https://github.com/brightlab/core/blob/main/src/RadioGroup/index.tsx"
    click SEL_SRC "https://github.com/brightlab/core/blob/main/src/Select/index.tsx"
    click TF_SRC "https://github.com/brightlab/core/blob/main/src/TextField/index.tsx"
    click ENTRY_SRC "https://github.com/brightlab/core/blob/main/src/index.ts"
    click DECL_SRC "https://github.com/brightlab/core/blob/main/src/declaration.d.ts"
    click CB_DIST "https://github.com/brightlab/core/blob/main/dist/CheckBox/index.js"
    click FU_DIST "https://github.com/brightlab/core/blob/main/dist/FileUpload/index.js"
    click FORM_DIST "https://github.com/brightlab/core/blob/main/dist/Form/index.js"
    click PLUS_DIST "https://github.com/brightlab/core/blob/main/dist/Form/PlusBotton.js"
    click LIST_DIST "https://github.com/brightlab/core/blob/main/dist/List/index.js"
    click POPUP_DIST "https://github.com/brightlab/core/blob/main/dist/Popup/index.js"
    click RG_DIST "https://github.com/brightlab/core/blob/main/dist/RadioGroup/index.js"
    click SEL_DIST "https://github.com/brightlab/core/blob/main/dist/Select/index.js"
    click TF_DIST "https://github.com/brightlab/core/blob/main/dist/TextField/index.js"
    click ENTRY_DIST "https://github.com/brightlab/core/blob/main/dist/index.js"
    click STORYBOOK_CFG "https://github.com/brightlab/core/blob/main/.storybook/main.js"
    click GHA "https://github.com/brightlab/core/blob/main/.github/workflows/release-package.yml"
    click BABEL "https://github.com/brightlab/core/blob/main/.babelrc"
    click TSC "https://github.com/brightlab/core/blob/main/tsconfig.json"
    click LINT "https://github.com/brightlab/core/blob/main/tslint.json"
    click PRETTIER "https://github.com/brightlab/core/blob/main/.prettierrc"

    %% Styles
    classDef source fill:#D6EAF8,stroke:#3498DB,color:#0B5345
    classDef build fill:#D5F5E3,stroke:#27AE60,color:#145A32
    classDef dist fill:#FCF3CF,stroke:#F1C40F,color:#7D6608
    classDef external fill:#E5E8E8,stroke:#95A5A6,color:#566573
    classDef ci fill:#FADBD8,stroke:#E74C3C,color:#641E16
    classDef docs fill:#E8DAEF,stroke:#8E44AD,color:#4A235A
```
