This document describes the complete implementation of the "codebase" project - a code library inspired by shadcn/ui that organizes the shadcn/ui ecosystem with a clear architectural separation between UI components, Atoms, and Templates.
┌──────────────────────────────────────┐
│ Templates │ ← Page sections (shadcn blocks)
├──────────────────────────────────────┤
│ Atoms │ ← Composed components
├──────────────────────────────────────┤
│ UI Components │ ← shadcn/ui primitives
├──────────────────────────────────────┤
│ Radix UI Primitives │ ← Base layer
└──────────────────────────────────────┘
Layer 1: UI Components (src/components/ui/)
- Direct shadcn/ui primitives (Button, Card, Dialog, etc.)
- 50+ components
- Installed via shadcn CLI
Layer 2: Atoms (src/components/atom/)
- 31 enhanced, composed components
- Organized by category: ai/, form/, display/, navigation/, feedback/
- Examples: ai-prompt-input, infinite-slider, modal system
Layer 3: Templates (src/components/template/)
- 8 complete page sections
- Versioned naming (header-01, header-02, sidebar-01, etc.)
- Production-ready layouts
codebase-underway/
├── src/
│ ├── components/
│ │ ├── ui/ # 50 shadcn/ui components
│ │ ├── atom/ # 31 atoms (organized by category)
│ │ │ ├── ai/ # AI components
│ │ │ └── modal/ # Modal system
│ │ └── template/ # 8 templates (versioned)
│ │
│ ├── registry/
│ │ ├── default/
│ │ │ ├── atoms/
│ │ │ │ └── _registry.ts # Atoms registry
│ │ │ ├── templates/ # Template components
│ │ │ └── ui/ # UI components
│ │ ├── registry-templates.ts # Template definitions
│ │ ├── registry-categories.ts # Category mappings
│ │ └── schema.ts # TypeScript interfaces
│ │
│ ├── app/[lang]/(root)/atoms/ # Atoms documentation routes
│ │ ├── [[...slug]]/page.tsx # Dynamic atom pages
│ │ └── layout.tsx # Atoms layout
│ │
│ └── components/root/template/
│ └── registry.ts # Zod validation schemas
│
├── content/atoms/(root)/ # 32 MDX documentation files
│ ├── index.mdx # Introduction
│ ├── accordion.mdx # Example
│ └── [31 other atoms].mdx # Generated docs
│
├── scripts/
│ ├── build-registry.mts # Registry build system
│ ├── generate-atom-docs.mts # MDX generator
│ ├── cli.mts # Component installer CLI
│ └── sync-shadcn.mts # Shadcn sync tool
│
├── public/r/ # Generated registry files
│ ├── styles/
│ │ ├── default/ # JSON files for all components
│ │ └── new-york/
│ ├── categories.json # Category list
│ ├── colors/ # Theme colors
│ └── themes.css # Generated theme CSS
│
└── __registry__/
└── index.tsx # Lazy-loaded component index
Schema: src/components/root/template/registry.ts
- Complete Zod validation
- Support for 14 component types including
registry:atom - Discriminated unions for file types
- Full metadata support (dependencies, cssVars, tailwind, etc.)
Atoms Registry: src/registry/default/atoms/_registry.ts
- 31 atoms categorized
- Dependencies tracked
- Registry dependencies mapped
- Categories: ai, display, animation, interactive, layout, navigation, modal, feedback, data, utility
Build System: scripts/build-registry.mts
- Generates
__registry__/index.tsxwith lazy loading - Creates JSON files in
public/r/styles/{style}/{component}.json - Supports both templates and atoms
- Multi-style support (default, new-york)
31 MDX Files Generated: content/atoms/(root)/*.mdx
- Frontmatter with categories, dependencies
- Installation instructions (CLI + Manual)
- Usage examples
- API reference tables
- Accessibility notes
Auto-Generated Sidebar: Updated meta.json
- All 31 atoms listed alphabetically
- Integrated with fumadocs page tree
- Dynamic navigation
Documentation Route: src/app/[lang]/(root)/atoms/
- Dynamic routing via
[[...slug]] - Static generation via
generateStaticParams() - Prev/next navigation
- Table of contents
- Breadcrumbs
Command: pnpm codebase <command>
Available Commands:
pnpm codebase list # List all components (atoms + templates)
pnpm codebase add <name> # Install component from registry
pnpm codebase help # Show helpFeatures:
- Fetches components from local registry
- Installs npm dependencies automatically
- Resolves registry dependencies recursively
- Copies files to correct locations
- Pretty terminal output with emojis
Implementation: scripts/cli.mts
Command: pnpm generate:docs
Features:
- Generates MDX for all atoms automatically
- Skips existing files
- Updates meta.json automatically
- Template-based generation
- Includes installation, usage, API, accessibility sections
Implementation: scripts/generate-atom-docs.mts
Command: pnpm sync:shadcn
Features:
- Compares local UI components with shadcn/ui source
- Detects new, updated, and deleted components
- Lists available blocks
- Provides sync recommendations
Configuration:
const SHADCN_PATH = "C:\\Users\\pc\\Downloads\\ui-main\\ui-main\\apps\\v4"Implementation: scripts/sync-shadcn.mts
20 Categories:
Template Categories:
- Sidebar, Dashboard, Authentication, Login, Hero, Charts, Forms, Tables
Atom Categories:
- AI, Display, Animation, Interactive, Layout, Navigation, Modal, Dialog, UI, Feedback, Data, Utility
File: src/registry/registry-categories.ts
Option 1: Use CLI
pnpm codebase add infinite-sliderOption 2: Manual
- Copy component from registry JSON
- Install dependencies manually
- Place in
src/components/atom/
- Add atom to
src/registry/default/atoms/_registry.ts - Run
pnpm generate:docsto create MDX - Edit generated MDX in
content/atoms/(root)/ - Run
pnpm build:registryto update registry
pnpm build:registryThis generates:
__registry__/index.tsx- Lazy-loaded component indexpublic/r/styles/default/*.json- Component JSON filespublic/r/styles/new-york/*.json- Style variant JSON filespublic/r/categories.json- Category mappingspublic/r/themes.css- Theme CSS variables
pnpm sync:shadcnReviews:
- New UI components from shadcn/ui
- Updated components (content diff)
- Deleted components
- Available blocks
- ai-prompt-input
- ai-status-indicator
- ai-streaming-text
- ai-response-display
- prompt-input
- response
- reasoning
- card, card-hover-effect, cards-metric
- gradient-animation
- infinite-cards, infinite-slider
- progressive-blur
- sticky-scroll
- simple-marquee
- faceted
- sortable
- expand-button
- header-section
- page-actions, page-header
- tabs
- modal-system (8 files)
- loading, announcement
- two-buttons, agent-heading
- theme-provider
- icons, fonts
- dashboard-01 - Analytics dashboard
- sidebar-01 - Collapsible sidebar
- login-01 - Login form
- leads-01 - Lead management
- hero-01 - Hero section
- header-01 - Header v1
- header-02 - Header v2
- footer-01 - Footer
pnpm devVisit:
- http://localhost:3000/atoms - Browse all atoms
- http://localhost:3000/atoms/accordion - View specific atom
- http://localhost:3000/templates - Browse templates
Edit src/registry/default/atoms/_registry.ts:
{
name: "my-new-atom",
type: "registry:atom",
description: "My custom atom component",
categories: ["display"],
files: [
{
path: "components/atom/my-new-atom.tsx",
type: "registry:component",
},
],
registryDependencies: ["button", "card"],
dependencies: ["framer-motion"],
}pnpm build:registrypnpm generate:docspnpm codebase list
pnpm codebase add my-new-atomExample: public/r/styles/default/ai-prompt-input.json
{
"$schema": "https://ui.shadcn.com/schema/registry-item.json",
"name": "ai-prompt-input",
"description": "AI-powered prompt input component",
"type": "registry:atom",
"dependencies": [],
"registryDependencies": ["button", "textarea"],
"files": [
{
"path": "components/atom/ai/ai-prompt-input.tsx",
"content": "// Component source code here",
"type": "registry:component",
"target": "components/ai/ai-prompt-input.tsx"
}
],
"categories": ["ai", "form"]
}✅ Registry schema structure ✅ Component types (registry:ui, registry:component, registry:block, etc.) ✅ Build system pattern (generate index + JSON files) ✅ Zod validation schemas ✅ Multi-style support ✅ Dependency tracking ✅ CLI pattern (add, list commands)
🔹 Added registry:atom type
🔹 Added 12 new categories for atoms
🔹 Separate atoms registry structure
🔹 MDX documentation generator
🔹 Sync tool for tracking updates
🔹 Fumadocs v16 integration for docs
📦 No npm package (copy-paste approach) 📦 Local registry only (no remote URLs yet) 📦 Single repository structure 📦 Manual curation vs automated scraping
- UI Components: 50
- Atoms: 31 (across 12 categories)
- Templates: 8
- Total Registry Items: 89
- MDX Documentation Files: 32 (31 atoms + 1 intro)
- Categories: 20 (8 template + 12 atom)
- Build Scripts: 3
- CLI Commands: 3
-
Component Previews
- Create demo components for each atom
- Add live preview in documentation
- Implement code playground
-
Search Functionality
- Full-text search across atoms
- Filter by category
- Search by dependencies
-
Remote Registry
- Host registry on CDN
- Support remote URLs in CLI
- Version management
-
CI/CD Integration
- Auto-build registry on push
- Auto-generate docs
- Deploy to hosting
-
Enhanced Sync
- Auto-detect breaking changes
- Generate migration guides
- Version tracking
-
Analytics
- Track component usage
- Popular component insights
- Dependency analysis
Issue: Cannot find module '_registry'
Solution:
# Ensure registry file exists
ls src/registry/default/atoms/_registry.ts
# Rebuild
pnpm build:registryIssue: Component "X" not found
Solution:
# Check if registry is built
ls public/r/styles/default/*.json
# Rebuild if missing
pnpm build:registryIssue: Fumadocs not seeing new files Solution:
# Regenerate fumadocs
pnpm fumadocs-mdx
# Or restart dev server
pnpm devIssue: Path not found Solution:
- Update
SHADCN_PATHinscripts/sync-shadcn.mts - Ensure shadcn/ui source is downloaded
- Inspired by: shadcn/ui
- Built with:
- Next.js 16
- React 19
- Fumadocs v16
- Radix UI
- Tailwind CSS v4
- Zod
- TypeScript
MIT (following shadcn/ui's open-source philosophy)
This implementation successfully creates a complete tech paradigm for the "codebase" project that:
- ✅ Fully utilizes shadcn/ui's open-source code and patterns
- ✅ Organizes 31 atoms + 8 templates + 50 UI components
- ✅ Provides comprehensive registry system
- ✅ Includes CLI tool for component installation
- ✅ Generates documentation automatically
- ✅ Tracks shadcn/ui updates
- ✅ Maintains 3-layer architecture (UI → Atoms → Templates)
- ✅ Follows shadcn/ui best practices
All phases completed successfully! 🎉