# andreysebastian01/projetoindividual architecture

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

- Interactive diagram: https://gitdiagram.com/andreysebastian01/projetoindividual
- Repository: https://github.com/andreysebastian01/projetoindividual

## Overview

This is a web application for a personality quiz that matches users to characters, stores quiz results, and exposes character and dashboard data. The principal flow validates an email and five personality scores, loads characters, selects the closest match, and persists the user and result. Separate API branches serve character lookups and frequent-character analytics. The excerpts establish the server-side calls and database access; frontend-to-API wiring and the detailed contents of unsampled pages are not shown, so those connections are left unasserted.

Main entry points: [`app.js`](https://github.com/andreysebastian01/projetoindividual/blob/main/app.js) (Static web app), [`src/database/config.js`](https://github.com/andreysebastian01/projetoindividual/blob/main/src/database/config.js) (MySQL access), [`src/controllers/quizController.js`](https://github.com/andreysebastian01/projetoindividual/blob/main/src/controllers/quizController.js) (Quiz validation and matching), [`src/models/personagemModel.js`](https://github.com/andreysebastian01/projetoindividual/blob/main/src/models/personagemModel.js) (Character queries)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_web["Web interface"]
  node_web_app["Static web app<br/>[app.js]"]
  node_email_signup["Email entry<br/>[cadastroEmail.html]"]
  node_email_script["Email interaction<br/>[cadastro.js]"]
  node_quiz_page["Quiz form<br/>[quiz.html]"]
  node_quiz_script["Quiz interaction<br/>[index.js]"]
  node_character_page["Character views<br/>[linhaTempo.html]"]
  node_dashboard_page["Dashboard view<br/>[dash.html]"]
end

subgraph group_api["HTTP API"]
  node_quiz_routes["Quiz routes<br/>[quiz.js]"]
  node_character_routes["Character routes<br/>[personagens.js]"]
  node_dashboard_routes["Dashboard routes<br/>[dashboard.js]"]
end

subgraph group_domain["Quiz and analytics"]
  node_quiz_logic["Quiz validation and matching<br/>[quizController.js]"]
  node_character_logic["Character lookup"]
  node_dashboard_logic["Frequent characters"]
end

subgraph group_storage["Persistence"]
  node_character_queries["Character queries<br/>[personagemModel.js]"]
  node_quiz_queries["Quiz result queries<br/>[quizModel.js]"]
  node_dashboard_queries["Dashboard query<br/>[dashboardModel.js]"]
  node_db_config["MySQL access<br/>[config.js]"]
  node_schema["Database schema<br/>[script.sql]"]
end

node_visitor(("Browser visitor"))
node_mysql[("MySQL database")]

node_visitor -->|"opens"| node_web_app
node_web_app -->|"mounts at /api/quiz"| node_quiz_routes
node_web_app -->|"mounts at /api/personagens"| node_character_routes
node_web_app -->|"mounts at /api/dashboard"| node_dashboard_routes
node_quiz_routes -->|"dispatches"| node_quiz_logic
node_character_routes -->|"dispatches"| node_character_logic
node_dashboard_routes -->|"dispatches"| node_dashboard_logic
node_quiz_logic -->|"loads characters"| node_character_queries
node_quiz_logic -->|"reads and saves results"| node_quiz_queries
node_character_logic -->|"requests lookups"| node_character_queries
node_dashboard_logic -->|"requests ranking"| node_dashboard_queries
node_character_queries -->|"executes SQL"| node_db_config
node_quiz_queries -->|"executes SQL"| node_db_config
node_dashboard_queries -->|"executes SQL"| node_db_config
node_db_config -->|"connects and queries"| node_mysql

click node_web_app "https://github.com/andreysebastian01/projetoindividual/blob/main/app.js"
click node_email_signup "https://github.com/andreysebastian01/projetoindividual/blob/main/public/pages/cadastroEmail.html"
click node_email_script "https://github.com/andreysebastian01/projetoindividual/blob/main/public/js/cadastro.js"
click node_quiz_page "https://github.com/andreysebastian01/projetoindividual/blob/main/public/pages/quiz.html"
click node_quiz_script "https://github.com/andreysebastian01/projetoindividual/blob/main/public/js/index.js"
click node_character_page "https://github.com/andreysebastian01/projetoindividual/blob/main/public/pages/linhaTempo.html"
click node_dashboard_page "https://github.com/andreysebastian01/projetoindividual/blob/main/public/pages/dash.html"
click node_quiz_routes "https://github.com/andreysebastian01/projetoindividual/blob/main/src/routes/quiz.js"
click node_character_routes "https://github.com/andreysebastian01/projetoindividual/blob/main/src/routes/personagens.js"
click node_dashboard_routes "https://github.com/andreysebastian01/projetoindividual/blob/main/src/routes/dashboard.js"
click node_quiz_logic "https://github.com/andreysebastian01/projetoindividual/blob/main/src/controllers/quizController.js"
click node_character_logic "https://github.com/andreysebastian01/projetoindividual/blob/main/src/controllers/personagemController.js"
click node_dashboard_logic "https://github.com/andreysebastian01/projetoindividual/blob/main/src/controllers/dashboardController.js"
click node_character_queries "https://github.com/andreysebastian01/projetoindividual/blob/main/src/models/personagemModel.js"
click node_quiz_queries "https://github.com/andreysebastian01/projetoindividual/blob/main/src/models/quizModel.js"
click node_dashboard_queries "https://github.com/andreysebastian01/projetoindividual/blob/main/src/models/dashboardModel.js"
click node_db_config "https://github.com/andreysebastian01/projetoindividual/blob/main/src/database/config.js"
click node_schema "https://github.com/andreysebastian01/projetoindividual/blob/main/src/database/script.sql"

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_web_app,node_email_signup,node_email_script,node_quiz_page,node_quiz_script,node_character_page,node_dashboard_page,node_visitor toneBlue
class node_quiz_routes,node_character_routes,node_dashboard_routes,node_mysql toneAmber
class node_quiz_logic,node_character_logic,node_dashboard_logic toneMint
class node_character_queries,node_quiz_queries,node_dashboard_queries,node_db_config,node_schema toneRose
```

## Components

### Web interface

- [Static web app](https://github.com/andreysebastian01/projetoindividual/blob/main/app.js): `app.js`
- [Email entry](https://github.com/andreysebastian01/projetoindividual/blob/main/public/pages/cadastroEmail.html): `public/pages/cadastroEmail.html`
- [Email interaction](https://github.com/andreysebastian01/projetoindividual/blob/main/public/js/cadastro.js): `public/js/cadastro.js`
- [Quiz form](https://github.com/andreysebastian01/projetoindividual/blob/main/public/pages/quiz.html): `public/pages/quiz.html`
- [Quiz interaction](https://github.com/andreysebastian01/projetoindividual/blob/main/public/js/index.js): `public/js/index.js`
- [Character views](https://github.com/andreysebastian01/projetoindividual/blob/main/public/pages/linhaTempo.html): `public/pages/linhaTempo.html`
- [Dashboard view](https://github.com/andreysebastian01/projetoindividual/blob/main/public/pages/dash.html): `public/pages/dash.html`

### HTTP API

- [Quiz routes](https://github.com/andreysebastian01/projetoindividual/blob/main/src/routes/quiz.js): `src/routes/quiz.js`
- [Character routes](https://github.com/andreysebastian01/projetoindividual/blob/main/src/routes/personagens.js): `src/routes/personagens.js`
- [Dashboard routes](https://github.com/andreysebastian01/projetoindividual/blob/main/src/routes/dashboard.js): `src/routes/dashboard.js`

### Quiz and analytics

- [Quiz validation and matching](https://github.com/andreysebastian01/projetoindividual/blob/main/src/controllers/quizController.js): `src/controllers/quizController.js`
- [Character lookup](https://github.com/andreysebastian01/projetoindividual/blob/main/src/controllers/personagemController.js): `src/controllers/personagemController.js`
- [Frequent characters](https://github.com/andreysebastian01/projetoindividual/blob/main/src/controllers/dashboardController.js): `src/controllers/dashboardController.js`

### Persistence

- [Character queries](https://github.com/andreysebastian01/projetoindividual/blob/main/src/models/personagemModel.js): `src/models/personagemModel.js`
- [Quiz result queries](https://github.com/andreysebastian01/projetoindividual/blob/main/src/models/quizModel.js): `src/models/quizModel.js`
- [Dashboard query](https://github.com/andreysebastian01/projetoindividual/blob/main/src/models/dashboardModel.js): `src/models/dashboardModel.js`
- [MySQL access](https://github.com/andreysebastian01/projetoindividual/blob/main/src/database/config.js): `src/database/config.js`
- [Database schema](https://github.com/andreysebastian01/projetoindividual/blob/main/src/database/script.sql): `src/database/script.sql`

### Other components

- **Browser visitor**
- **MySQL database**

## Connections

- Browser visitor → Static web app: opens (evidence: `app.js`)
- Static web app → Quiz routes: mounts at /api/quiz (evidence: `app.js`)
- Static web app → Character routes: mounts at /api/personagens (evidence: `app.js`)
- Static web app → Dashboard routes: mounts at /api/dashboard (evidence: `app.js`)
- Quiz routes → Quiz validation and matching: dispatches (evidence: `src/routes/quiz.js`)
- Character routes → Character lookup: dispatches (evidence: `src/routes/personagens.js`)
- Dashboard routes → Frequent characters: dispatches (evidence: `src/routes/dashboard.js`)
- Quiz validation and matching → Character queries: loads characters (evidence: `src/controllers/quizController.js`)
- Quiz validation and matching → Quiz result queries: reads and saves results (evidence: `src/controllers/quizController.js`)
- Character lookup → Character queries: requests lookups (evidence: `src/controllers/personagemController.js`)
- Frequent characters → Dashboard query: requests ranking (evidence: `src/controllers/dashboardController.js`)
- Character queries → MySQL access: executes SQL (evidence: `src/models/personagemModel.js`)
- Quiz result queries → MySQL access: executes SQL (evidence: `src/models/quizModel.js`)
- Dashboard query → MySQL access: executes SQL (evidence: `src/models/dashboardModel.js`)
- MySQL access → MySQL database: connects and queries (evidence: `src/database/config.js`)
