# gabriel200622/bigcomponents architecture

> Architecture diagram of the GitHub repository gabriel200622/bigcomponents, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-06-30). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/gabriel200622/bigcomponents
- Repository: https://github.com/gabriel200622/bigcomponents

## Overview

1. **This is a monorepo for a component platform, not a single app.**  
   The top-level structure separates reusable libraries from consumer surfaces: `packages/*` contains publishable libraries, `apps/docs` is the documentation/demo site, and `examples/*` are integration templates for host apps.

2. **`@bigcomponents/core` is the primary UI package.**  
   It exports the actual design-system components under `src/ui/*` plus supporting pieces like icons, theme/mode toggles, toast infrastructure, and shared styles. The package is built around Tailwind CSS and CSS variables, with Radix-based primitives wrapped into the project’s component API.

3. **Core’s dependency boundary is mostly “primitive UI + styling.”**  
   The `core` package composes external UI primitives from Radix, icon sets from Lucide/Heroicons, and the shared Tailwind theme config. Its `src/styles/index.css` and `tailwind.config.js` define the visual tokens and animations that consumers must include in their app shell.

4. **`@bigcomponents/hooks` is a separate browser-state utility package.**  
   It contains reusable hooks for interaction and environment state: clipboard, media query, fullscreen, hotkeys, local/session storage, resize, intersection, scroll, visibility, and similar concerns. Several hooks are split into submodules for deeper logic, which suggests the package is intended as a standalone utility layer, not tied to the UI library.

5. **`packages/server` is an independent server-side utility layer.**  
   It exposes endpoint/router/server modules plus env schema and middleware/response helpers. The presence of these modules indicates a small framework-agnostic server toolkit rather than an application server; it likely sits beside the frontend packages for projects that need backend integration.

6. **Shared config packages keep the repo consistent.**  
   `packages/tailwind-config`, `packages/tsconfig`, and `packages/eslint-config-custom` centralize build and lint settings across the repo. This is important architecturally because the UI package, docs app, and examples all rely on the same design-token and TypeScript assumptions.

7. **`apps/docs` is the main integration and documentation surface.**  
   It is a Next.js app that renders the docs site, component gallery, and usage examples. The app routes under `app/(docs)/docs/[[...slug]]` and `content/docs/*.mdx` show that most documentation is content-driven, with MDX pages powering the docs navigation.

8. **Docs content flows through Contentlayer and custom MDX processing.**  
   `apps/docs/contentlayer.config.js` defines the content pipeline, and helper files in `apps/docs/lib` handle rehype transformations, TOC generation, theme handling, and command snippets. This creates a clear flow: authored MDX content → generated content model → route page → rendered docs UI.

9. **The docs app also functions as a live component registry.**  
   `apps/docs/registry/example/*` contains many demo implementations used by `component-example`, `component-preview`, and `component-source`. That means the docs site is not just explanatory text; it is the canonical place where component examples are rendered and their source code is surfaced side by side.

10. **`apps/docs/components` provides the docs-shell UI around the content.**  
   These components cover the site chrome: header/footer, sidebar, mobile sheet, table of contents, pager, command menu, callouts, code block wrappers, and theme toggle. The docs app therefore has a two-layer structure: content pages beneath a reusable documentation layout.

11. **The repo includes consumer reference apps for two host environments.**  
   `examples/with-vite` and `examples/with-gatsby` demonstrate how the libraries are consumed in different app frameworks. These examples are architectural proof points for the package boundary: the libraries are framework-compatible, while the host app provides the runtime shell.

12. **The project’s build system is workspace-based and library-oriented.**  
   `pnpm-workspace.yaml`, `turbo.json`, and package-level `tsup.config.ts` files indicate a multi-package build pipeline where libraries are compiled to distributable artifacts and the docs/examples consume them locally. This matters for diagrams because the repo has both source packages and generated consumer surfaces.

13. **Overall dependency direction is one-way from libraries to apps.**  
   The core and hooks packages are authored as reusable primitives; the docs app and example apps import them to demonstrate usage. The docs site also imports its own registry examples and MDX content, so the main data flow is: authored package source → built library output → docs/examples consumption.

14. **When diagramming, keep these boundaries distinct.**  
   A good architecture diagram should show: shared config at the base; `core`, `hooks`, and `server` as peer libraries; `apps/docs` as the content-driven documentation/runtime app; and `examples/*` as external consumer templates that validate portability across frameworks.

Main entry points: [`packages/core/src/index.tsx`](https://github.com/gabriel200622/bigcomponents/blob/main/packages/core/src/index.tsx) (Core UI), [`apps/docs/app/layout.tsx`](https://github.com/gabriel200622/bigcomponents/blob/main/apps/docs/app/layout.tsx) (Docs site), [`packages/hooks/src/index.ts`](https://github.com/gabriel200622/bigcomponents/blob/main/packages/hooks/src/index.ts) (Hooks), [`turbo.json`](https://github.com/gabriel200622/bigcomponents/blob/main/turbo.json) (Turbo build)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_shared["Shared config"]
  node_workspace["Workspace<br/>pnpm/turbo monorepo"]
  node_buildpipe["Turbo build<br/>task pipeline<br/>[turbo.json]"]
  node_tailwindcfg["Tailwind config<br/>shared style config<br/>[tailwind.config.js]"]
  node_tsconfig["TS configs<br/>shared TS config<br/>[base.json]"]
  node_eslintcfg["ESLint config<br/>shared lint config<br/>[index.js]"]
end

subgraph group_libraries["Libraries"]
  node_corepkg["Core UI<br/>component library<br/>[index.tsx]"]
  node_coreui["UI components<br/>design-system components<br/>[button.tsx]"]
  node_corestyle["Core styles<br/>theme tokens<br/>[index.css]"]
  node_coreradix["Radix layer<br/>primitive wrappers<br/>[index.tsx]"]
  node_coreicons["Icon sets<br/>icon exports<br/>[index.tsx]"]
  node_hookspkg["Hooks<br/>utility library<br/>[index.ts]"]
  node_hookslogic["Hook internals<br/>hook submodules<br/>[use-focus-trap.ts]"]
  node_serverpkg["Server<br/>[index.ts]"]
  node_servermods["Server modules<br/>server primitives<br/>[router.ts]"]
end

subgraph group_docsapp["Docs app"]
  node_docsapp["Docs site<br/>Next.js app<br/>[layout.tsx]"]
  node_docslayout["Docs shell<br/>site chrome<br/>[header.tsx]"]
  node_docspage["Docs pages<br/>content routes<br/>[page.tsx]"]
  node_doccontent["MDX content<br/>content source<br/>[introduction.mdx]"]
  node_docregistry["Registry demos<br/>example registry<br/>[button-demo.tsx]"]
  node_contentlayer["Content pipeline<br/>content build"]
end

subgraph group_examples["Examples"]
  node_viteex["Vite example<br/>consumer app<br/>[main.tsx]"]
  node_gatsbyex["Gatsby example<br/>consumer app<br/>[index.tsx]"]
end

node_workspace -->|"coordinates"| node_buildpipe
node_buildpipe -->|"builds"| node_corepkg
node_buildpipe -->|"builds"| node_hookspkg
node_buildpipe -->|"builds"| node_serverpkg
node_tailwindcfg -->|"provides"| node_corestyle
node_tsconfig -->|"types"| node_corepkg
node_eslintcfg -->|"lints"| node_docsapp
node_tailwindcfg -->|"styles"| node_docsapp
node_corepkg -->|"exports"| node_coreui
node_corepkg -->|"includes"| node_corestyle
node_corepkg -->|"wraps"| node_coreradix
node_corepkg -->|"uses"| node_coreicons
node_hookspkg -->|"contains"| node_hookslogic
node_serverpkg -->|"assembles"| node_servermods
node_docsapp -->|"ingests"| node_contentlayer
node_contentlayer -->|"reads"| node_doccontent
node_docsapp -->|"renders"| node_docslayout
node_docsapp -->|"routes"| node_docspage
node_docsapp -->|"shows"| node_docregistry
node_docslayout -->|"embeds"| node_docregistry
node_docsapp -->|"documents"| node_corepkg
node_docsapp -->|"documents"| node_hookspkg
node_viteex -->|"consumes"| node_corepkg
node_viteex -->|"consumes"| node_hookspkg
node_gatsbyex -->|"consumes"| node_corepkg
node_gatsbyex -->|"consumes"| node_hookspkg

click node_workspace "https://github.com/gabriel200622/bigcomponents/blob/main/pnpm-workspace.yaml"
click node_buildpipe "https://github.com/gabriel200622/bigcomponents/blob/main/turbo.json"
click node_tailwindcfg "https://github.com/gabriel200622/bigcomponents/blob/main/packages/tailwind-config/tailwind.config.js"
click node_tsconfig "https://github.com/gabriel200622/bigcomponents/blob/main/packages/tsconfig/base.json"
click node_eslintcfg "https://github.com/gabriel200622/bigcomponents/blob/main/packages/eslint-config-custom/index.js"
click node_corepkg "https://github.com/gabriel200622/bigcomponents/blob/main/packages/core/src/index.tsx"
click node_coreui "https://github.com/gabriel200622/bigcomponents/blob/main/packages/core/src/ui/button.tsx"
click node_corestyle "https://github.com/gabriel200622/bigcomponents/blob/main/packages/core/src/styles/index.css"
click node_coreradix "https://github.com/gabriel200622/bigcomponents/blob/main/packages/core/src/radix/index.tsx"
click node_coreicons "https://github.com/gabriel200622/bigcomponents/blob/main/packages/core/src/lucide/index.tsx"
click node_hookspkg "https://github.com/gabriel200622/bigcomponents/blob/main/packages/hooks/src/index.ts"
click node_hookslogic "https://github.com/gabriel200622/bigcomponents/blob/main/packages/hooks/src/hooks/use-focus-trap/use-focus-trap.ts"
click node_serverpkg "https://github.com/gabriel200622/bigcomponents/blob/main/packages/server/src/index.ts"
click node_servermods "https://github.com/gabriel200622/bigcomponents/blob/main/packages/server/src/modules/router.ts"
click node_docsapp "https://github.com/gabriel200622/bigcomponents/blob/main/apps/docs/app/layout.tsx"
click node_docslayout "https://github.com/gabriel200622/bigcomponents/blob/main/apps/docs/components/header.tsx"
click node_docspage "https://github.com/gabriel200622/bigcomponents/blob/main/apps/docs/app/(docs)/docs/[[...slug]]/page.tsx"
click node_doccontent "https://github.com/gabriel200622/bigcomponents/blob/main/apps/docs/content/docs/introduction.mdx"
click node_docregistry "https://github.com/gabriel200622/bigcomponents/blob/main/apps/docs/registry/example/button-demo.tsx"
click node_contentlayer "https://github.com/gabriel200622/bigcomponents/blob/main/apps/docs/contentlayer.config.js"
click node_viteex "https://github.com/gabriel200622/bigcomponents/blob/main/examples/with-vite/src/main.tsx"
click node_gatsbyex "https://github.com/gabriel200622/bigcomponents/blob/main/examples/with-gatsby/src/pages/index.tsx"

classDef toneNeutral fill:#f8fafc,stroke:#334155,stroke-width:1.5px,color:#0f172a
classDef toneBlue fill:#dbeafe,stroke:#2563eb,stroke-width:1.5px,color:#172554
classDef toneAmber fill:#fef3c7,stroke:#d97706,stroke-width:1.5px,color:#78350f
classDef toneMint fill:#dcfce7,stroke:#16a34a,stroke-width:1.5px,color:#14532d
classDef toneRose fill:#ffe4e6,stroke:#e11d48,stroke-width:1.5px,color:#881337
classDef toneIndigo fill:#e0e7ff,stroke:#4f46e5,stroke-width:1.5px,color:#312e81
classDef toneTeal fill:#ccfbf1,stroke:#0f766e,stroke-width:1.5px,color:#134e4a
class node_workspace,node_buildpipe,node_tailwindcfg,node_tsconfig,node_eslintcfg toneBlue
class node_corepkg,node_coreui,node_corestyle,node_coreradix,node_coreicons,node_hookspkg,node_hookslogic,node_serverpkg,node_servermods toneAmber
class node_docsapp,node_docslayout,node_docspage,node_doccontent,node_docregistry,node_contentlayer toneMint
class node_viteex,node_gatsbyex toneRose
```

## Components

### Shared config

Workspace-wide build, lint, and Tailwind settings.

- [Workspace](https://github.com/gabriel200622/bigcomponents/blob/main/pnpm-workspace.yaml): pnpm/turbo monorepo · Top-level workspace that links and builds packages locally. · `pnpm-workspace.yaml`
- [Turbo build](https://github.com/gabriel200622/bigcomponents/blob/main/turbo.json): task pipeline · Monorepo task orchestration for builds and checks. · `turbo.json`
- [Tailwind config](https://github.com/gabriel200622/bigcomponents/blob/main/packages/tailwind-config/tailwind.config.js): shared style config · Base Tailwind design-token configuration shared across packages. · `packages/tailwind-config/tailwind.config.js`
- [TS configs](https://github.com/gabriel200622/bigcomponents/blob/main/packages/tsconfig/base.json): shared TS config · Shared TypeScript compiler presets for React and Next.js packages. · `packages/tsconfig/base.json`
- [ESLint config](https://github.com/gabriel200622/bigcomponents/blob/main/packages/eslint-config-custom/index.js): shared lint config · Repo-wide lint preset consumed by workspace packages. · `packages/eslint-config-custom/index.js`

### Libraries

Reusable packages published from the monorepo.

- [Core UI](https://github.com/gabriel200622/bigcomponents/blob/main/packages/core/src/index.tsx): component library · Primary design-system package with UI components and styling primitives. · `packages/core/src/index.tsx`
- [UI components](https://github.com/gabriel200622/bigcomponents/blob/main/packages/core/src/ui/button.tsx): design-system components · Reusable component implementations under the core package. · `packages/core/src/ui/button.tsx`
- [Core styles](https://github.com/gabriel200622/bigcomponents/blob/main/packages/core/src/styles/index.css): theme tokens · Tailwind and CSS-variable styling layer for the core package. · `packages/core/src/styles/index.css`
- [Radix layer](https://github.com/gabriel200622/bigcomponents/blob/main/packages/core/src/radix/index.tsx): primitive wrappers · Wrapper surface around Radix primitives used by the UI components. · `packages/core/src/radix/index.tsx`
- [Icon sets](https://github.com/gabriel200622/bigcomponents/blob/main/packages/core/src/lucide/index.tsx): icon exports · Lucide and Heroicons re-exports used by the component API. · `packages/core/src/lucide/index.tsx`
- [Hooks](https://github.com/gabriel200622/bigcomponents/blob/main/packages/hooks/src/index.ts): utility library · Standalone browser-state and interaction hook package. · `packages/hooks/src/index.ts`
- [Hook internals](https://github.com/gabriel200622/bigcomponents/blob/main/packages/hooks/src/hooks/use-focus-trap/use-focus-trap.ts): hook submodules · Deeper implementations for focus trap, hotkeys, storage, and scroll behavior. · `packages/hooks/src/hooks/use-focus-trap/use-focus-trap.ts`
- [Server](https://github.com/gabriel200622/bigcomponents/blob/main/packages/server/src/index.ts): server toolkit · Framework-agnostic endpoint, router, middleware, and env utilities. · `packages/server/src/index.ts`
- [Server modules](https://github.com/gabriel200622/bigcomponents/blob/main/packages/server/src/modules/router.ts): server primitives · Endpoint, router, server, and schema building blocks. · `packages/server/src/modules/router.ts`

### Docs app

Next.js documentation and component registry surface.

- [Docs site](https://github.com/gabriel200622/bigcomponents/blob/main/apps/docs/app/layout.tsx): Next.js app · Documentation and live component registry site. · `apps/docs/app/layout.tsx`
- [Docs shell](https://github.com/gabriel200622/bigcomponents/blob/main/apps/docs/components/header.tsx): site chrome · Header, sidebar, mobile sheet, pager, TOC, and other surrounding UI. · `apps/docs/components/header.tsx`
- [Docs pages](https://github.com/gabriel200622/bigcomponents/blob/main/apps/docs/app/(docs)/docs/[[...slug]]/page.tsx): content routes · Content-driven MDX docs routes rendered through the docs app. · `apps/docs/app/(docs)/docs/[[...slug]]/page.tsx`
- [MDX content](https://github.com/gabriel200622/bigcomponents/blob/main/apps/docs/content/docs/introduction.mdx): content source · Authored docs and guides that feed the generated documentation model. · `apps/docs/content/docs/introduction.mdx`
- [Registry demos](https://github.com/gabriel200622/bigcomponents/blob/main/apps/docs/registry/example/button-demo.tsx): example registry · Canonical component and hook demos rendered in the docs site. · `apps/docs/registry/example/button-demo.tsx`
- [Content pipeline](https://github.com/gabriel200622/bigcomponents/blob/main/apps/docs/contentlayer.config.js): content build · Transforms MDX content into the docs data model. · `apps/docs/contentlayer.config.js`

### Examples

Framework host templates that consume the libraries.

- [Vite example](https://github.com/gabriel200622/bigcomponents/blob/main/examples/with-vite/src/main.tsx): consumer app · Reference host app showing library consumption in Vite. · `examples/with-vite/src/main.tsx`
- [Gatsby example](https://github.com/gabriel200622/bigcomponents/blob/main/examples/with-gatsby/src/pages/index.tsx): consumer app · Reference host app showing library consumption in Gatsby. · `examples/with-gatsby/src/pages/index.tsx`

## Connections

- Workspace → Turbo build: coordinates · Workspace packages are orchestrated through the monorepo pipeline.
- Turbo build → Core UI: builds · Turbo builds the publishable library packages.
- Turbo build → Hooks: builds · Turbo builds the hooks package.
- Turbo build → Server: builds · Turbo builds the server toolkit package.
- Tailwind config → Core styles: provides · Shared Tailwind configuration underpins the core styling layer.
- TS configs → Core UI: types · Shared TypeScript presets are used across library packages.
- ESLint config → Docs site: lints · Docs app follows the shared workspace lint rules.
- Tailwind config → Docs site: styles · Docs app uses the shared Tailwind design system assumptions.
- Core UI → UI components: exports · The core package primarily exposes reusable UI components.
- Core UI → Core styles: includes · Component styling is driven by shared CSS variables and tokens.
- Core UI → Radix layer: wraps · Core components are built on Radix primitives.
- Core UI → Icon sets: uses · UI components consume shared icon exports.
- Hooks → Hook internals: contains · Several hooks delegate to deeper implementation modules.
- Server → Server modules: assembles · Server toolkit composes modules into endpoint/router/server APIs.
- Docs site → Content pipeline: ingests · Docs app content is transformed through Contentlayer.
- Content pipeline → MDX content: reads · MDX sources are the authored input to the docs pipeline.
- Docs site → Docs shell: renders · The docs app wraps content in a reusable docs shell.
- Docs site → Docs pages: routes · Content-driven routes serve the documentation pages.
- Docs site → Registry demos: shows · Docs pages render live component and hook demos from the registry.
- Docs shell → Registry demos: embeds · The docs shell hosts previews, source views, and navigation around demos.
- Docs site → Core UI: documents · Docs pages demonstrate the core UI package via examples and source.
- Docs site → Hooks: documents · Docs pages demonstrate hooks via example snippets.
- Vite example → Core UI: consumes · The Vite example imports the reusable component library.
- Vite example → Hooks: consumes · The Vite example can also consume shared hooks.
- Gatsby example → Core UI: consumes · The Gatsby example imports the reusable component library.
- Gatsby example → Hooks: consumes · The Gatsby example can also consume shared hooks.
