# juancandela2511/conocimiento_contigo architecture

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

- Interactive diagram: https://gitdiagram.com/juancandela2511/conocimiento_contigo
- Repository: https://github.com/juancandela2511/conocimiento_contigo

## Overview

#### Purpose and Runtime
This is a Vite-served React learning platform, centered on courses, interactive activities, learner progress/achievements, and administrator content management. The frontend starts at `src/main.jsx`, mounts the application in `src/App.jsx`, and is styled through `src/index.css` and page/component CSS.

#### Application Shell and Access Control
`src/App.jsx` is the primary composition and routing boundary for public, learner, and administration views. Route-loading state is isolated in `src/contexto/RouteLoadingContext.jsx`; protected application areas are gated by `src/utilidades/ProtectedRoute.jsx`. Navigation and theme controls are shared shell components in `src/components/estructura/BarraNavegacion.jsx` and `src/components/estructura/CambiadorTema.jsx`.

#### Learner Course Experience
The learner flow begins on `src/pages/HomePage.jsx`, opens a course in `src/pages/CursoDetalle.jsx`, and presents individual educational material through `src/components/ui/ContentViewerModal.jsx`. Course-facing UI is composed from hero, completion, and progress widgets such as `src/components/ui/CursoHero.jsx`, `src/components/ui/CompletedCourseCard.jsx`, and `src/components/ui/AnimatedProgressBar.jsx`.

#### Interactive Assessment and Activity Runners
Course content can invoke dedicated activity engines rather than embedding game logic in course pages. Quiz, crossword, ordering, and word-search activities are implemented in `src/components/juegos/QuizRunner.jsx`, `src/components/juegos/CrosswordRunner.jsx`, `src/components/juegos/OrdenarPasosRunner.jsx`, and `src/components/juegos/WordSearchRunner.jsx`. Their completion results are expected to feed the broader progress model.

#### Progress, Achievements, and Learner Records
Learners view aggregated and detailed progress through `src/pages/UserProgressPage.jsx` and `src/pages/ProgresoDetallePanel.jsx`, with reusable record presentation in `src/components/ui/ProgresoTable.jsx` and `src/components/ui/UserProgressCard.jsx`. Achievement presentation is separated into `src/pages/LogrosPage.jsx` and `src/components/ui/LogroItem.jsx`. Progress-specific retrieval/aggregation is centralized by `src/hooks/useAdminProgress.js`, shared by administrative reporting.

#### Administration Boundary
Administrative workflows are organized around `src/components/Admin/AdminDashboard.jsx` and specialized management pages: `src/pages/AdminUsuariosPage.jsx`, `src/pages/AdminProgresoPage.jsx`, `src/pages/AdminLogrosPage.jsx`, and `src/pages/AdminAptitudesPage.jsx`. Course/content authoring is modal-driven, including `src/components/Admin/AddContentModal.jsx`, `src/components/Admin/EditContentModal.jsx`, and activity-specific creation such as `src/components/Admin/AddCuestionarioModal.jsx` and `src/components/Admin/AddCrucigramaModal.jsx`.

#### Persistence, Offline Support, and AI Service
Supabase is the backend integration boundary via `src/services/supabaseClient.js`, with project/server configuration under `supabase/config.toml`. Browser-side offline persistence and service-worker behavior are encapsulated in `src/services/offlineDb.js` and `src/services/sw.js`. The in-app assistant UI, `src/components/ChatIA.jsx`, calls a Supabase Edge Function implemented in Deno at `supabase/functions/chat-gemini/index.ts`, which is the backend boundary for Gemini chat integration.

#### Deployment
The frontend is built by Vite (`vite.config.js`) and has Vercel deployment configuration in `vercel.json`. The application therefore spans a browser React runtime, Supabase-managed backend/auth/data capabilities, a Deno Edge Function for AI chat, and Vercel hosting.

Main entry points: [`src/App.jsx`](https://github.com/juancandela2511/conocimiento_contigo/blob/main/src/App.jsx) (App shell and routes), [`src/hooks/useAdminProgress.js`](https://github.com/juancandela2511/conocimiento_contigo/blob/main/src/hooks/useAdminProgress.js) (Progress aggregation), [`src/services/supabaseClient.js`](https://github.com/juancandela2511/conocimiento_contigo/blob/main/src/services/supabaseClient.js) (Supabase client), [`src/components/Admin/AdminDashboard.jsx`](https://github.com/juancandela2511/conocimiento_contigo/blob/main/src/components/Admin/AdminDashboard.jsx) (Admin dashboard)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_browser["React browser app"]
  node_entry["Application entry<br/>React bootstrap<br/>[main.jsx]"]
  node_app["App shell and routes<br/>routing boundary<br/>[App.jsx]"]
  node_route_loading["Route loading state<br/>React context"]
  node_protected_route["Protected routes<br/>access control<br/>[ProtectedRoute.jsx]"]
  node_navigation["Navigation and theme<br/>shell components"]
  node_home["Course home<br/>learner page<br/>[HomePage.jsx]"]
  node_course_detail["Course detail<br/>learner page<br/>[CursoDetalle.jsx]"]
  node_content_viewer["Content viewer<br/>course content UI"]
  node_activity_runners["Activity runners<br/>interactive learning engines<br/>[QuizRunner.jsx]"]
  node_learner_progress["Learner progress<br/>progress views"]
  node_progress_data["Progress aggregation<br/>shared hook"]
  node_achievements["Achievements<br/>learner page<br/>[LogrosPage.jsx]"]
  node_admin_dashboard["Admin dashboard<br/>administration boundary<br/>[AdminDashboard.jsx]"]
  node_admin_management["Admin management pages<br/>users, progress, achievements, skills"]
  node_content_authoring["Content authoring<br/>admin modal workflows"]
  node_chat_ui["AI assistant UI<br/>React component<br/>[ChatIA.jsx]"]
  node_offline[("Offline persistence<br/>[offlineDb.js]")]
  node_supabase_client["Supabase client<br/>backend integration<br/>[supabaseClient.js]"]
end

subgraph group_backend["Supabase backend"]
  node_edge_chat{{"Gemini chat function<br/>Deno Edge Function<br/>[index.ts]"}}
  node_supabase_config[("Supabase project<br/>managed backend configuration<br/>[config.toml]")]
end

node_vite{{"Vite build<br/>build tooling<br/>[vite.config.js]"}}
node_vercel{{"Vercel hosting<br/>deployment<br/>[vercel.json]"}}

node_vite -->|"builds"| node_entry
node_vite -->|"deploys to"| node_vercel
node_entry -->|"mounts"| node_app
node_app -->|"uses"| node_route_loading
node_app -->|"enforces"| node_protected_route
node_app -->|"renders shell"| node_navigation
node_app -->|"routes to"| node_home
node_app -->|"routes to"| node_course_detail
node_app -->|"routes to"| node_learner_progress
node_app -->|"routes to"| node_achievements
node_protected_route -->|"guards"| node_admin_dashboard
node_course_detail -->|"opens"| node_content_viewer
node_content_viewer -->|"launches activities"| node_activity_runners
node_activity_runners -->|"records completion"| node_progress_data
node_learner_progress -->|"reads"| node_progress_data
node_achievements -.->|"derives from"| node_progress_data
node_admin_dashboard -->|"opens"| node_admin_management
node_admin_dashboard -->|"opens"| node_content_authoring
node_admin_management -->|"uses reporting data"| node_progress_data
node_progress_data -->|"queries"| node_supabase_client
node_content_authoring -->|"persists content"| node_supabase_client
node_supabase_client -->|"connects to"| node_supabase_config
node_offline -.->|"supports offline client data"| node_supabase_client
node_chat_ui -->|"invokes"| node_edge_chat
node_edge_chat -->|"runs on"| node_supabase_config

click node_vite "https://github.com/juancandela2511/conocimiento_contigo/blob/main/vite.config.js"
click node_vercel "https://github.com/juancandela2511/conocimiento_contigo/blob/main/vercel.json"
click node_entry "https://github.com/juancandela2511/conocimiento_contigo/blob/main/src/main.jsx"
click node_app "https://github.com/juancandela2511/conocimiento_contigo/blob/main/src/App.jsx"
click node_route_loading "https://github.com/juancandela2511/conocimiento_contigo/blob/main/src/contexto/RouteLoadingContext.jsx"
click node_protected_route "https://github.com/juancandela2511/conocimiento_contigo/blob/main/src/utilidades/ProtectedRoute.jsx"
click node_navigation "https://github.com/juancandela2511/conocimiento_contigo/blob/main/src/components/estructura/BarraNavegacion.jsx"
click node_home "https://github.com/juancandela2511/conocimiento_contigo/blob/main/src/pages/HomePage.jsx"
click node_course_detail "https://github.com/juancandela2511/conocimiento_contigo/blob/main/src/pages/CursoDetalle.jsx"
click node_content_viewer "https://github.com/juancandela2511/conocimiento_contigo/blob/main/src/components/ui/ContentViewerModal.jsx"
click node_activity_runners "https://github.com/juancandela2511/conocimiento_contigo/blob/main/src/components/juegos/QuizRunner.jsx"
click node_learner_progress "https://github.com/juancandela2511/conocimiento_contigo/blob/main/src/pages/UserProgressPage.jsx"
click node_progress_data "https://github.com/juancandela2511/conocimiento_contigo/blob/main/src/hooks/useAdminProgress.js"
click node_achievements "https://github.com/juancandela2511/conocimiento_contigo/blob/main/src/pages/LogrosPage.jsx"
click node_admin_dashboard "https://github.com/juancandela2511/conocimiento_contigo/blob/main/src/components/Admin/AdminDashboard.jsx"
click node_admin_management "https://github.com/juancandela2511/conocimiento_contigo/blob/main/src/pages/AdminProgresoPage.jsx"
click node_content_authoring "https://github.com/juancandela2511/conocimiento_contigo/blob/main/src/components/Admin/AddContentModal.jsx"
click node_chat_ui "https://github.com/juancandela2511/conocimiento_contigo/blob/main/src/components/ChatIA.jsx"
click node_offline "https://github.com/juancandela2511/conocimiento_contigo/blob/main/src/services/offlineDb.js"
click node_supabase_client "https://github.com/juancandela2511/conocimiento_contigo/blob/main/src/services/supabaseClient.js"
click node_edge_chat "https://github.com/juancandela2511/conocimiento_contigo/blob/main/supabase/functions/chat-gemini/index.ts"
click node_supabase_config "https://github.com/juancandela2511/conocimiento_contigo/blob/main/supabase/config.toml"

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,node_route_loading,node_protected_route,node_navigation,node_home,node_course_detail,node_content_viewer,node_activity_runners,node_learner_progress,node_progress_data,node_achievements,node_admin_dashboard,node_admin_management,node_content_authoring,node_chat_ui,node_offline,node_supabase_client toneBlue
class node_edge_chat,node_supabase_config toneAmber
class node_vite,node_vercel toneNeutral
```

## Components

### React browser app

Vite-served learner and administration client.

- [Application entry](https://github.com/juancandela2511/conocimiento_contigo/blob/main/src/main.jsx): React bootstrap · `src/main.jsx`
- [App shell and routes](https://github.com/juancandela2511/conocimiento_contigo/blob/main/src/App.jsx): routing boundary · Composes public, learner, and admin views. · `src/App.jsx`
- [Route loading state](https://github.com/juancandela2511/conocimiento_contigo/blob/main/src/contexto/RouteLoadingContext.jsx): React context · `src/contexto/RouteLoadingContext.jsx`
- [Protected routes](https://github.com/juancandela2511/conocimiento_contigo/blob/main/src/utilidades/ProtectedRoute.jsx): access control · Gates protected application areas. · `src/utilidades/ProtectedRoute.jsx`
- [Navigation and theme](https://github.com/juancandela2511/conocimiento_contigo/blob/main/src/components/estructura/BarraNavegacion.jsx): shell components · `src/components/estructura/BarraNavegacion.jsx`
- [Course home](https://github.com/juancandela2511/conocimiento_contigo/blob/main/src/pages/HomePage.jsx): learner page · `src/pages/HomePage.jsx`
- [Course detail](https://github.com/juancandela2511/conocimiento_contigo/blob/main/src/pages/CursoDetalle.jsx): learner page · `src/pages/CursoDetalle.jsx`
- [Content viewer](https://github.com/juancandela2511/conocimiento_contigo/blob/main/src/components/ui/ContentViewerModal.jsx): course content UI · Presents individual educational material. · `src/components/ui/ContentViewerModal.jsx`
- [Activity runners](https://github.com/juancandela2511/conocimiento_contigo/blob/main/src/components/juegos/QuizRunner.jsx): interactive learning engines · Quiz, crossword, ordering, and word-search completion flows. · `src/components/juegos/QuizRunner.jsx`
- [Learner progress](https://github.com/juancandela2511/conocimiento_contigo/blob/main/src/pages/UserProgressPage.jsx): progress views · Aggregated and detailed learner records. · `src/pages/UserProgressPage.jsx`
- [Progress aggregation](https://github.com/juancandela2511/conocimiento_contigo/blob/main/src/hooks/useAdminProgress.js): shared hook · Retrieves and aggregates progress for learner and admin views. · `src/hooks/useAdminProgress.js`
- [Achievements](https://github.com/juancandela2511/conocimiento_contigo/blob/main/src/pages/LogrosPage.jsx): learner page · `src/pages/LogrosPage.jsx`
- [Admin dashboard](https://github.com/juancandela2511/conocimiento_contigo/blob/main/src/components/Admin/AdminDashboard.jsx): administration boundary · Entry point for management workflows. · `src/components/Admin/AdminDashboard.jsx`
- [Admin management pages](https://github.com/juancandela2511/conocimiento_contigo/blob/main/src/pages/AdminProgresoPage.jsx): users, progress, achievements, skills · `src/pages/AdminProgresoPage.jsx`
- [Content authoring](https://github.com/juancandela2511/conocimiento_contigo/blob/main/src/components/Admin/AddContentModal.jsx): admin modal workflows · Creates and edits content and activity definitions. · `src/components/Admin/AddContentModal.jsx`
- [AI assistant UI](https://github.com/juancandela2511/conocimiento_contigo/blob/main/src/components/ChatIA.jsx): React component · `src/components/ChatIA.jsx`
- [Offline persistence](https://github.com/juancandela2511/conocimiento_contigo/blob/main/src/services/offlineDb.js): browser storage and service worker · `src/services/offlineDb.js`
- [Supabase client](https://github.com/juancandela2511/conocimiento_contigo/blob/main/src/services/supabaseClient.js): backend integration · Client boundary for managed auth and data. · `src/services/supabaseClient.js`

### Supabase backend

Managed data/auth plus Deno AI function.

- [Gemini chat function](https://github.com/juancandela2511/conocimiento_contigo/blob/main/supabase/functions/chat-gemini/index.ts): Deno Edge Function · Backend boundary for AI chat integration. · `supabase/functions/chat-gemini/index.ts`
- [Supabase project](https://github.com/juancandela2511/conocimiento_contigo/blob/main/supabase/config.toml): managed backend configuration · `supabase/config.toml`

### Other components

- [Vite build](https://github.com/juancandela2511/conocimiento_contigo/blob/main/vite.config.js): build tooling · `vite.config.js`
- [Vercel hosting](https://github.com/juancandela2511/conocimiento_contigo/blob/main/vercel.json): deployment · `vercel.json`

## Connections

- Vite build → Application entry: builds
- Vite build → Vercel hosting: deploys to
- Application entry → App shell and routes: mounts
- App shell and routes → Route loading state: uses
- App shell and routes → Protected routes: enforces
- App shell and routes → Navigation and theme: renders shell
- App shell and routes → Course home: routes to
- App shell and routes → Course detail: routes to
- App shell and routes → Learner progress: routes to
- App shell and routes → Achievements: routes to
- Protected routes → Admin dashboard: guards
- Course detail → Content viewer: opens
- Content viewer → Activity runners: launches activities
- Activity runners → Progress aggregation: records completion
- Learner progress → Progress aggregation: reads
- Achievements → Progress aggregation: derives from
- Admin dashboard → Admin management pages: opens
- Admin dashboard → Content authoring: opens
- Admin management pages → Progress aggregation: uses reporting data
- Progress aggregation → Supabase client: queries
- Content authoring → Supabase client: persists content
- Supabase client → Supabase project: connects to
- Offline persistence → Supabase client: supports offline client data
- AI assistant UI → Gemini chat function: invokes
- Gemini chat function → Supabase project: runs on
