# thebuggeddev/anatomy architecture

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

- Interactive diagram: https://gitdiagram.com/thebuggeddev/anatomy
- Repository: https://github.com/thebuggeddev/anatomy

## Overview

This repository’s main product is Anatomy Atelier, a localized interactive 3D anatomy learning experience; the README describes an underlying vinext starter rather than the application shown in the source. The user journey is locale-specific page rendering, organ exploration and learning interactions, with a 3D viewer loading models and presenting selectable hotspots. Localization and 3D rendering are the key internal layers. The README also documents optional ChatGPT sign-in and D1 support; their runtime use by the anatomy experience is not shown, so they remain separate optional capabilities.

Main entry points: [`app/[locale]/page.tsx`](https://github.com/thebuggeddev/anatomy/blob/main/app/%5Blocale%5D/page.tsx) (Locale page), [`app/components/AnatomyApp.tsx`](https://github.com/thebuggeddev/anatomy/blob/main/app/components/AnatomyApp.tsx) (Anatomy experience), [`app/i18n/dictionaries.ts`](https://github.com/thebuggeddev/anatomy/blob/main/app/i18n/dictionaries.ts) (Dictionary loader), [`app/[locale]/layout.tsx`](https://github.com/thebuggeddev/anatomy/blob/main/app/%5Blocale%5D/layout.tsx) (Locale layout)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_experience["Learning experience"]
  node_locale_page["Locale page<br/>[page.tsx]"]
  node_app_ui["Anatomy experience<br/>[AnatomyApp.tsx]"]
  node_organ_data["Anatomy content<br/>[anatomy-data.ts]"]
end

subgraph group_viewer["3D anatomy viewer"]
  node_organ_view["Organ viewer UI<br/>[OrganViewer.tsx]"]
  node_three_viewer["3D scene<br/>[viewer.ts]"]
  node_asset_loader["Model loading<br/>[loaders.ts]"]
  node_hotspot_layer["Hotspot layer<br/>[hotspots.ts]"]
  node_resource_disposal["Resource cleanup<br/>[dispose.ts]"]
end

subgraph group_localization["Localization"]
  node_locale_layout["Locale layout<br/>[layout.tsx]"]
  node_locale_config["Locale configuration<br/>[config.ts]"]
  node_dictionary_loader["Dictionary loader<br/>[dictionaries.ts]"]
  node_ui_catalogs["UI translations"]
  node_organ_catalogs["Organ translations"]
  node_content_merge["Localized content merge<br/>[merge.ts]"]
  node_font_selection["Script fonts<br/>[fonts.ts]"]
end

subgraph group_platform["Optional platform"]
  node_chatgpt_identity{{"ChatGPT identity"}}
  node_auth_helpers["Sign-in helpers<br/>[chatgpt-auth.ts]"]
  node_d1_store[("Optional D1 store<br/>[index.ts]")]
  node_schema["Database schema<br/>[schema.ts]"]
end

node_learner(("Learner"))

node_learner -->|"opens locale"| node_locale_page
node_locale_page -->|"validates locale"| node_locale_config
node_locale_page -->|"loads dictionary"| node_dictionary_loader
node_locale_page -->|"renders experience"| node_app_ui
node_locale_layout -->|"reads locale"| node_locale_config
node_locale_layout -->|"loads metadata text"| node_dictionary_loader
node_locale_layout -->|"selects fonts"| node_font_selection
node_dictionary_loader -->|"loads translations"| node_ui_catalogs
node_dictionary_loader -->|"loads organ text"| node_organ_catalogs
node_app_ui -->|"reads anatomy"| node_organ_data
node_app_ui -->|"renders viewer"| node_organ_view
node_app_ui -->|"uses localized content"| node_content_merge
node_organ_view -->|"controls scene"| node_three_viewer
node_organ_view -->|"uses hotspot types"| node_content_merge
node_three_viewer -->|"loads models"| node_asset_loader
node_three_viewer -->|"manages hotspots"| node_hotspot_layer
node_asset_loader -->|"cleans resources"| node_resource_disposal
node_chatgpt_identity -.->|"provides identity"| node_auth_helpers
node_d1_store -->|"configures ORM"| node_schema

click node_locale_page "https://github.com/thebuggeddev/anatomy/blob/main/app/%5Blocale%5D/page.tsx"
click node_app_ui "https://github.com/thebuggeddev/anatomy/blob/main/app/components/AnatomyApp.tsx"
click node_organ_data "https://github.com/thebuggeddev/anatomy/blob/main/app/lib/anatomy-data.ts"
click node_organ_view "https://github.com/thebuggeddev/anatomy/blob/main/app/components/OrganViewer.tsx"
click node_three_viewer "https://github.com/thebuggeddev/anatomy/blob/main/app/lib/three/viewer.ts"
click node_asset_loader "https://github.com/thebuggeddev/anatomy/blob/main/app/lib/three/loaders.ts"
click node_hotspot_layer "https://github.com/thebuggeddev/anatomy/blob/main/app/lib/three/hotspots.ts"
click node_resource_disposal "https://github.com/thebuggeddev/anatomy/blob/main/app/lib/three/dispose.ts"
click node_locale_layout "https://github.com/thebuggeddev/anatomy/blob/main/app/%5Blocale%5D/layout.tsx"
click node_locale_config "https://github.com/thebuggeddev/anatomy/blob/main/app/i18n/config.ts"
click node_dictionary_loader "https://github.com/thebuggeddev/anatomy/blob/main/app/i18n/dictionaries.ts"
click node_ui_catalogs "https://github.com/thebuggeddev/anatomy/tree/main/app/i18n/ui"
click node_organ_catalogs "https://github.com/thebuggeddev/anatomy/tree/main/app/i18n/organs"
click node_content_merge "https://github.com/thebuggeddev/anatomy/blob/main/app/i18n/merge.ts"
click node_font_selection "https://github.com/thebuggeddev/anatomy/blob/main/app/i18n/fonts.ts"
click node_auth_helpers "https://github.com/thebuggeddev/anatomy/blob/main/app/chatgpt-auth.ts"
click node_d1_store "https://github.com/thebuggeddev/anatomy/blob/main/db/index.ts"
click node_schema "https://github.com/thebuggeddev/anatomy/blob/main/db/schema.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_locale_page,node_app_ui,node_organ_data toneBlue
class node_organ_view,node_three_viewer,node_asset_loader,node_hotspot_layer,node_resource_disposal toneAmber
class node_locale_layout,node_locale_config,node_dictionary_loader,node_ui_catalogs,node_organ_catalogs,node_content_merge,node_font_selection toneMint
class node_chatgpt_identity,node_auth_helpers,node_d1_store,node_schema toneRose
class node_learner toneIndigo
```

## Components

### Learning experience

- [Locale page](https://github.com/thebuggeddev/anatomy/blob/main/app/%5Blocale%5D/page.tsx): `app/[locale]/page.tsx`
- [Anatomy experience](https://github.com/thebuggeddev/anatomy/blob/main/app/components/AnatomyApp.tsx): `app/components/AnatomyApp.tsx`
- [Anatomy content](https://github.com/thebuggeddev/anatomy/blob/main/app/lib/anatomy-data.ts): `app/lib/anatomy-data.ts`

### 3D anatomy viewer

- [Organ viewer UI](https://github.com/thebuggeddev/anatomy/blob/main/app/components/OrganViewer.tsx): `app/components/OrganViewer.tsx`
- [3D scene](https://github.com/thebuggeddev/anatomy/blob/main/app/lib/three/viewer.ts): `app/lib/three/viewer.ts`
- [Model loading](https://github.com/thebuggeddev/anatomy/blob/main/app/lib/three/loaders.ts): `app/lib/three/loaders.ts`
- [Hotspot layer](https://github.com/thebuggeddev/anatomy/blob/main/app/lib/three/hotspots.ts): `app/lib/three/hotspots.ts`
- [Resource cleanup](https://github.com/thebuggeddev/anatomy/blob/main/app/lib/three/dispose.ts): `app/lib/three/dispose.ts`

### Localization

- [Locale layout](https://github.com/thebuggeddev/anatomy/blob/main/app/%5Blocale%5D/layout.tsx): `app/[locale]/layout.tsx`
- [Locale configuration](https://github.com/thebuggeddev/anatomy/blob/main/app/i18n/config.ts): `app/i18n/config.ts`
- [Dictionary loader](https://github.com/thebuggeddev/anatomy/blob/main/app/i18n/dictionaries.ts): `app/i18n/dictionaries.ts`
- [UI translations](https://github.com/thebuggeddev/anatomy/tree/main/app/i18n/ui): `app/i18n/ui`
- [Organ translations](https://github.com/thebuggeddev/anatomy/tree/main/app/i18n/organs): `app/i18n/organs`
- [Localized content merge](https://github.com/thebuggeddev/anatomy/blob/main/app/i18n/merge.ts): `app/i18n/merge.ts`
- [Script fonts](https://github.com/thebuggeddev/anatomy/blob/main/app/i18n/fonts.ts): `app/i18n/fonts.ts`

### Optional platform

- **ChatGPT identity**
- [Sign-in helpers](https://github.com/thebuggeddev/anatomy/blob/main/app/chatgpt-auth.ts): `app/chatgpt-auth.ts`
- [Optional D1 store](https://github.com/thebuggeddev/anatomy/blob/main/db/index.ts): `db/index.ts`
- [Database schema](https://github.com/thebuggeddev/anatomy/blob/main/db/schema.ts): `db/schema.ts`

### Other components

- **Learner**

## Connections

- Learner → Locale page: opens locale (evidence: `app/[locale]/page.tsx`)
- Locale page → Locale configuration: validates locale (evidence: `app/[locale]/page.tsx`)
- Locale page → Dictionary loader: loads dictionary (evidence: `app/[locale]/page.tsx`)
- Locale page → Anatomy experience: renders experience (evidence: `app/[locale]/page.tsx`)
- Locale layout → Locale configuration: reads locale (evidence: `app/[locale]/layout.tsx`)
- Locale layout → Dictionary loader: loads metadata text (evidence: `app/[locale]/layout.tsx`)
- Locale layout → Script fonts: selects fonts (evidence: `app/[locale]/layout.tsx`)
- Dictionary loader → UI translations: loads translations (evidence: `app/i18n/dictionaries.ts`)
- Dictionary loader → Organ translations: loads organ text (evidence: `app/i18n/dictionaries.ts`)
- Anatomy experience → Anatomy content: reads anatomy (evidence: `app/components/AnatomyApp.tsx`)
- Anatomy experience → Organ viewer UI: renders viewer (evidence: `app/components/AnatomyApp.tsx`)
- Anatomy experience → Localized content merge: uses localized content (evidence: `app/components/AnatomyApp.tsx`)
- Organ viewer UI → 3D scene: controls scene (evidence: `app/components/OrganViewer.tsx`)
- Organ viewer UI → Localized content merge: uses hotspot types (evidence: `app/components/OrganViewer.tsx`)
- 3D scene → Model loading: loads models (evidence: `app/lib/three/viewer.ts`)
- 3D scene → Hotspot layer: manages hotspots (evidence: `app/lib/three/viewer.ts`)
- Model loading → Resource cleanup: cleans resources (evidence: `app/lib/three/loaders.ts`)
- ChatGPT identity → Sign-in helpers: provides identity (evidence: `README.md`)
- Optional D1 store → Database schema: configures ORM (evidence: `db/index.ts`)
