# aguscax/preguntados architecture

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

- Interactive diagram: https://gitdiagram.com/aguscax/preguntados
- Repository: https://github.com/aguscax/preguntados

## Overview

Cerebrito is a PHP MVC web app for quiz games and community question management. A player enters through the front controller and router, authenticates or registers, plays timed question rounds, and can view rankings and share a public profile. Editors moderate suggested and reported questions; administrators inspect statistics and manage user roles. The graph reflects documented MVC wiring and sampled controller calls; unsampled feature details are represented at the module level, so their internal links are limited to documented relationships.

Main entry points: [`helper/MyDatabase.php`](https://github.com/aguscax/preguntados/blob/main/helper/MyDatabase.php) (MySQL database), [`app/Configuration.php`](https://github.com/aguscax/preguntados/blob/main/app/Configuration.php) (Dependency configuration), [`app/controller/RegistroController.php`](https://github.com/aguscax/preguntados/blob/main/app/controller/RegistroController.php) (Account registration), [`index.php`](https://github.com/aguscax/preguntados/blob/main/index.php) (Front controller)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_entry["Request and MVC"]
  node_front["Front controller<br/>[index.php]"]
  node_router["Route dispatcher<br/>[Router.php]"]
  node_configuration["Dependency configuration<br/>[Configuration.php]"]
  node_request["Request input<br/>[Request.php]"]
  node_render["Mustache rendering<br/>[MustacheRender.php]"]
  node_database[("MySQL database<br/>[MyDatabase.php]")]
  node_schema["Quiz schema<br/>[preguntados.sql]"]
end

subgraph group_account["Accounts and profiles"]
  node_login["Login"]
  node_login_model["Authentication data<br/>[LoginModel.php]"]
  node_registration["Account registration"]
  node_registration_model["Registration data<br/>[RegistroModel.php]"]
  node_mailer["Activation email<br/>[Mailer.php]"]
  node_profile["Profile and QR"]
  node_profile_model["Profile data<br/>[PerfilModel.php]"]
end

subgraph group_game["Quiz gameplay"]
  node_question_game["Timed quiz and proposals"]
  node_question_model["Questions and reports<br/>[PreguntaModel.php]"]
  node_ranking["Ranking"]
  node_ranking_model["Ranking data<br/>[RankingModel.php]"]
end

subgraph group_governance["Moderation and administration"]
  node_editor["Question moderation"]
  node_editor_model["Moderation data<br/>[EditorModel.php]"]
  node_administrator["Admin dashboard and roles"]
  node_administrator_model["Admin statistics and users"]
  node_chart["PNG chart renderer<br/>[CpChartLib.php]"]
end

node_visitor(("Web user"))

node_visitor -->|"sends request"| node_front
node_front -->|"dispatches"| node_router
node_front -->|"creates"| node_configuration
node_router -->|"requests controller"| node_configuration
node_configuration -->|"constructs"| node_render
node_configuration -->|"constructs"| node_database
node_database -.->|"uses schema"| node_schema
node_login -->|"authenticates with"| node_login_model
node_registration -->|"registers through"| node_registration_model
node_registration -->|"sends activation"| node_mailer
node_registration -->|"reads input"| node_request
node_profile -->|"reads and updates"| node_profile_model
node_profile -->|"renders profile"| node_render
node_question_game -->|"loads and records"| node_question_model
node_editor -->|"moderates with"| node_editor_model
node_editor -->|"reads input"| node_request
node_administrator -->|"queries and updates"| node_administrator_model
node_administrator -->|"renders chart"| node_chart
node_ranking -->|"loads ranking"| node_ranking_model
node_login_model -->|"queries"| node_database
node_registration_model -->|"queries"| node_database
node_profile_model -->|"queries"| node_database
node_question_model -->|"queries"| node_database
node_editor_model -->|"queries"| node_database
node_administrator_model -->|"queries"| node_database
node_ranking_model -->|"queries"| node_database

click node_front "https://github.com/aguscax/preguntados/blob/main/index.php"
click node_router "https://github.com/aguscax/preguntados/blob/main/helper/Router.php"
click node_configuration "https://github.com/aguscax/preguntados/blob/main/app/Configuration.php"
click node_request "https://github.com/aguscax/preguntados/blob/main/helper/Request.php"
click node_render "https://github.com/aguscax/preguntados/blob/main/helper/MustacheRender.php"
click node_database "https://github.com/aguscax/preguntados/blob/main/helper/MyDatabase.php"
click node_schema "https://github.com/aguscax/preguntados/blob/main/app/sql/preguntados.sql"
click node_login "https://github.com/aguscax/preguntados/blob/main/app/controller/LoginController.php"
click node_login_model "https://github.com/aguscax/preguntados/blob/main/app/model/LoginModel.php"
click node_registration "https://github.com/aguscax/preguntados/blob/main/app/controller/RegistroController.php"
click node_registration_model "https://github.com/aguscax/preguntados/blob/main/app/model/RegistroModel.php"
click node_mailer "https://github.com/aguscax/preguntados/blob/main/helper/Mailer.php"
click node_profile "https://github.com/aguscax/preguntados/blob/main/app/controller/PerfilController.php"
click node_profile_model "https://github.com/aguscax/preguntados/blob/main/app/model/PerfilModel.php"
click node_question_game "https://github.com/aguscax/preguntados/blob/main/app/controller/PreguntaController.php"
click node_question_model "https://github.com/aguscax/preguntados/blob/main/app/model/PreguntaModel.php"
click node_ranking "https://github.com/aguscax/preguntados/blob/main/app/controller/RankingController.php"
click node_ranking_model "https://github.com/aguscax/preguntados/blob/main/app/model/RankingModel.php"
click node_editor "https://github.com/aguscax/preguntados/blob/main/app/controller/EditorController.php"
click node_editor_model "https://github.com/aguscax/preguntados/blob/main/app/model/EditorModel.php"
click node_administrator "https://github.com/aguscax/preguntados/blob/main/app/controller/AdministradorController.php"
click node_administrator_model "https://github.com/aguscax/preguntados/blob/main/app/model/AdministradorModel.php"
click node_chart "https://github.com/aguscax/preguntados/blob/main/helper/CpChartLib.php"

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_front,node_router,node_configuration,node_request,node_render,node_database,node_schema,node_visitor toneBlue
class node_login,node_login_model,node_registration,node_registration_model,node_mailer,node_profile,node_profile_model toneAmber
class node_question_game,node_question_model,node_ranking,node_ranking_model toneMint
class node_editor,node_editor_model,node_administrator,node_administrator_model,node_chart toneRose
```

## Components

### Request and MVC

- [Front controller](https://github.com/aguscax/preguntados/blob/main/index.php): `index.php`
- [Route dispatcher](https://github.com/aguscax/preguntados/blob/main/helper/Router.php): `helper/Router.php`
- [Dependency configuration](https://github.com/aguscax/preguntados/blob/main/app/Configuration.php): `app/Configuration.php`
- [Request input](https://github.com/aguscax/preguntados/blob/main/helper/Request.php): `helper/Request.php`
- [Mustache rendering](https://github.com/aguscax/preguntados/blob/main/helper/MustacheRender.php): `helper/MustacheRender.php`
- [MySQL database](https://github.com/aguscax/preguntados/blob/main/helper/MyDatabase.php): `helper/MyDatabase.php`
- [Quiz schema](https://github.com/aguscax/preguntados/blob/main/app/sql/preguntados.sql): `app/sql/preguntados.sql`

### Accounts and profiles

- [Login](https://github.com/aguscax/preguntados/blob/main/app/controller/LoginController.php): `app/controller/LoginController.php`
- [Authentication data](https://github.com/aguscax/preguntados/blob/main/app/model/LoginModel.php): `app/model/LoginModel.php`
- [Account registration](https://github.com/aguscax/preguntados/blob/main/app/controller/RegistroController.php): `app/controller/RegistroController.php`
- [Registration data](https://github.com/aguscax/preguntados/blob/main/app/model/RegistroModel.php): `app/model/RegistroModel.php`
- [Activation email](https://github.com/aguscax/preguntados/blob/main/helper/Mailer.php): `helper/Mailer.php`
- [Profile and QR](https://github.com/aguscax/preguntados/blob/main/app/controller/PerfilController.php): `app/controller/PerfilController.php`
- [Profile data](https://github.com/aguscax/preguntados/blob/main/app/model/PerfilModel.php): `app/model/PerfilModel.php`

### Quiz gameplay

- [Timed quiz and proposals](https://github.com/aguscax/preguntados/blob/main/app/controller/PreguntaController.php): `app/controller/PreguntaController.php`
- [Questions and reports](https://github.com/aguscax/preguntados/blob/main/app/model/PreguntaModel.php): `app/model/PreguntaModel.php`
- [Ranking](https://github.com/aguscax/preguntados/blob/main/app/controller/RankingController.php): `app/controller/RankingController.php`
- [Ranking data](https://github.com/aguscax/preguntados/blob/main/app/model/RankingModel.php): `app/model/RankingModel.php`

### Moderation and administration

- [Question moderation](https://github.com/aguscax/preguntados/blob/main/app/controller/EditorController.php): `app/controller/EditorController.php`
- [Moderation data](https://github.com/aguscax/preguntados/blob/main/app/model/EditorModel.php): `app/model/EditorModel.php`
- [Admin dashboard and roles](https://github.com/aguscax/preguntados/blob/main/app/controller/AdministradorController.php): `app/controller/AdministradorController.php`
- [Admin statistics and users](https://github.com/aguscax/preguntados/blob/main/app/model/AdministradorModel.php): `app/model/AdministradorModel.php`
- [PNG chart renderer](https://github.com/aguscax/preguntados/blob/main/helper/CpChartLib.php): `helper/CpChartLib.php`

### Other components

- **Web user**

## Connections

- Web user → Front controller: sends request (evidence: `README.md`)
- Front controller → Route dispatcher: dispatches (evidence: `README.md`)
- Front controller → Dependency configuration: creates (evidence: `index.php`)
- Route dispatcher → Dependency configuration: requests controller (evidence: `helper/Router.php`)
- Dependency configuration → Mustache rendering: constructs (evidence: `app/Configuration.php`)
- Dependency configuration → MySQL database: constructs (evidence: `app/Configuration.php`)
- MySQL database → Quiz schema: uses schema (evidence: `README.md`)
- Login → Authentication data: authenticates with (evidence: `README.md`)
- Account registration → Registration data: registers through (evidence: `README.md`)
- Account registration → Activation email: sends activation (evidence: `app/Configuration.php`)
- Account registration → Request input: reads input (evidence: `app/controller/RegistroController.php`)
- Profile and QR → Profile data: reads and updates (evidence: `app/controller/PerfilController.php`)
- Profile and QR → Mustache rendering: renders profile (evidence: `README.md`)
- Timed quiz and proposals → Questions and reports: loads and records (evidence: `app/controller/PreguntaController.php`)
- Question moderation → Moderation data: moderates with (evidence: `app/controller/EditorController.php`)
- Question moderation → Request input: reads input (evidence: `app/controller/EditorController.php`)
- Admin dashboard and roles → Admin statistics and users: queries and updates (evidence: `app/controller/AdministradorController.php`)
- Admin dashboard and roles → PNG chart renderer: renders chart (evidence: `app/controller/AdministradorController.php`)
- Ranking → Ranking data: loads ranking (evidence: `README.md`)
- Authentication data → MySQL database: queries (evidence: `README.md`)
- Registration data → MySQL database: queries (evidence: `README.md`)
- Profile data → MySQL database: queries (evidence: `README.md`)
- Questions and reports → MySQL database: queries (evidence: `README.md`)
- Moderation data → MySQL database: queries (evidence: `README.md`)
- Admin statistics and users → MySQL database: queries (evidence: `README.md`)
- Ranking data → MySQL database: queries (evidence: `README.md`)
