# pirouzmehmandoost/para architecture

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

- Interactive diagram: https://gitdiagram.com/pirouzmehmandoost/para
- Repository: https://github.com/pirouzmehmandoost/para

## Overview

PARA is a Next.js showcase for interactive 3D-printed product models. Visitors explore a persistent Three.js carousel, focus a model, then open a project view for specifications, material selection, and rotation controls. Project metadata is fetched from the database and supplied to the scene and project pages. The graph preserves the documented carousel, terrain, texture, and model-interaction capabilities; some store and API wiring is not shown in the excerpts, so uncertain links are omitted.

Main entry points: [`src/app/components/ui/modals/ProjectDataModal.tsx`](https://github.com/pirouzmehmandoost/para/blob/main/src/app/components/ui/modals/ProjectDataModal.tsx) (Project controls and details), [`src/db/projects.ts`](https://github.com/pirouzmehmandoost/para/blob/main/src/db/projects.ts) (Project queries and mapping), [`src/app/components/three/scenes/SceneComposer.tsx`](https://github.com/pirouzmehmandoost/para/blob/main/src/app/components/three/scenes/SceneComposer.tsx) (Scene composition), [`src/app/layout.tsx`](https://github.com/pirouzmehmandoost/para/blob/main/src/app/layout.tsx) (App layout)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_app["App shell and routes"]
  node_layout["App layout<br/>[layout.tsx]"]
  node_project_page["Project page<br/>[page.tsx]"]
  node_modal_route["Intercepted project route<br/>[page.tsx]"]
  node_api_projects["Project API routes"]
end

subgraph group_scene["3D scene and navigation"]
  node_canvas["Persistent canvas<br/>[RootCanvas.tsx]"]
  node_scene_composer["Scene composition<br/>[SceneComposer.tsx]"]
  node_carousel["Camera carousel<br/>[Carousel.tsx]"]
  node_target_registry["Target registry<br/>[TargetRegistry.ts]"]
  node_project_mesh["Project models<br/>[ProjectMesh.tsx]"]
  node_terrain["Terrain grid<br/>[TerrainGrid.tsx]"]
  node_texture_init["Texture initialization"]
end

subgraph group_interaction["Project interaction"]
  node_selection_modal["Selection display"]
  node_project_modal["Project controls and details"]
  node_sidebar["Sidebar navigation<br/>[Sidebar.tsx]"]
  node_action_button["Action buttons<br/>[ActionButton.tsx]"]
  node_auto_rotate["Auto-rotation control"]
  node_manual_rotate["Manual rotation controls"]
  node_material_store["Material state<br/>[materialStore.ts]"]
  node_selection_store["Selection state<br/>[selectionStore.ts]"]
  node_project_store["Project state<br/>[projectStore.ts]"]
end

subgraph group_data["Project data"]
  node_project_queries["Project queries and mapping<br/>[projects.ts]"]
  node_database[("Neon database<br/>[db.ts]")]
  node_schema["Project schema<br/>[schema.ts]"]
  node_project_types["Project data types<br/>[project.ts]"]
  node_material_types["Material types<br/>[material.ts]"]
  node_transform_types["Transform types<br/>[Transform3.ts]"]
end

node_visitor(("Visitor"))

node_visitor -->|"opens app"| node_layout
node_layout -->|"loads projects"| node_project_queries
node_layout -->|"mounts canvas"| node_canvas
node_layout -->|"renders navigation"| node_sidebar
node_canvas -->|"renders scene"| node_scene_composer
node_canvas -->|"initializes textures"| node_texture_init
node_scene_composer -->|"mounts models"| node_project_mesh
node_scene_composer -->|"mounts terrain"| node_terrain
node_scene_composer -->|"mounts camera rig"| node_carousel
node_carousel -->|"tracks targets"| node_target_registry
node_project_mesh -->|"reads materials"| node_material_store
node_terrain -->|"reads materials"| node_material_store
node_texture_init -->|"sets textures"| node_material_store
node_scene_composer -->|"updates selection"| node_selection_store
node_visitor -->|"opens project"| node_project_page
node_visitor -->|"opens project modal"| node_modal_route
node_project_page -->|"loads by slug"| node_project_queries
node_modal_route -->|"loads by slug"| node_project_queries
node_project_page -->|"renders project view"| node_project_modal
node_modal_route -->|"renders project view"| node_project_modal
node_project_modal -->|"reads materials"| node_material_store
node_project_modal -->|"reads and updates selection"| node_selection_store
node_project_modal -->|"renders actions"| node_action_button
node_project_modal -->|"renders control"| node_auto_rotate
node_project_modal -->|"renders controls"| node_manual_rotate
node_project_queries -->|"queries records"| node_database
node_project_queries -->|"queries table"| node_schema
node_project_queries -->|"maps to type"| node_project_types
node_api_projects -.-> node_project_queries

click node_layout "https://github.com/pirouzmehmandoost/para/blob/main/src/app/layout.tsx"
click node_project_page "https://github.com/pirouzmehmandoost/para/blob/main/src/app/projects/%5Bslug%5D/page.tsx"
click node_modal_route "https://github.com/pirouzmehmandoost/para/blob/main/src/app/%40modal/(.)projects/%5Bslug%5D/page.tsx"
click node_api_projects "https://github.com/pirouzmehmandoost/para/tree/main/src/app/api/projects"
click node_canvas "https://github.com/pirouzmehmandoost/para/blob/main/src/app/components/three/canvas/RootCanvas.tsx"
click node_scene_composer "https://github.com/pirouzmehmandoost/para/blob/main/src/app/components/three/scenes/SceneComposer.tsx"
click node_carousel "https://github.com/pirouzmehmandoost/para/blob/main/src/app/components/three/rigs/Carousel.tsx"
click node_target_registry "https://github.com/pirouzmehmandoost/para/blob/main/src/lib/targetRegistry/TargetRegistry.ts"
click node_project_mesh "https://github.com/pirouzmehmandoost/para/blob/main/src/app/components/three/meshes/ProjectMesh.tsx"
click node_terrain "https://github.com/pirouzmehmandoost/para/blob/main/src/app/components/three/instancedMeshes/TerrainGrid.tsx"
click node_texture_init "https://github.com/pirouzmehmandoost/para/blob/main/src/app/components/three/textures/TextureInitializer.ts"
click node_selection_modal "https://github.com/pirouzmehmandoost/para/blob/main/src/app/components/ui/modals/SelectionDisplayModal.tsx"
click node_project_modal "https://github.com/pirouzmehmandoost/para/blob/main/src/app/components/ui/modals/ProjectDataModal.tsx"
click node_sidebar "https://github.com/pirouzmehmandoost/para/blob/main/src/app/components/ui/Sidebar.tsx"
click node_action_button "https://github.com/pirouzmehmandoost/para/blob/main/src/app/components/ui/buttons/ActionButton.tsx"
click node_auto_rotate "https://github.com/pirouzmehmandoost/para/blob/main/src/app/components/ui/buttons/AutoRotateButton.tsx"
click node_manual_rotate "https://github.com/pirouzmehmandoost/para/blob/main/src/app/components/ui/buttons/ManualRotateButtonGroup.tsx"
click node_material_store "https://github.com/pirouzmehmandoost/para/blob/main/src/app/stores/materialStore.ts"
click node_selection_store "https://github.com/pirouzmehmandoost/para/blob/main/src/app/stores/selectionStore.ts"
click node_project_store "https://github.com/pirouzmehmandoost/para/blob/main/src/app/stores/projectStore.ts"
click node_project_queries "https://github.com/pirouzmehmandoost/para/blob/main/src/db/projects.ts"
click node_database "https://github.com/pirouzmehmandoost/para/blob/main/src/db/db.ts"
click node_schema "https://github.com/pirouzmehmandoost/para/blob/main/src/db/schema.ts"
click node_project_types "https://github.com/pirouzmehmandoost/para/blob/main/src/types/project.ts"
click node_material_types "https://github.com/pirouzmehmandoost/para/blob/main/src/types/material.ts"
click node_transform_types "https://github.com/pirouzmehmandoost/para/blob/main/src/types/Transform3.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_layout,node_project_page,node_modal_route,node_api_projects toneBlue
class node_canvas,node_scene_composer,node_carousel,node_target_registry,node_project_mesh,node_terrain,node_texture_init toneAmber
class node_selection_modal,node_project_modal,node_sidebar,node_action_button,node_auto_rotate,node_manual_rotate,node_material_store,node_selection_store,node_project_store toneMint
class node_project_queries,node_database,node_schema,node_project_types,node_material_types,node_transform_types toneRose
class node_visitor toneIndigo
```

## Components

### App shell and routes

- [App layout](https://github.com/pirouzmehmandoost/para/blob/main/src/app/layout.tsx): `src/app/layout.tsx`
- [Project page](https://github.com/pirouzmehmandoost/para/blob/main/src/app/projects/%5Bslug%5D/page.tsx): `src/app/projects/[slug]/page.tsx`
- [Intercepted project route](https://github.com/pirouzmehmandoost/para/blob/main/src/app/%40modal/(.)projects/%5Bslug%5D/page.tsx): `src/app/@modal/(.)projects/[slug]/page.tsx`
- [Project API routes](https://github.com/pirouzmehmandoost/para/tree/main/src/app/api/projects): `src/app/api/projects`

### 3D scene and navigation

- [Persistent canvas](https://github.com/pirouzmehmandoost/para/blob/main/src/app/components/three/canvas/RootCanvas.tsx): `src/app/components/three/canvas/RootCanvas.tsx`
- [Scene composition](https://github.com/pirouzmehmandoost/para/blob/main/src/app/components/three/scenes/SceneComposer.tsx): `src/app/components/three/scenes/SceneComposer.tsx`
- [Camera carousel](https://github.com/pirouzmehmandoost/para/blob/main/src/app/components/three/rigs/Carousel.tsx): `src/app/components/three/rigs/Carousel.tsx`
- [Target registry](https://github.com/pirouzmehmandoost/para/blob/main/src/lib/targetRegistry/TargetRegistry.ts): `src/lib/targetRegistry/TargetRegistry.ts`
- [Project models](https://github.com/pirouzmehmandoost/para/blob/main/src/app/components/three/meshes/ProjectMesh.tsx): `src/app/components/three/meshes/ProjectMesh.tsx`
- [Terrain grid](https://github.com/pirouzmehmandoost/para/blob/main/src/app/components/three/instancedMeshes/TerrainGrid.tsx): `src/app/components/three/instancedMeshes/TerrainGrid.tsx`
- [Texture initialization](https://github.com/pirouzmehmandoost/para/blob/main/src/app/components/three/textures/TextureInitializer.ts): `src/app/components/three/textures/TextureInitializer.ts`

### Project interaction

- [Selection display](https://github.com/pirouzmehmandoost/para/blob/main/src/app/components/ui/modals/SelectionDisplayModal.tsx): `src/app/components/ui/modals/SelectionDisplayModal.tsx`
- [Project controls and details](https://github.com/pirouzmehmandoost/para/blob/main/src/app/components/ui/modals/ProjectDataModal.tsx): `src/app/components/ui/modals/ProjectDataModal.tsx`
- [Sidebar navigation](https://github.com/pirouzmehmandoost/para/blob/main/src/app/components/ui/Sidebar.tsx): `src/app/components/ui/Sidebar.tsx`
- [Action buttons](https://github.com/pirouzmehmandoost/para/blob/main/src/app/components/ui/buttons/ActionButton.tsx): `src/app/components/ui/buttons/ActionButton.tsx`
- [Auto-rotation control](https://github.com/pirouzmehmandoost/para/blob/main/src/app/components/ui/buttons/AutoRotateButton.tsx): `src/app/components/ui/buttons/AutoRotateButton.tsx`
- [Manual rotation controls](https://github.com/pirouzmehmandoost/para/blob/main/src/app/components/ui/buttons/ManualRotateButtonGroup.tsx): `src/app/components/ui/buttons/ManualRotateButtonGroup.tsx`
- [Material state](https://github.com/pirouzmehmandoost/para/blob/main/src/app/stores/materialStore.ts): `src/app/stores/materialStore.ts`
- [Selection state](https://github.com/pirouzmehmandoost/para/blob/main/src/app/stores/selectionStore.ts): `src/app/stores/selectionStore.ts`
- [Project state](https://github.com/pirouzmehmandoost/para/blob/main/src/app/stores/projectStore.ts): `src/app/stores/projectStore.ts`

### Project data

- [Project queries and mapping](https://github.com/pirouzmehmandoost/para/blob/main/src/db/projects.ts): `src/db/projects.ts`
- [Neon database](https://github.com/pirouzmehmandoost/para/blob/main/src/db/db.ts): `src/db/db.ts`
- [Project schema](https://github.com/pirouzmehmandoost/para/blob/main/src/db/schema.ts): `src/db/schema.ts`
- [Project data types](https://github.com/pirouzmehmandoost/para/blob/main/src/types/project.ts): `src/types/project.ts`
- [Material types](https://github.com/pirouzmehmandoost/para/blob/main/src/types/material.ts): `src/types/material.ts`
- [Transform types](https://github.com/pirouzmehmandoost/para/blob/main/src/types/Transform3.ts): `src/types/Transform3.ts`

### Other components

- **Visitor**

## Connections

- Visitor → App layout: opens app (evidence: `src/app/layout.tsx`)
- App layout → Project queries and mapping: loads projects (evidence: `src/app/layout.tsx`)
- App layout → Persistent canvas: mounts canvas (evidence: `src/app/layout.tsx`)
- App layout → Sidebar navigation: renders navigation (evidence: `src/app/layout.tsx`)
- Persistent canvas → Scene composition: renders scene (evidence: `src/app/components/three/canvas/RootCanvas.tsx`)
- Persistent canvas → Texture initialization: initializes textures (evidence: `src/app/components/three/canvas/RootCanvas.tsx`)
- Scene composition → Project models: mounts models (evidence: `src/app/components/three/scenes/SceneComposer.tsx`)
- Scene composition → Terrain grid: mounts terrain (evidence: `src/app/components/three/scenes/SceneComposer.tsx`)
- Scene composition → Camera carousel: mounts camera rig (evidence: `src/app/components/three/scenes/SceneComposer.tsx`)
- Camera carousel → Target registry: tracks targets (evidence: `README.md`)
- Project models → Material state: reads materials (evidence: `src/app/components/three/meshes/ProjectMesh.tsx`)
- Terrain grid → Material state: reads materials (evidence: `src/app/components/three/instancedMeshes/TerrainGrid.tsx`)
- Texture initialization → Material state: sets textures (evidence: `src/app/components/three/textures/TextureInitializer.ts`)
- Scene composition → Selection state: updates selection (evidence: `README.md`)
- Visitor → Project page: opens project (evidence: `src/app/projects/[slug]/page.tsx`)
- Visitor → Intercepted project route: opens project modal (evidence: `src/app/@modal/(.)projects/[slug]/page.tsx`)
- Project page → Project queries and mapping: loads by slug (evidence: `src/app/projects/[slug]/page.tsx`)
- Intercepted project route → Project queries and mapping: loads by slug (evidence: `src/app/@modal/(.)projects/[slug]/page.tsx`)
- Project page → Project controls and details: renders project view (evidence: `src/app/projects/[slug]/page.tsx`)
- Intercepted project route → Project controls and details: renders project view (evidence: `src/app/@modal/(.)projects/[slug]/page.tsx`)
- Project controls and details → Material state: reads materials (evidence: `src/app/components/ui/modals/ProjectDataModal.tsx`)
- Project controls and details → Selection state: reads and updates selection (evidence: `src/app/components/ui/modals/ProjectDataModal.tsx`)
- Project controls and details → Action buttons: renders actions (evidence: `src/app/components/ui/modals/ProjectDataModal.tsx`)
- Project controls and details → Auto-rotation control: renders control (evidence: `src/app/components/ui/modals/ProjectDataModal.tsx`)
- Project controls and details → Manual rotation controls: renders controls (evidence: `src/app/components/ui/modals/ProjectDataModal.tsx`)
- Project queries and mapping → Neon database: queries records (evidence: `src/db/projects.ts`)
- Project queries and mapping → Project schema: queries table (evidence: `src/db/projects.ts`)
- Project queries and mapping → Project data types: maps to type (evidence: `src/db/projects.ts`)
- Project API routes → Project queries and mapping
