How badatt/tidy-ui works
Project Type and Purpose
• This is a monorepo–style React component library (“Tidy UI”) managed by Lerna. It provides a modular set of styled-components (UI primitives) organized into package groups (presentation, layout, form, navigation, feedback, commons, types, etc.). Consumers install individual packages (e.g., “@tidy-ui/button”) and wrap their app in a global TidyUiProvider for theming.
File-Structure Analysis
• Root
• Configuration files (babel.config.js, rollup.config.js, tsconfig*.json, ESLint, Prettier, Husky, GitHub workflows)
• internals/ – code generators for new components and docs templates
• packages/ – ~70 subfolders, each a standalone component or utility (each with its own src/, tests/, stories/, package.json, tsconfig.build.json)
• storybook/ – Storybook config + custom theming
• Patterns
• Monorepo with Lerna (lerna.json)
• Rollup-based build for each package
• Storybook for live component preview
• Jest + snapshots for unit tests
• CI/CD via GitHub Actions (PR checks, publish, Storybook deployment)
a. Main Components
• Developer Workstation (IDE + Git)
• GitHub Repository (monorepo root)
• Lerna/CLI – orchestrates bootstrap, build, publish
• Internal Generators (internals/) – scaffolding
• Package Modules (packages/*) – 70+ component packages
• Build & Test Tools – Rollup, Babel, Jest
• Storybook Server – hosts UI catalog
• Registry (npm) – package publication
• Consumer App – imports tidy-ui packages
b. Relationships & Data Flow
1. Developer pushes code → GitHub repo
2. GitHub Actions triggers PR checks (lint, test, build)
3. Lerna bootstraps dependencies, Rollup builds each package
4. Storybook workflow builds and deploys a static site
5. On release, publish workflow pushes package versions to npm
6. Consumer App installs from npm, pulls in peer-deps (@tidy-ui/commons for Provider)
c. Architectural Patterns
• Monorepo (single source, many packages)
• “Publish per package” pattern
• Code generation for consistency via internals/generators
• Separation of concerns: each package is independent, relying on shared commons and types
d. Key Technologies
• React + styled-components
• TypeScript (tsconfig.base.json / tsconfig.build.json)
• Rollup (bundling)
• Lerna (monorepo management)
• Jest (unit testing)
• Storybook (component explorer)
• GitHub Actions (CI/CD)
Essential Architectural Elements
• Monorepo root with Lerna orchestrator
• Internal code generators for package scaffolding
• Individual component packages (with own build/test config)
• Build pipeline and CI/CD via GitHub Actions
• Storybook documentation site
• npm registry for distribution
• Consumer integration via TidyUiProvider and package imports