How gabriel200622/bigcomponents works
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: index.tsx Core UI · layout.tsx Docs site · index.ts Hooks · turbo.json Turbo build
Components 22
Shared config
Workspace-wide build, lint, and Tailwind settings.
- Workspace · Top-level workspace that links and builds packages locally.
pnpm-workspace.yaml - Turbo build · Monorepo task orchestration for builds and checks.
turbo.json - Tailwind config · Base Tailwind design-token configuration shared across packages.
packages/tailwind-config/tailwind.config.js - TS configs · Shared TypeScript compiler presets for React and Next.js packages.
packages/tsconfig/base.json - ESLint config · Repo-wide lint preset consumed by workspace packages.
packages/eslint-config-custom/index.js
Libraries
Reusable packages published from the monorepo.
- Core UI · Primary design-system package with UI components and styling primitives.
packages/core/src/index.tsx - UI components · Reusable component implementations under the core package.
packages/core/src/ui/button.tsx - Core styles · Tailwind and CSS-variable styling layer for the core package.
packages/core/src/styles/index.css - Radix layer · Wrapper surface around Radix primitives used by the UI components.
packages/core/src/radix/index.tsx - Icon sets · Lucide and Heroicons re-exports used by the component API.
packages/core/src/lucide/index.tsx - Hooks · Standalone browser-state and interaction hook package.
packages/hooks/src/index.ts - Hook internals · Deeper implementations for focus trap, hotkeys, storage, and scroll behavior.
packages/hooks/src/hooks/use-focus-trap/use-focus-trap.ts - Server · Framework-agnostic endpoint, router, middleware, and env utilities.
packages/server/src/index.ts - Server modules · Endpoint, router, server, and schema building blocks.
packages/server/src/modules/router.ts
Docs app
Next.js documentation and component registry surface.
- Docs site · Documentation and live component registry site.
apps/docs/app/layout.tsx - Docs shell · Header, sidebar, mobile sheet, pager, TOC, and other surrounding UI.
apps/docs/components/header.tsx - Docs pages · Content-driven MDX docs routes rendered through the docs app.
apps/docs/app/(docs)/docs/[[...slug]]/page.tsx - MDX content · Authored docs and guides that feed the generated documentation model.
apps/docs/content/docs/introduction.mdx - Registry demos · Canonical component and hook demos rendered in the docs site.
apps/docs/registry/example/button-demo.tsx - Content pipeline · Transforms MDX content into the docs data model.
apps/docs/contentlayer.config.js
Examples
Framework host templates that consume the libraries.
- Vite example · Reference host app showing library consumption in Vite.
examples/with-vite/src/main.tsx - Gatsby example · Reference host app showing library consumption in Gatsby.
examples/with-gatsby/src/pages/index.tsx
Connections 26
- 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.