Docs / guide/registry architecture
Architecture Guide
8 min read

Registry-Driven Architecture

Learn how the RegistryHub powers dynamic routing and documentation scale.

Centralized Source of Truth

Everything in SnapJSX is driven by the RegistryHub. This centralized manifest maps technical metadata (titles, descriptions, code snippets) to the documentation UI. This architecture allows us to add new components in seconds without manually creating new pages.
typescript
export const RegistryHub: Record<string, ComponentVariant[]> = {
  'Core Components': [
    {
      title: 'Primary Button',
      category: 'Buttons',
      description: '...', 
      preview: <PrimaryButton />,
      codeJsx: '...'
    }
  ]
};

Dynamic Routing

The documentation uses Next.js catch-all routes to parse segments and look up the corresponding registry entry. This ensures that the URL always matches the data structure perfectly.