How zendeskgarden/react-components works
Project type and purpose
• This is a monorepo-based React component library (Garden design system) maintained via Lerna and Yarn workspaces.
• It publishes dozens of standalone UI packages (buttons, forms, datepickers, etc.) under the single repository.
• Key features: multi-package build/publish, shared theming, Storybook demos, Jest tests, and centralized scripts/config.
File structure
• Top-level:
• .github, docs, utils, config files (babel.config.js, lerna.json, tsconfig.json, CI workflows)
• package.json / package-lock.json / Yarn workspace config under lerna.json
• packages/…: each folder is a component package with:
• package.json (defines name, version, peerDependencies)
• src/ (elements, styled, utils, types)
• demo/ (Storybook stories and MDX)
• tsconfig.build.json, tests (.spec.tsx)
• utils/: shared build and deploy scripts (rollup config, shell scripts)
• docs/: ADRs, API reference, migration guides, versioning, development guidelines
• .storybook/: global Storybook configuration for demos
• CI/CD via .github/workflows invoking build, lint, test, deploy
Insights from README
• Confirms multi-package approach: “React components are packaged and published individually”
• Shows package listing (accordions, avatars, … typography)
• References ThemeProvider from @zendeskgarden/react-theming as core dependency
• Encourages Storybook and external docs for usage and development
• Monorepo Root
– Lerna & Yarn Workspaces
– Shared config (TS, Babel, ESLint, Prettier)
– CI/CD pipelines (GitHub Actions)
– Docs & ADRs
– Utils (build, test, deploy scripts)
• Packages workspace
– Each package (e.g. react-buttons, react-forms)
– Underlying src layers: Elements → Styled components → Utilities → Types
– Demo layer (Storybook stories)
• Core @zendeskgarden/react-theming
• External dependencies: React, ReactDOM, styled-components (or Emotion), Lodash, etc.
• Consumers: downstream applications or other packages that import components
• Monorepo Root → initializes and orchestrates packages via Lerna
• Packages ← share configs & scripts from root utils
• Storybook config ← packages/demo feed into .storybook to render UI
• CI/CD → runs build/test/lint for all packages → publishes to npm registry
c. Architectural patterns/design principles:
• Monorepo with Lerna & Yarn Workspaces for version and dependency management
• Package-per-component for granular releases
• Separation of concerns:
– “elements” (React logic/UI)
– “styled” (CSS-in-JS definitions)
– “utils” (hooks, reducers, context)
– “types” (TypeScript definitions)
• Shared tooling (Babel, TypeScript, ESLint, Storybook) to enforce consistency
• Demo layer leveraging Storybook for visual regression and documentation
• ADRs capture key technical decisions
d. Relevant technologies/frameworks:
• React & ReactDOM
• TypeScript
• Babel & Rollup (build pipeline)
• Jest & Testing Library (unit tests)
• Storybook (component demos)
• GitHub Actions (CI/CD)
• Lerna & Yarn Workspaces (monorepo)
• CSS-in-JS library (styled-components or equivalent)