# apolo2426/epopeya architecture

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

- Interactive diagram: https://gitdiagram.com/apolo2426/epopeya
- Repository: https://github.com/apolo2426/epopeya

## Overview

This is a React-based, Spanish-language historical exploration game: users authenticate, choose an era, play its chapter, make decisions, answer trivia, and can earn collectible rewards. The graph preserves the principal journey and the distinct authentication, era selection, chapter-play, and collectible areas. Relationship evidence is limited to the README and the supplied source excerpts and index; unsampled implementation details are not inferred.

Main entry points: [`src/App.tsx`](https://github.com/apolo2426/epopeya/blob/main/src/App.tsx) (App Shell), [`src/modules/capitulo/capitulo.tsx`](https://github.com/apolo2426/epopeya/blob/main/src/modules/capitulo/capitulo.tsx) (Chapter Screen), [`src/modules/auth/context/AuthProvider.tsx`](https://github.com/apolo2426/epopeya/blob/main/src/modules/auth/context/AuthProvider.tsx) (Auth Provider), [`src/modules/eras/eras.tsx`](https://github.com/apolo2426/epopeya/blob/main/src/modules/eras/eras.tsx) (Era Screen)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_app["Application"]
  node_entry["React Entry<br/>[main.tsx]"]
  node_app_shell["App Shell<br/>[App.tsx]"]
end

subgraph group_auth["Authentication"]
  node_auth_provider["Auth Provider<br/>[AuthProvider.tsx]"]
  node_auth_context["Auth Context<br/>[AuthContext.ts]"]
  node_auth_hook["Auth State Hook<br/>[useAuth.ts]"]
  node_auth_screen["Auth Screen<br/>[auth.tsx]"]
  node_email_form["Email Auth Form<br/>[EmailAuthForm.tsx]"]
  node_email_logic["Email Form Logic"]
  node_auth_services["Auth Services"]
end

subgraph group_eras["Era Selection"]
  node_era_screen["Era Screen<br/>[eras.tsx]"]
  node_era_data["Era Data Hook<br/>[useEras.ts]"]
  node_era_catalog["Era Catalog<br/>[erasCatalog.ts]"]
end

subgraph group_chapter["Chapter Gameplay"]
  node_chapter_screen["Chapter Screen<br/>[capitulo.tsx]"]
  node_chapter_session["Chapter Session"]
  node_scene_player["Scene Player<br/>[ScenePlayer.tsx]"]
  node_chapter_hooks["Chapter Hooks"]
  node_chapter_services["Chapter Services"]
  node_trivia_session["Trivia Session"]
  node_trivia_screen["Trivia Screen<br/>[TriviaScreen.tsx]"]
  node_answer_service["Answer Service"]
end

subgraph group_shared["Shared Experience"]
  node_supabase_client["Supabase Client<br/>[supabase.ts]"]
  node_collectible_viewer["Collectible Viewer"]
  node_model_registry["Model Registry<br/>[modelRegistry.ts]"]
  node_model["Bell Model"]
  node_auth_loader["Auth Loader<br/>[AuthLoader.tsx]"]
end

node_user(("Player"))
node_supabase[("Supabase")]

node_entry -->|"renders"| node_app_shell
node_entry -->|"wraps"| node_auth_provider
node_auth_provider -->|"provides"| node_auth_context
node_auth_provider -->|"uses session hook"| node_auth_hook
node_app_shell -->|"checks auth"| node_auth_hook
node_app_shell -->|"shows signed-out"| node_auth_screen
node_app_shell -->|"shows loading"| node_auth_loader
node_app_shell -->|"shows eras"| node_era_screen
node_app_shell -->|"opens chapter"| node_chapter_screen
node_auth_screen -->|"renders"| node_email_form
node_email_form -->|"uses form logic"| node_email_logic
node_email_logic -->|"submits credentials"| node_auth_services
node_auth_services -->|"calls auth API"| node_supabase_client
node_supabase_client -->|"connects"| node_supabase
node_era_screen -.->|"loads eras"| node_era_data
node_era_data -->|"reads catalog"| node_era_catalog
node_era_screen -.->|"selects era"| node_chapter_screen
node_chapter_screen -->|"uses session"| node_chapter_session
node_chapter_session -->|"loads chapter data"| node_chapter_hooks
node_chapter_screen -->|"renders playback"| node_scene_player
node_chapter_session -.->|"starts chapter"| node_chapter_services
node_chapter_screen -->|"renders trivia"| node_trivia_screen
node_trivia_screen -.->|"uses session"| node_trivia_session
node_trivia_session -->|"submits answers"| node_answer_service
node_answer_service -->|"calls database"| node_supabase_client
node_collectible_viewer -->|"selects model"| node_model_registry
node_model_registry -->|"registers model"| node_model
node_user -.->|"opens app"| node_entry

click node_entry "https://github.com/apolo2426/epopeya/blob/main/src/main.tsx"
click node_app_shell "https://github.com/apolo2426/epopeya/blob/main/src/App.tsx"
click node_auth_provider "https://github.com/apolo2426/epopeya/blob/main/src/modules/auth/context/AuthProvider.tsx"
click node_auth_context "https://github.com/apolo2426/epopeya/blob/main/src/modules/auth/context/AuthContext.ts"
click node_auth_hook "https://github.com/apolo2426/epopeya/blob/main/src/modules/auth/hooks/useAuth.ts"
click node_auth_screen "https://github.com/apolo2426/epopeya/blob/main/src/modules/auth/auth.tsx"
click node_email_form "https://github.com/apolo2426/epopeya/blob/main/src/modules/auth/_components/EmailAuthForm.tsx"
click node_email_logic "https://github.com/apolo2426/epopeya/blob/main/src/modules/auth/hooks/useEmailAuthForm.ts"
click node_auth_services "https://github.com/apolo2426/epopeya/tree/main/src/modules/auth/services"
click node_supabase_client "https://github.com/apolo2426/epopeya/blob/main/src/lib/supabase.ts"
click node_era_screen "https://github.com/apolo2426/epopeya/blob/main/src/modules/eras/eras.tsx"
click node_era_data "https://github.com/apolo2426/epopeya/blob/main/src/modules/eras/hooks/useEras.ts"
click node_era_catalog "https://github.com/apolo2426/epopeya/blob/main/src/modules/eras/utils/erasCatalog.ts"
click node_chapter_screen "https://github.com/apolo2426/epopeya/blob/main/src/modules/capitulo/capitulo.tsx"
click node_chapter_session "https://github.com/apolo2426/epopeya/blob/main/src/modules/capitulo/hooks/useChapterSession.ts"
click node_scene_player "https://github.com/apolo2426/epopeya/blob/main/src/modules/capitulo/_components/ScenePlayer.tsx"
click node_chapter_hooks "https://github.com/apolo2426/epopeya/tree/main/src/modules/capitulo/hooks"
click node_chapter_services "https://github.com/apolo2426/epopeya/tree/main/src/modules/capitulo/services"
click node_trivia_session "https://github.com/apolo2426/epopeya/blob/main/src/modules/capitulo/hooks/useTriviaSession.ts"
click node_trivia_screen "https://github.com/apolo2426/epopeya/blob/main/src/modules/capitulo/_components/trivia/TriviaScreen.tsx"
click node_answer_service "https://github.com/apolo2426/epopeya/blob/main/src/modules/capitulo/services/service_capitulo_completarTest.ts"
click node_collectible_viewer "https://github.com/apolo2426/epopeya/blob/main/src/components/shared/three/CollectibleViewer.tsx"
click node_model_registry "https://github.com/apolo2426/epopeya/blob/main/src/components/shared/three/modelRegistry.ts"
click node_model "https://github.com/apolo2426/epopeya/blob/main/src/components/shared/three/models/CampanaLibertad.tsx"
click node_auth_loader "https://github.com/apolo2426/epopeya/blob/main/src/components/shared/AuthLoader.tsx"

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_entry,node_app_shell toneBlue
class node_auth_provider,node_auth_context,node_auth_hook,node_auth_screen,node_email_form,node_email_logic,node_auth_services,node_supabase toneAmber
class node_era_screen,node_era_data,node_era_catalog toneMint
class node_chapter_screen,node_chapter_session,node_scene_player,node_chapter_hooks,node_chapter_services,node_trivia_session,node_trivia_screen,node_answer_service toneRose
class node_supabase_client,node_collectible_viewer,node_model_registry,node_model,node_auth_loader,node_user toneIndigo
```

## Components

### Application

- [React Entry](https://github.com/apolo2426/epopeya/blob/main/src/main.tsx): `src/main.tsx`
- [App Shell](https://github.com/apolo2426/epopeya/blob/main/src/App.tsx): `src/App.tsx`

### Authentication

- [Auth Provider](https://github.com/apolo2426/epopeya/blob/main/src/modules/auth/context/AuthProvider.tsx): `src/modules/auth/context/AuthProvider.tsx`
- [Auth Context](https://github.com/apolo2426/epopeya/blob/main/src/modules/auth/context/AuthContext.ts): `src/modules/auth/context/AuthContext.ts`
- [Auth State Hook](https://github.com/apolo2426/epopeya/blob/main/src/modules/auth/hooks/useAuth.ts): `src/modules/auth/hooks/useAuth.ts`
- [Auth Screen](https://github.com/apolo2426/epopeya/blob/main/src/modules/auth/auth.tsx): `src/modules/auth/auth.tsx`
- [Email Auth Form](https://github.com/apolo2426/epopeya/blob/main/src/modules/auth/_components/EmailAuthForm.tsx): `src/modules/auth/_components/EmailAuthForm.tsx`
- [Email Form Logic](https://github.com/apolo2426/epopeya/blob/main/src/modules/auth/hooks/useEmailAuthForm.ts): `src/modules/auth/hooks/useEmailAuthForm.ts`
- [Auth Services](https://github.com/apolo2426/epopeya/tree/main/src/modules/auth/services): `src/modules/auth/services`

### Era Selection

- [Era Screen](https://github.com/apolo2426/epopeya/blob/main/src/modules/eras/eras.tsx): `src/modules/eras/eras.tsx`
- [Era Data Hook](https://github.com/apolo2426/epopeya/blob/main/src/modules/eras/hooks/useEras.ts): `src/modules/eras/hooks/useEras.ts`
- [Era Catalog](https://github.com/apolo2426/epopeya/blob/main/src/modules/eras/utils/erasCatalog.ts): `src/modules/eras/utils/erasCatalog.ts`

### Chapter Gameplay

- [Chapter Screen](https://github.com/apolo2426/epopeya/blob/main/src/modules/capitulo/capitulo.tsx): `src/modules/capitulo/capitulo.tsx`
- [Chapter Session](https://github.com/apolo2426/epopeya/blob/main/src/modules/capitulo/hooks/useChapterSession.ts): `src/modules/capitulo/hooks/useChapterSession.ts`
- [Scene Player](https://github.com/apolo2426/epopeya/blob/main/src/modules/capitulo/_components/ScenePlayer.tsx): `src/modules/capitulo/_components/ScenePlayer.tsx`
- [Chapter Hooks](https://github.com/apolo2426/epopeya/tree/main/src/modules/capitulo/hooks): `src/modules/capitulo/hooks`
- [Chapter Services](https://github.com/apolo2426/epopeya/tree/main/src/modules/capitulo/services): `src/modules/capitulo/services`
- [Trivia Session](https://github.com/apolo2426/epopeya/blob/main/src/modules/capitulo/hooks/useTriviaSession.ts): `src/modules/capitulo/hooks/useTriviaSession.ts`
- [Trivia Screen](https://github.com/apolo2426/epopeya/blob/main/src/modules/capitulo/_components/trivia/TriviaScreen.tsx): `src/modules/capitulo/_components/trivia/TriviaScreen.tsx`
- [Answer Service](https://github.com/apolo2426/epopeya/blob/main/src/modules/capitulo/services/service_capitulo_completarTest.ts): `src/modules/capitulo/services/service_capitulo_completarTest.ts`

### Shared Experience

- [Supabase Client](https://github.com/apolo2426/epopeya/blob/main/src/lib/supabase.ts): `src/lib/supabase.ts`
- [Collectible Viewer](https://github.com/apolo2426/epopeya/blob/main/src/components/shared/three/CollectibleViewer.tsx): `src/components/shared/three/CollectibleViewer.tsx`
- [Model Registry](https://github.com/apolo2426/epopeya/blob/main/src/components/shared/three/modelRegistry.ts): `src/components/shared/three/modelRegistry.ts`
- [Bell Model](https://github.com/apolo2426/epopeya/blob/main/src/components/shared/three/models/CampanaLibertad.tsx): `src/components/shared/three/models/CampanaLibertad.tsx`
- [Auth Loader](https://github.com/apolo2426/epopeya/blob/main/src/components/shared/AuthLoader.tsx): `src/components/shared/AuthLoader.tsx`

### Other components

- **Player**
- **Supabase**

## Connections

- React Entry → App Shell: renders (evidence: `src/main.tsx`)
- React Entry → Auth Provider: wraps (evidence: `src/main.tsx`)
- Auth Provider → Auth Context: provides (evidence: `src/modules/auth/context/AuthProvider.tsx`)
- Auth Provider → Auth State Hook: uses session hook (evidence: `src/modules/auth/context/AuthProvider.tsx`)
- App Shell → Auth State Hook: checks auth (evidence: `src/App.tsx`)
- App Shell → Auth Screen: shows signed-out (evidence: `src/App.tsx`)
- App Shell → Auth Loader: shows loading (evidence: `src/App.tsx`)
- App Shell → Era Screen: shows eras (evidence: `src/App.tsx`)
- App Shell → Chapter Screen: opens chapter (evidence: `src/App.tsx`)
- Auth Screen → Email Auth Form: renders (evidence: `src/modules/auth/auth.tsx`)
- Email Auth Form → Email Form Logic: uses form logic
- Email Form Logic → Auth Services: submits credentials (evidence: `src/modules/auth/hooks/useEmailAuthForm.ts`)
- Auth Services → Supabase Client: calls auth API (evidence: `src/modules/auth/services/service_auth_signUpWithEmail.ts`)
- Supabase Client → Supabase: connects (evidence: `src/lib/supabase.ts`)
- Era Screen → Era Data Hook: loads eras
- Era Data Hook → Era Catalog: reads catalog (evidence: `src/modules/eras/hooks/useEras.ts`)
- Era Screen → Chapter Screen: selects era (evidence: `src/App.tsx`)
- Chapter Screen → Chapter Session: uses session (evidence: `src/modules/capitulo/capitulo.tsx`)
- Chapter Session → Chapter Hooks: loads chapter data (evidence: `src/modules/capitulo/hooks/useChapterSession.ts`)
- Chapter Screen → Scene Player: renders playback (evidence: `src/modules/capitulo/capitulo.tsx`)
- Chapter Session → Chapter Services: starts chapter
- Chapter Screen → Trivia Screen: renders trivia (evidence: `src/modules/capitulo/capitulo.tsx`)
- Trivia Screen → Trivia Session: uses session
- Trivia Session → Answer Service: submits answers (evidence: `src/modules/capitulo/hooks/useTriviaSession.ts`)
- Answer Service → Supabase Client: calls database (evidence: `src/modules/capitulo/services/service_capitulo_completarTest.ts`)
- Collectible Viewer → Model Registry: selects model (evidence: `src/components/shared/three/CollectibleViewer.tsx`)
- Model Registry → Bell Model: registers model (evidence: `src/components/shared/three/modelRegistry.ts`)
- Player → React Entry: opens app
