# ederlucascavalcante-cell/projeto-programa-o-internet architecture

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

- Interactive diagram: https://gitdiagram.com/ederlucascavalcante-cell/projeto-programa-o-internet
- Repository: https://github.com/ederlucascavalcante-cell/projeto-programa-o-internet

## Overview

IF Fitness is a same-origin fitness web app: members register or log in, manage reusable workout routines and exercises, start a routine-based or free workout, record sets, finish it, and review workout history. The browser pages call an Express API; API routes enforce session access and persist data through a shared MySQL pool. The README also documents weight-registration and profile areas as absent, so they are not represented as implemented subsystems. Relationships below follow cited source excerpts or README statements; unsampled route details are limited to documented capabilities.

Main entry points: [`server.js`](https://github.com/ederlucascavalcante-cell/projeto-programa-o-internet/blob/main/server.js) (Express server), [`src/routes/rotinas.routes.js`](https://github.com/ederlucascavalcante-cell/projeto-programa-o-internet/blob/main/src/routes/rotinas.routes.js) (Routine API), [`src/routes/treinos.routes.js`](https://github.com/ederlucascavalcante-cell/projeto-programa-o-internet/blob/main/src/routes/treinos.routes.js) (Workout API), [`src/db.js`](https://github.com/ederlucascavalcante-cell/projeto-programa-o-internet/blob/main/src/db.js) (MySQL pool)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_web["Web experience"]
  node_auth_ui["Account screens<br/>[cadastro.js]"]
  node_dashboard["Member dashboard<br/>[usuario.js]"]
  node_history_ui["Workout history<br/>[meu-treino.js]"]
end

subgraph group_workouts["Workout workflows"]
  node_routine_editor["Routine editor<br/>[rotina-editor.js]"]
  node_exercise_library["Exercise library"]
  node_active_ui["Active workout<br/>[treino-ativo.js]"]
end

subgraph group_api["API services"]
  node_app_server["Express server<br/>[server.js]"]
  node_auth_routes["Authentication API<br/>[auth.routes.js]"]
  node_auth_guard["Session guard<br/>[auth.js]"]
  node_routine_routes["Routine API<br/>[rotinas.routes.js]"]
  node_exercise_routes["Exercise API"]
  node_workout_routes["Workout API<br/>[treinos.routes.js]"]
end

subgraph group_data["Persistence"]
  node_pool["MySQL pool<br/>[db.js]"]
  node_mysql[("IF Fitness database<br/>[schema.sql]")]
end

node_member(("Member"))

node_member -->|"uses"| node_auth_ui
node_auth_ui -.->|"submits account"| node_app_server
node_member -->|"uses"| node_dashboard
node_dashboard -->|"checks session"| node_auth_routes
node_dashboard -->|"loads routines"| node_routine_routes
node_dashboard -->|"starts workout"| node_workout_routes
node_member -.->|"edits routines"| node_routine_editor
node_routine_editor -->|"uses library"| node_exercise_library
node_routine_editor -->|"reads and saves"| node_routine_routes
node_member -.->|"records sets"| node_active_ui
node_active_ui -->|"uses library"| node_exercise_library
node_active_ui -->|"loads routine"| node_routine_routes
node_active_ui -->|"updates workout"| node_workout_routes
node_member -.->|"reviews history"| node_history_ui
node_history_ui -.->|"loads history"| node_workout_routes
node_app_server -->|"mounts routes"| node_auth_routes
node_app_server -->|"mounts routes"| node_routine_routes
node_app_server -->|"mounts routes"| node_exercise_routes
node_app_server -->|"mounts routes"| node_workout_routes
node_app_server -->|"serves static files"| node_auth_ui
node_routine_routes -->|"requires login"| node_auth_guard
node_exercise_routes -->|"requires login"| node_auth_guard
node_workout_routes -->|"requires login"| node_auth_guard
node_auth_routes -->|"queries"| node_pool
node_routine_routes -->|"queries"| node_pool
node_exercise_routes -->|"queries"| node_pool
node_workout_routes -->|"queries"| node_pool
node_pool -->|"connects"| node_mysql
node_exercise_library -.->|"catalog and custom exercise API"| node_exercise_routes

click node_auth_ui "https://github.com/ederlucascavalcante-cell/projeto-programa-o-internet/blob/main/public/cadastro.js"
click node_dashboard "https://github.com/ederlucascavalcante-cell/projeto-programa-o-internet/blob/main/public/usuario.js"
click node_routine_editor "https://github.com/ederlucascavalcante-cell/projeto-programa-o-internet/blob/main/public/rotina-editor.js"
click node_exercise_library "https://github.com/ederlucascavalcante-cell/projeto-programa-o-internet/blob/main/public/biblioteca-exercicios.js"
click node_active_ui "https://github.com/ederlucascavalcante-cell/projeto-programa-o-internet/blob/main/public/treino-ativo.js"
click node_history_ui "https://github.com/ederlucascavalcante-cell/projeto-programa-o-internet/blob/main/public/meu-treino.js"
click node_app_server "https://github.com/ederlucascavalcante-cell/projeto-programa-o-internet/blob/main/server.js"
click node_auth_routes "https://github.com/ederlucascavalcante-cell/projeto-programa-o-internet/blob/main/src/routes/auth.routes.js"
click node_auth_guard "https://github.com/ederlucascavalcante-cell/projeto-programa-o-internet/blob/main/src/middleware/auth.js"
click node_routine_routes "https://github.com/ederlucascavalcante-cell/projeto-programa-o-internet/blob/main/src/routes/rotinas.routes.js"
click node_exercise_routes "https://github.com/ederlucascavalcante-cell/projeto-programa-o-internet/blob/main/src/routes/exercicios.routes.js"
click node_workout_routes "https://github.com/ederlucascavalcante-cell/projeto-programa-o-internet/blob/main/src/routes/treinos.routes.js"
click node_pool "https://github.com/ederlucascavalcante-cell/projeto-programa-o-internet/blob/main/src/db.js"
click node_mysql "https://github.com/ederlucascavalcante-cell/projeto-programa-o-internet/blob/main/db/schema.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_auth_ui,node_dashboard,node_history_ui toneBlue
class node_routine_editor,node_exercise_library,node_active_ui toneAmber
class node_app_server,node_auth_routes,node_auth_guard,node_routine_routes,node_exercise_routes,node_workout_routes toneMint
class node_pool,node_mysql toneRose
class node_member toneIndigo
```

## Components

### Web experience

- [Account screens](https://github.com/ederlucascavalcante-cell/projeto-programa-o-internet/blob/main/public/cadastro.js): `public/cadastro.js`
- [Member dashboard](https://github.com/ederlucascavalcante-cell/projeto-programa-o-internet/blob/main/public/usuario.js): `public/usuario.js`
- [Workout history](https://github.com/ederlucascavalcante-cell/projeto-programa-o-internet/blob/main/public/meu-treino.js): `public/meu-treino.js`

### Workout workflows

- [Routine editor](https://github.com/ederlucascavalcante-cell/projeto-programa-o-internet/blob/main/public/rotina-editor.js): `public/rotina-editor.js`
- [Exercise library](https://github.com/ederlucascavalcante-cell/projeto-programa-o-internet/blob/main/public/biblioteca-exercicios.js): `public/biblioteca-exercicios.js`
- [Active workout](https://github.com/ederlucascavalcante-cell/projeto-programa-o-internet/blob/main/public/treino-ativo.js): `public/treino-ativo.js`

### API services

- [Express server](https://github.com/ederlucascavalcante-cell/projeto-programa-o-internet/blob/main/server.js): `server.js`
- [Authentication API](https://github.com/ederlucascavalcante-cell/projeto-programa-o-internet/blob/main/src/routes/auth.routes.js): `src/routes/auth.routes.js`
- [Session guard](https://github.com/ederlucascavalcante-cell/projeto-programa-o-internet/blob/main/src/middleware/auth.js): `src/middleware/auth.js`
- [Routine API](https://github.com/ederlucascavalcante-cell/projeto-programa-o-internet/blob/main/src/routes/rotinas.routes.js): `src/routes/rotinas.routes.js`
- [Exercise API](https://github.com/ederlucascavalcante-cell/projeto-programa-o-internet/blob/main/src/routes/exercicios.routes.js): `src/routes/exercicios.routes.js`
- [Workout API](https://github.com/ederlucascavalcante-cell/projeto-programa-o-internet/blob/main/src/routes/treinos.routes.js): `src/routes/treinos.routes.js`

### Persistence

- [MySQL pool](https://github.com/ederlucascavalcante-cell/projeto-programa-o-internet/blob/main/src/db.js): `src/db.js`
- [IF Fitness database](https://github.com/ederlucascavalcante-cell/projeto-programa-o-internet/blob/main/db/schema.sql): `db/schema.sql`

### Other components

- **Member**

## Connections

- Member → Account screens: uses (evidence: `README.md`)
- Account screens → Express server: submits account
- Member → Member dashboard: uses (evidence: `README.md`)
- Member dashboard → Authentication API: checks session (evidence: `public/usuario.js`)
- Member dashboard → Routine API: loads routines (evidence: `public/usuario.js`)
- Member dashboard → Workout API: starts workout (evidence: `public/usuario.js`)
- Member → Routine editor: edits routines
- Routine editor → Exercise library: uses library (evidence: `public/rotina-editor.js`)
- Routine editor → Routine API: reads and saves (evidence: `public/rotina-editor.js`)
- Member → Active workout: records sets
- Active workout → Exercise library: uses library (evidence: `public/treino-ativo.js`)
- Active workout → Routine API: loads routine (evidence: `public/treino-ativo.js`)
- Active workout → Workout API: updates workout (evidence: `README.md`)
- Member → Workout history: reviews history
- Workout history → Workout API: loads history
- Express server → Authentication API: mounts routes (evidence: `server.js`)
- Express server → Routine API: mounts routes (evidence: `server.js`)
- Express server → Exercise API: mounts routes (evidence: `server.js`)
- Express server → Workout API: mounts routes (evidence: `server.js`)
- Express server → Account screens: serves static files (evidence: `server.js`)
- Routine API → Session guard: requires login (evidence: `src/routes/rotinas.routes.js`)
- Exercise API → Session guard: requires login (evidence: `src/routes/exercicios.routes.js`)
- Workout API → Session guard: requires login (evidence: `src/routes/treinos.routes.js`)
- Authentication API → MySQL pool: queries (evidence: `src/routes/auth.routes.js`)
- Routine API → MySQL pool: queries (evidence: `src/routes/rotinas.routes.js`)
- Exercise API → MySQL pool: queries (evidence: `src/routes/exercicios.routes.js`)
- Workout API → MySQL pool: queries (evidence: `src/routes/treinos.routes.js`)
- MySQL pool → IF Fitness database: connects (evidence: `src/db.js`)
- Exercise library → Exercise API: catalog and custom exercise API
