# nauvalazhar/ai architecture

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

- Interactive diagram: https://gitdiagram.com/nauvalazhar/ai
- Repository: https://github.com/nauvalazhar/ai

## Overview

This repository provides source-owned React AI interface components, a browsable documentation/demo playground, and a companion CLI for registry-based installation and setup. A user-facing path is to explore a component, inspect its documentation or demo, and preview it; consumers can also compose the shipped chat, tool, reasoning, and media surfaces in their own applications. The CLI builds registries and supports adding items and executing setup steps. Several CLI and route details are unsampled, so uncertain connections are omitted.

Main entry points: [`src/routes/_explorer.$component.$demo.tsx`](https://github.com/nauvalazhar/ai/blob/main/src/routes/_explorer.%24component.%24demo.tsx) (Component demo route), [`packages/ai/src/commands/build.ts`](https://github.com/nauvalazhar/ai/blob/main/packages/ai/src/commands/build.ts) (Build command), [`src/routeTree.gen.ts`](https://github.com/nauvalazhar/ai/blob/main/src/routeTree.gen.ts) (Route map), [`src/routes/_explorer.$component.index.tsx`](https://github.com/nauvalazhar/ai/blob/main/src/routes/_explorer.%24component.index.tsx) (Component docs routes)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_ui["AI UI components"]
  node_ai_core["Chat surfaces<br/>[message.tsx]"]
  node_composer["Prompt composer<br/>[composer.tsx]"]
  node_tools["Tool and agent UI<br/>[tool.tsx]"]
  node_reasoning["Reasoning UI<br/>[reasoning.tsx]"]
  node_rich_output["Rich output<br/>[diff.tsx]"]
  node_media["Media surfaces<br/>[player.tsx]"]
  node_button["Button primitive<br/>[button.tsx]"]
end

subgraph group_playground["Docs and demos"]
  node_router["App router<br/>[router.tsx]"]
  node_route_tree["Route map<br/>[routeTree.gen.ts]"]
  node_component_routes["Component docs routes"]
  node_demo_route["Component demo route"]
  node_registry_data["Playground registry<br/>[registry.ts]"]
  node_preview["Demo preview<br/>[preview-view.tsx]"]
  node_docs_view["Docs renderer<br/>[docs-view.tsx]"]
  node_sidebar["Explorer navigation<br/>[sidebar.tsx]"]
end

subgraph group_registry["Registry CLI"]
  node_build_command["Build command<br/>[build.ts]"]
  node_registry_builder["Registry builder<br/>[build-registry.ts]"]
  node_shadcn_builder["shadcn registry builder"]
  node_item_schema["Item schema<br/>[item-schema.ts]"]
  node_registry_schema["Registry schema<br/>[registry-schema.ts]"]
  node_add_command["Add command<br/>[add.ts]"]
end

subgraph group_setup["Project setup"]
  node_setup_schema["Setup schema<br/>[setup-schema.ts]"]
  node_setup_executor["Setup executor<br/>[setup-executor.ts]"]
  node_dependency_installer["Dependency installer"]
  node_package_manager["Package manager detection<br/>[package-manager.ts]"]
end

node_consumer(("React app builder"))

node_consumer -.->|"composes"| node_ai_core
node_consumer -.->|"composes"| node_composer
node_consumer -.->|"composes"| node_tools
node_consumer -.->|"composes"| node_reasoning
node_router -->|"loads"| node_route_tree
node_route_tree -->|"registers"| node_component_routes
node_route_tree -->|"registers"| node_demo_route
node_component_routes -->|"renders"| node_docs_view
node_component_routes -->|"queries"| node_registry_data
node_demo_route -->|"queries"| node_registry_data
node_demo_route -->|"renders"| node_preview
node_demo_route -->|"uses"| node_button
node_registry_data -.->|"provides docs"| node_docs_view
node_build_command -->|"invokes"| node_registry_builder
node_build_command -->|"invokes"| node_shadcn_builder
node_build_command -->|"validates with"| node_registry_schema
node_registry_builder -->|"uses"| node_registry_schema
node_registry_builder -->|"uses"| node_item_schema
node_shadcn_builder -->|"uses"| node_registry_schema
node_shadcn_builder -->|"uses"| node_item_schema
node_setup_executor -->|"validates with"| node_setup_schema
node_setup_executor -->|"calls"| node_dependency_installer
node_dependency_installer -->|"uses"| node_package_manager
node_add_command -.->|"adds components"| node_consumer

click node_ai_core "https://github.com/nauvalazhar/ai/blob/main/src/components/ai/message.tsx"
click node_composer "https://github.com/nauvalazhar/ai/blob/main/src/components/ai/composer.tsx"
click node_tools "https://github.com/nauvalazhar/ai/blob/main/src/components/ai/tool.tsx"
click node_reasoning "https://github.com/nauvalazhar/ai/blob/main/src/components/ai/reasoning.tsx"
click node_rich_output "https://github.com/nauvalazhar/ai/blob/main/src/components/ai/diff.tsx"
click node_media "https://github.com/nauvalazhar/ai/blob/main/src/components/ai/player.tsx"
click node_button "https://github.com/nauvalazhar/ai/blob/main/src/components/ai/button.tsx"
click node_router "https://github.com/nauvalazhar/ai/blob/main/src/router.tsx"
click node_route_tree "https://github.com/nauvalazhar/ai/blob/main/src/routeTree.gen.ts"
click node_component_routes "https://github.com/nauvalazhar/ai/blob/main/src/routes/_explorer.%24component.index.tsx"
click node_demo_route "https://github.com/nauvalazhar/ai/blob/main/src/routes/_explorer.%24component.%24demo.tsx"
click node_registry_data "https://github.com/nauvalazhar/ai/blob/main/src/components/playground/registry.ts"
click node_preview "https://github.com/nauvalazhar/ai/blob/main/src/components/playground/preview-view.tsx"
click node_docs_view "https://github.com/nauvalazhar/ai/blob/main/src/components/playground/docs-view.tsx"
click node_sidebar "https://github.com/nauvalazhar/ai/blob/main/src/components/playground/sidebar.tsx"
click node_build_command "https://github.com/nauvalazhar/ai/blob/main/packages/ai/src/commands/build.ts"
click node_registry_builder "https://github.com/nauvalazhar/ai/blob/main/packages/ai/src/lib/build-registry.ts"
click node_shadcn_builder "https://github.com/nauvalazhar/ai/blob/main/packages/ai/src/lib/build-shadcn-registry.ts"
click node_item_schema "https://github.com/nauvalazhar/ai/blob/main/packages/ai/src/schemas/item-schema.ts"
click node_registry_schema "https://github.com/nauvalazhar/ai/blob/main/packages/ai/src/schemas/registry-schema.ts"
click node_setup_schema "https://github.com/nauvalazhar/ai/blob/main/packages/ai/src/schemas/setup-schema.ts"
click node_setup_executor "https://github.com/nauvalazhar/ai/blob/main/packages/ai/src/lib/setup-executor.ts"
click node_dependency_installer "https://github.com/nauvalazhar/ai/blob/main/packages/ai/src/lib/install-dependencies.ts"
click node_package_manager "https://github.com/nauvalazhar/ai/blob/main/packages/ai/src/lib/package-manager.ts"
click node_add_command "https://github.com/nauvalazhar/ai/blob/main/packages/ai/src/commands/add.ts"

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_ai_core,node_composer,node_tools,node_reasoning,node_rich_output,node_media,node_button toneBlue
class node_router,node_route_tree,node_component_routes,node_demo_route,node_registry_data,node_preview,node_docs_view,node_sidebar toneAmber
class node_build_command,node_registry_builder,node_shadcn_builder,node_item_schema,node_registry_schema,node_add_command toneMint
class node_setup_schema,node_setup_executor,node_dependency_installer,node_package_manager toneRose
class node_consumer toneIndigo
```

## Components

### AI UI components

- [Chat surfaces](https://github.com/nauvalazhar/ai/blob/main/src/components/ai/message.tsx): `src/components/ai/message.tsx`
- [Prompt composer](https://github.com/nauvalazhar/ai/blob/main/src/components/ai/composer.tsx): `src/components/ai/composer.tsx`
- [Tool and agent UI](https://github.com/nauvalazhar/ai/blob/main/src/components/ai/tool.tsx): `src/components/ai/tool.tsx`
- [Reasoning UI](https://github.com/nauvalazhar/ai/blob/main/src/components/ai/reasoning.tsx): `src/components/ai/reasoning.tsx`
- [Rich output](https://github.com/nauvalazhar/ai/blob/main/src/components/ai/diff.tsx): `src/components/ai/diff.tsx`
- [Media surfaces](https://github.com/nauvalazhar/ai/blob/main/src/components/ai/player.tsx): `src/components/ai/player.tsx`
- [Button primitive](https://github.com/nauvalazhar/ai/blob/main/src/components/ai/button.tsx): `src/components/ai/button.tsx`

### Docs and demos

- [App router](https://github.com/nauvalazhar/ai/blob/main/src/router.tsx): `src/router.tsx`
- [Route map](https://github.com/nauvalazhar/ai/blob/main/src/routeTree.gen.ts): `src/routeTree.gen.ts`
- [Component docs routes](https://github.com/nauvalazhar/ai/blob/main/src/routes/_explorer.%24component.index.tsx): `src/routes/_explorer.$component.index.tsx`
- [Component demo route](https://github.com/nauvalazhar/ai/blob/main/src/routes/_explorer.%24component.%24demo.tsx): `src/routes/_explorer.$component.$demo.tsx`
- [Playground registry](https://github.com/nauvalazhar/ai/blob/main/src/components/playground/registry.ts): `src/components/playground/registry.ts`
- [Demo preview](https://github.com/nauvalazhar/ai/blob/main/src/components/playground/preview-view.tsx): `src/components/playground/preview-view.tsx`
- [Docs renderer](https://github.com/nauvalazhar/ai/blob/main/src/components/playground/docs-view.tsx): `src/components/playground/docs-view.tsx`
- [Explorer navigation](https://github.com/nauvalazhar/ai/blob/main/src/components/playground/sidebar.tsx): `src/components/playground/sidebar.tsx`

### Registry CLI

- [Build command](https://github.com/nauvalazhar/ai/blob/main/packages/ai/src/commands/build.ts): `packages/ai/src/commands/build.ts`
- [Registry builder](https://github.com/nauvalazhar/ai/blob/main/packages/ai/src/lib/build-registry.ts): `packages/ai/src/lib/build-registry.ts`
- [shadcn registry builder](https://github.com/nauvalazhar/ai/blob/main/packages/ai/src/lib/build-shadcn-registry.ts): `packages/ai/src/lib/build-shadcn-registry.ts`
- [Item schema](https://github.com/nauvalazhar/ai/blob/main/packages/ai/src/schemas/item-schema.ts): `packages/ai/src/schemas/item-schema.ts`
- [Registry schema](https://github.com/nauvalazhar/ai/blob/main/packages/ai/src/schemas/registry-schema.ts): `packages/ai/src/schemas/registry-schema.ts`
- [Add command](https://github.com/nauvalazhar/ai/blob/main/packages/ai/src/commands/add.ts): `packages/ai/src/commands/add.ts`

### Project setup

- [Setup schema](https://github.com/nauvalazhar/ai/blob/main/packages/ai/src/schemas/setup-schema.ts): `packages/ai/src/schemas/setup-schema.ts`
- [Setup executor](https://github.com/nauvalazhar/ai/blob/main/packages/ai/src/lib/setup-executor.ts): `packages/ai/src/lib/setup-executor.ts`
- [Dependency installer](https://github.com/nauvalazhar/ai/blob/main/packages/ai/src/lib/install-dependencies.ts): `packages/ai/src/lib/install-dependencies.ts`
- [Package manager detection](https://github.com/nauvalazhar/ai/blob/main/packages/ai/src/lib/package-manager.ts): `packages/ai/src/lib/package-manager.ts`

### Other components

- **React app builder**

## Connections

- React app builder → Chat surfaces: composes
- React app builder → Prompt composer: composes
- React app builder → Tool and agent UI: composes
- React app builder → Reasoning UI: composes
- App router → Route map: loads (evidence: `src/router.tsx`)
- Route map → Component docs routes: registers (evidence: `src/routeTree.gen.ts`)
- Route map → Component demo route: registers (evidence: `src/routeTree.gen.ts`)
- Component docs routes → Docs renderer: renders (evidence: `src/routes/_explorer.$component.index.tsx`)
- Component docs routes → Playground registry: queries (evidence: `src/routes/_explorer.$component.index.tsx`)
- Component demo route → Playground registry: queries (evidence: `src/routes/_explorer.$component.$demo.tsx`)
- Component demo route → Demo preview: renders (evidence: `src/routes/_explorer.$component.$demo.tsx`)
- Component demo route → Button primitive: uses (evidence: `src/routes/_explorer.$component.$demo.tsx`)
- Playground registry → Docs renderer: provides docs
- Build command → Registry builder: invokes (evidence: `packages/ai/src/commands/build.ts`)
- Build command → shadcn registry builder: invokes (evidence: `packages/ai/src/commands/build.ts`)
- Build command → Registry schema: validates with (evidence: `packages/ai/src/commands/build.ts`)
- Registry builder → Registry schema: uses (evidence: `packages/ai/src/lib/build-registry.ts`)
- Registry builder → Item schema: uses (evidence: `packages/ai/src/lib/build-registry.ts`)
- shadcn registry builder → Registry schema: uses (evidence: `packages/ai/src/lib/build-shadcn-registry.ts`)
- shadcn registry builder → Item schema: uses (evidence: `packages/ai/src/lib/build-shadcn-registry.ts`)
- Setup executor → Setup schema: validates with (evidence: `packages/ai/src/lib/setup-executor.ts`)
- Setup executor → Dependency installer: calls (evidence: `packages/ai/src/lib/setup-executor.ts`)
- Dependency installer → Package manager detection: uses (evidence: `packages/ai/src/lib/install-dependencies.ts`)
- Add command → React app builder: adds components
