# hugo38rodrigues/hall-e-back architecture

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

- Interactive diagram: https://gitdiagram.com/hugo38rodrigues/hall-e-back
- Repository: https://github.com/hugo38rodrigues/hall-e-back

## Overview

Hall-E is a Node.js API for the mobile app: clients and bars use its HTTP endpoints for accounts, authentication, bar discovery, match schedules, and favorites. Routes dispatch requests through authentication/role middleware to controllers, which use the shared database package; account flows also use supporting utilities and email. The README documents a separate match-retrieval service that feeds the shared database. Connections to that service are documented capabilities, not sampled implementation calls.

Main entry points: [`app/controllers/commun.controller.js`](https://github.com/hugo38rodrigues/hall-e-back/blob/main/app/controllers/commun.controller.js) (Account and Discovery), [`app/routes/commun.route.js`](https://github.com/hugo38rodrigues/hall-e-back/blob/main/app/routes/commun.route.js) (Common Routes), [`app/controllers/bar.controller.js`](https://github.com/hugo38rodrigues/hall-e-back/blob/main/app/controllers/bar.controller.js) (Bar Scheduling), [`app/utils/logger.js`](https://github.com/hugo38rodrigues/hall-e-back/blob/main/app/utils/logger.js) (Logging)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_api["HTTP API"]
  node_server["Express Server<br/>[server.js]"]
  node_common_routes["Common Routes<br/>[commun.route.js]"]
  node_bar_routes["Bar Routes<br/>[bar.route.js]"]
end

subgraph group_security["Identity and Access"]
  node_jwt["JWT Authentication<br/>[jwt.js]"]
  node_roles["Role Validation<br/>[RoleValidation.js]"]
end

subgraph group_domain["Hall-E Features"]
  node_commun["Account and Discovery"]
  node_bar["Bar Scheduling<br/>[bar.controller.js]"]
  node_favorites["Favorites"]
  node_client_controller["Client Controller"]
  node_database[("Shared Database")]
end

subgraph group_support["Supporting Logic"]
  node_code["Code Generation<br/>[code-generation.js]"]
  node_email["Reset Email<br/>[email.js]"]
  node_encryption["Password Encryption<br/>[encryption.js]"]
  node_map["Address Geocoding<br/>[map.js]"]
  node_match_tools["Match Duration Rules<br/>[match-tools.js]"]
  node_regex["Input Validation<br/>[regex.js]"]
  node_constants["Error Constants<br/>[constants.js]"]
  node_logger["Logging<br/>[logger.js]"]
end

node_mobile(("Mobile App"))
node_match_service["Match Retrieval Service"]
node_email_service["SMTP Email"]

node_mobile -->|"sends requests"| node_server
node_server -->|"mounts routes"| node_common_routes
node_server -->|"mounts routes"| node_bar_routes
node_common_routes -->|"dispatches requests"| node_commun
node_common_routes -->|"dispatches requests"| node_favorites
node_bar_routes -->|"dispatches requests"| node_bar
node_common_routes -->|"checks tokens"| node_jwt
node_bar_routes -->|"checks tokens"| node_jwt
node_common_routes -->|"checks roles"| node_roles
node_bar_routes -->|"checks roles"| node_roles
node_commun -->|"reads and writes"| node_database
node_bar -->|"reads and writes"| node_database
node_favorites -->|"reads and writes"| node_database
node_roles -->|"loads profiles"| node_database
node_commun -->|"creates tokens"| node_jwt
node_commun -->|"generates codes"| node_code
node_commun -->|"sends reset mail"| node_email
node_email -->|"sends email"| node_email_service
node_commun -->|"encrypts passwords"| node_encryption
node_commun -->|"geocodes addresses"| node_map
node_commun -->|"computes durations"| node_match_tools
node_bar -->|"filters expired matches"| node_match_tools
node_commun -->|"validates input"| node_regex
node_commun -->|"uses errors"| node_constants
node_bar -->|"uses errors"| node_constants
node_favorites -->|"uses errors"| node_constants
node_commun -->|"logs events"| node_logger
node_bar -->|"logs events"| node_logger
node_favorites -->|"logs events"| node_logger
node_jwt -->|"logs failures"| node_logger
node_server -->|"logs server status"| node_logger
node_match_service -->|"feeds match data"| node_database

click node_server "https://github.com/hugo38rodrigues/hall-e-back/blob/main/app/server.js"
click node_common_routes "https://github.com/hugo38rodrigues/hall-e-back/blob/main/app/routes/commun.route.js"
click node_bar_routes "https://github.com/hugo38rodrigues/hall-e-back/blob/main/app/routes/bar.route.js"
click node_commun "https://github.com/hugo38rodrigues/hall-e-back/blob/main/app/controllers/commun.controller.js"
click node_bar "https://github.com/hugo38rodrigues/hall-e-back/blob/main/app/controllers/bar.controller.js"
click node_favorites "https://github.com/hugo38rodrigues/hall-e-back/blob/main/app/controllers/favoris.controller.js"
click node_client_controller "https://github.com/hugo38rodrigues/hall-e-back/blob/main/app/controllers/client.controller.js"
click node_jwt "https://github.com/hugo38rodrigues/hall-e-back/blob/main/app/middleware/jwt.js"
click node_roles "https://github.com/hugo38rodrigues/hall-e-back/blob/main/app/middleware/RoleValidation.js"
click node_code "https://github.com/hugo38rodrigues/hall-e-back/blob/main/app/utils/code-generation.js"
click node_email "https://github.com/hugo38rodrigues/hall-e-back/blob/main/app/utils/email.js"
click node_encryption "https://github.com/hugo38rodrigues/hall-e-back/blob/main/app/utils/encryption.js"
click node_map "https://github.com/hugo38rodrigues/hall-e-back/blob/main/app/utils/map.js"
click node_match_tools "https://github.com/hugo38rodrigues/hall-e-back/blob/main/app/utils/match-tools.js"
click node_regex "https://github.com/hugo38rodrigues/hall-e-back/blob/main/app/utils/regex.js"
click node_constants "https://github.com/hugo38rodrigues/hall-e-back/blob/main/app/utils/constants.js"
click node_logger "https://github.com/hugo38rodrigues/hall-e-back/blob/main/app/utils/logger.js"

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_server,node_common_routes,node_bar_routes toneBlue
class node_jwt,node_roles toneAmber
class node_commun,node_bar,node_favorites,node_client_controller,node_database toneMint
class node_code,node_email,node_encryption,node_map,node_match_tools,node_regex,node_constants,node_logger toneRose
class node_mobile,node_match_service,node_email_service toneIndigo
```

## Components

### HTTP API

- [Express Server](https://github.com/hugo38rodrigues/hall-e-back/blob/main/app/server.js): `app/server.js`
- [Common Routes](https://github.com/hugo38rodrigues/hall-e-back/blob/main/app/routes/commun.route.js): `app/routes/commun.route.js`
- [Bar Routes](https://github.com/hugo38rodrigues/hall-e-back/blob/main/app/routes/bar.route.js): `app/routes/bar.route.js`

### Identity and Access

- [JWT Authentication](https://github.com/hugo38rodrigues/hall-e-back/blob/main/app/middleware/jwt.js): `app/middleware/jwt.js`
- [Role Validation](https://github.com/hugo38rodrigues/hall-e-back/blob/main/app/middleware/RoleValidation.js): `app/middleware/RoleValidation.js`

### Hall-E Features

- [Account and Discovery](https://github.com/hugo38rodrigues/hall-e-back/blob/main/app/controllers/commun.controller.js): `app/controllers/commun.controller.js`
- [Bar Scheduling](https://github.com/hugo38rodrigues/hall-e-back/blob/main/app/controllers/bar.controller.js): `app/controllers/bar.controller.js`
- [Favorites](https://github.com/hugo38rodrigues/hall-e-back/blob/main/app/controllers/favoris.controller.js): `app/controllers/favoris.controller.js`
- [Client Controller](https://github.com/hugo38rodrigues/hall-e-back/blob/main/app/controllers/client.controller.js): `app/controllers/client.controller.js`
- **Shared Database**

### Supporting Logic

- [Code Generation](https://github.com/hugo38rodrigues/hall-e-back/blob/main/app/utils/code-generation.js): `app/utils/code-generation.js`
- [Reset Email](https://github.com/hugo38rodrigues/hall-e-back/blob/main/app/utils/email.js): `app/utils/email.js`
- [Password Encryption](https://github.com/hugo38rodrigues/hall-e-back/blob/main/app/utils/encryption.js): `app/utils/encryption.js`
- [Address Geocoding](https://github.com/hugo38rodrigues/hall-e-back/blob/main/app/utils/map.js): `app/utils/map.js`
- [Match Duration Rules](https://github.com/hugo38rodrigues/hall-e-back/blob/main/app/utils/match-tools.js): `app/utils/match-tools.js`
- [Input Validation](https://github.com/hugo38rodrigues/hall-e-back/blob/main/app/utils/regex.js): `app/utils/regex.js`
- [Error Constants](https://github.com/hugo38rodrigues/hall-e-back/blob/main/app/utils/constants.js): `app/utils/constants.js`
- [Logging](https://github.com/hugo38rodrigues/hall-e-back/blob/main/app/utils/logger.js): `app/utils/logger.js`

### Other components

- **Mobile App**
- **Match Retrieval Service**
- **SMTP Email**

## Connections

- Mobile App → Express Server: sends requests (evidence: `README.md`)
- Express Server → Common Routes: mounts routes (evidence: `app/server.js`)
- Express Server → Bar Routes: mounts routes (evidence: `app/server.js`)
- Common Routes → Account and Discovery: dispatches requests (evidence: `app/routes/commun.route.js`)
- Common Routes → Favorites: dispatches requests (evidence: `app/routes/commun.route.js`)
- Bar Routes → Bar Scheduling: dispatches requests (evidence: `app/routes/bar.route.js`)
- Common Routes → JWT Authentication: checks tokens (evidence: `app/routes/commun.route.js`)
- Bar Routes → JWT Authentication: checks tokens (evidence: `app/routes/bar.route.js`)
- Common Routes → Role Validation: checks roles (evidence: `app/routes/commun.route.js`)
- Bar Routes → Role Validation: checks roles (evidence: `app/routes/bar.route.js`)
- Account and Discovery → Shared Database: reads and writes (evidence: `app/controllers/commun.controller.js`)
- Bar Scheduling → Shared Database: reads and writes (evidence: `app/controllers/bar.controller.js`)
- Favorites → Shared Database: reads and writes (evidence: `app/controllers/favoris.controller.js`)
- Role Validation → Shared Database: loads profiles (evidence: `app/middleware/RoleValidation.js`)
- Account and Discovery → JWT Authentication: creates tokens (evidence: `app/controllers/commun.controller.js`)
- Account and Discovery → Code Generation: generates codes (evidence: `app/controllers/commun.controller.js`)
- Account and Discovery → Reset Email: sends reset mail (evidence: `app/controllers/commun.controller.js`)
- Reset Email → SMTP Email: sends email (evidence: `app/utils/email.js`)
- Account and Discovery → Password Encryption: encrypts passwords (evidence: `app/controllers/commun.controller.js`)
- Account and Discovery → Address Geocoding: geocodes addresses (evidence: `app/controllers/commun.controller.js`)
- Account and Discovery → Match Duration Rules: computes durations (evidence: `app/controllers/commun.controller.js`)
- Bar Scheduling → Match Duration Rules: filters expired matches (evidence: `app/controllers/bar.controller.js`)
- Account and Discovery → Input Validation: validates input (evidence: `app/controllers/commun.controller.js`)
- Account and Discovery → Error Constants: uses errors (evidence: `app/controllers/commun.controller.js`)
- Bar Scheduling → Error Constants: uses errors (evidence: `app/controllers/bar.controller.js`)
- Favorites → Error Constants: uses errors (evidence: `app/controllers/favoris.controller.js`)
- Account and Discovery → Logging: logs events (evidence: `app/controllers/commun.controller.js`)
- Bar Scheduling → Logging: logs events (evidence: `app/controllers/bar.controller.js`)
- Favorites → Logging: logs events (evidence: `app/controllers/favoris.controller.js`)
- JWT Authentication → Logging: logs failures (evidence: `app/middleware/jwt.js`)
- Express Server → Logging: logs server status (evidence: `app/server.js`)
- Match Retrieval Service → Shared Database: feeds match data (evidence: `README.md`)
