# danielszii/flow-events architecture

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

- Interactive diagram: https://gitdiagram.com/danielszii/flow-events
- Repository: https://github.com/danielszii/flow-events

## Overview

This is a TypeScript/Express API for managing events and users. The principal workflow is an HTTP request routed to a controller, dispatched to an application use case, processed through domain entities and repository interfaces, and persisted by a database adapter. Event and user CRUD are separate application branches; event updates also invoke entity validation. Composition modules wire the use cases, adapters, and controllers. The README is empty, and some runtime wiring is unsampled, so uncertain relationships are omitted or marked unverified.

Main entry points: [`src/config/modules/evento-module.ts`](https://github.com/danielszii/flow-events/blob/main/src/config/modules/evento-module.ts) (Event module), [`src/config/modules/usuario-module.ts`](https://github.com/danielszii/flow-events/blob/main/src/config/modules/usuario-module.ts) (User module), [`src/infra/bd/mysql`](https://github.com/danielszii/flow-events/tree/main/src/infra/bd/mysql) (MySQL adapters), [`src/infra/bd/pg`](https://github.com/danielszii/flow-events/tree/main/src/infra/bd/pg) (PostgreSQL adapters)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_http["HTTP API"]
  node_server["Server entry<br/>[server.ts]"]
  node_express["Express API<br/>[ApiExpress.ts]"]
  node_event_routes["Event routes<br/>[EventoRoutes.ts]"]
  node_user_routes["User routes<br/>[UsuarioRoutes.ts]"]
  node_event_controller["Event controller<br/>[EventoControle.ts]"]
  node_user_controller["User controller<br/>[UsuarioControle.ts]"]
end

subgraph group_application["Application"]
  node_event_cases["Event use cases"]
  node_user_cases["User use cases"]
end

subgraph group_domain["Domain"]
  node_event_entity["Event entity<br/>[Evento.ts]"]
  node_user_entity["User entity<br/>[Usuario.ts]"]
  node_event_repo["Event repository port"]
  node_user_repo["User repository port"]
end

subgraph group_persistence["Persistence"]
  node_mysql_adapters["MySQL adapters"]
  node_pg_adapters["PostgreSQL adapters"]
  node_mysql_connection["MySQL connection<br/>[MysqlConexao.ts]"]
end

subgraph group_wiring["Composition"]
  node_composition["Composition root"]
  node_event_module["Event module<br/>[evento-module.ts]"]
  node_user_module["User module<br/>[usuario-module.ts]"]
end

node_client(("API client"))

node_client -.->|"sends requests"| node_express
node_server -->|"starts"| node_express
node_server -.->|"mounts routes"| node_event_routes
node_server -.->|"mounts routes"| node_user_routes
node_event_routes -->|"gets controllers"| node_composition
node_user_routes -->|"gets controllers"| node_composition
node_event_routes -->|"dispatches requests"| node_event_controller
node_user_routes -->|"dispatches requests"| node_user_controller
node_event_controller -->|"invokes"| node_event_cases
node_user_controller -->|"invokes"| node_user_cases
node_event_cases -->|"uses port"| node_event_repo
node_user_cases -->|"uses port"| node_user_repo
node_event_cases -->|"updates entity"| node_event_entity
node_user_cases -->|"maps entity"| node_user_entity
node_composition -->|"loads module"| node_event_module
node_composition -->|"loads module"| node_user_module
node_event_module -->|"constructs"| node_event_cases
node_event_module -->|"constructs"| node_event_controller
node_event_module -->|"selects adapter"| node_mysql_adapters
node_event_module -->|"selects adapter"| node_pg_adapters
node_user_module -->|"constructs"| node_user_cases
node_user_module -->|"constructs"| node_user_controller
node_user_module -->|"selects adapter"| node_mysql_adapters
node_user_module -->|"selects adapter"| node_pg_adapters
node_mysql_adapters -->|"implements"| node_event_repo
node_mysql_adapters -->|"implements"| node_user_repo
node_pg_adapters -->|"implements"| node_event_repo
node_pg_adapters -->|"implements"| node_user_repo
node_mysql_adapters -->|"uses connection"| node_mysql_connection
node_pg_adapters -->|"uses connection"| node_mysql_connection

click node_server "https://github.com/danielszii/flow-events/blob/main/src/server.ts"
click node_express "https://github.com/danielszii/flow-events/blob/main/src/infra/web/express/ApiExpress.ts"
click node_event_routes "https://github.com/danielszii/flow-events/blob/main/src/infra/web/express/routes/EventoRoutes.ts"
click node_user_routes "https://github.com/danielszii/flow-events/blob/main/src/infra/web/express/routes/UsuarioRoutes.ts"
click node_event_controller "https://github.com/danielszii/flow-events/blob/main/src/infra/web/express/controle/EventoControle.ts"
click node_user_controller "https://github.com/danielszii/flow-events/blob/main/src/infra/web/express/controle/UsuarioControle.ts"
click node_event_cases "https://github.com/danielszii/flow-events/tree/main/src/aplicacao/usecase/evento"
click node_user_cases "https://github.com/danielszii/flow-events/tree/main/src/aplicacao/usecase/usuario"
click node_event_entity "https://github.com/danielszii/flow-events/blob/main/src/dominio/entidades/Evento.ts"
click node_user_entity "https://github.com/danielszii/flow-events/blob/main/src/dominio/entidades/Usuario.ts"
click node_event_repo "https://github.com/danielszii/flow-events/blob/main/src/dominio/repositorios/EventoRepositorio.ts"
click node_user_repo "https://github.com/danielszii/flow-events/blob/main/src/dominio/repositorios/UsuarioRepositorio.ts"
click node_mysql_adapters "https://github.com/danielszii/flow-events/tree/main/src/infra/bd/mysql"
click node_pg_adapters "https://github.com/danielszii/flow-events/tree/main/src/infra/bd/pg"
click node_mysql_connection "https://github.com/danielszii/flow-events/blob/main/src/infra/bd/mysql/MysqlConexao.ts"
click node_composition "https://github.com/danielszii/flow-events/blob/main/src/config/composition-root.ts"
click node_event_module "https://github.com/danielszii/flow-events/blob/main/src/config/modules/evento-module.ts"
click node_user_module "https://github.com/danielszii/flow-events/blob/main/src/config/modules/usuario-module.ts"

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_express,node_event_routes,node_user_routes,node_event_controller,node_user_controller,node_client toneBlue
class node_event_cases,node_user_cases toneAmber
class node_event_entity,node_user_entity,node_event_repo,node_user_repo toneMint
class node_mysql_adapters,node_pg_adapters,node_mysql_connection toneRose
class node_composition,node_event_module,node_user_module toneIndigo
```

## Components

### HTTP API

- [Server entry](https://github.com/danielszii/flow-events/blob/main/src/server.ts): `src/server.ts`
- [Express API](https://github.com/danielszii/flow-events/blob/main/src/infra/web/express/ApiExpress.ts): `src/infra/web/express/ApiExpress.ts`
- [Event routes](https://github.com/danielszii/flow-events/blob/main/src/infra/web/express/routes/EventoRoutes.ts): `src/infra/web/express/routes/EventoRoutes.ts`
- [User routes](https://github.com/danielszii/flow-events/blob/main/src/infra/web/express/routes/UsuarioRoutes.ts): `src/infra/web/express/routes/UsuarioRoutes.ts`
- [Event controller](https://github.com/danielszii/flow-events/blob/main/src/infra/web/express/controle/EventoControle.ts): `src/infra/web/express/controle/EventoControle.ts`
- [User controller](https://github.com/danielszii/flow-events/blob/main/src/infra/web/express/controle/UsuarioControle.ts): `src/infra/web/express/controle/UsuarioControle.ts`

### Application

- [Event use cases](https://github.com/danielszii/flow-events/tree/main/src/aplicacao/usecase/evento): `src/aplicacao/usecase/evento`
- [User use cases](https://github.com/danielszii/flow-events/tree/main/src/aplicacao/usecase/usuario): `src/aplicacao/usecase/usuario`

### Domain

- [Event entity](https://github.com/danielszii/flow-events/blob/main/src/dominio/entidades/Evento.ts): `src/dominio/entidades/Evento.ts`
- [User entity](https://github.com/danielszii/flow-events/blob/main/src/dominio/entidades/Usuario.ts): `src/dominio/entidades/Usuario.ts`
- [Event repository port](https://github.com/danielszii/flow-events/blob/main/src/dominio/repositorios/EventoRepositorio.ts): `src/dominio/repositorios/EventoRepositorio.ts`
- [User repository port](https://github.com/danielszii/flow-events/blob/main/src/dominio/repositorios/UsuarioRepositorio.ts): `src/dominio/repositorios/UsuarioRepositorio.ts`

### Persistence

- [MySQL adapters](https://github.com/danielszii/flow-events/tree/main/src/infra/bd/mysql): `src/infra/bd/mysql`
- [PostgreSQL adapters](https://github.com/danielszii/flow-events/tree/main/src/infra/bd/pg): `src/infra/bd/pg`
- [MySQL connection](https://github.com/danielszii/flow-events/blob/main/src/infra/bd/mysql/MysqlConexao.ts): `src/infra/bd/mysql/MysqlConexao.ts`

### Composition

- [Composition root](https://github.com/danielszii/flow-events/blob/main/src/config/composition-root.ts): `src/config/composition-root.ts`
- [Event module](https://github.com/danielszii/flow-events/blob/main/src/config/modules/evento-module.ts): `src/config/modules/evento-module.ts`
- [User module](https://github.com/danielszii/flow-events/blob/main/src/config/modules/usuario-module.ts): `src/config/modules/usuario-module.ts`

### Other components

- **API client**

## Connections

- API client → Express API: sends requests
- Server entry → Express API: starts (evidence: `src/server.ts`)
- Server entry → Event routes: mounts routes
- Server entry → User routes: mounts routes
- Event routes → Composition root: gets controllers (evidence: `src/infra/web/express/routes/EventoRoutes.ts`)
- User routes → Composition root: gets controllers (evidence: `src/infra/web/express/routes/UsuarioRoutes.ts`)
- Event routes → Event controller: dispatches requests (evidence: `src/infra/web/express/routes/EventoRoutes.ts`)
- User routes → User controller: dispatches requests (evidence: `src/infra/web/express/routes/UsuarioRoutes.ts`)
- Event controller → Event use cases: invokes (evidence: `src/infra/web/express/controle/EventoControle.ts`)
- User controller → User use cases: invokes (evidence: `src/infra/web/express/controle/UsuarioControle.ts`)
- Event use cases → Event repository port: uses port (evidence: `src/aplicacao/usecase/evento/UpdateEvento.ts`)
- User use cases → User repository port: uses port (evidence: `src/aplicacao/usecase/usuario/ListUsuario.ts`)
- Event use cases → Event entity: updates entity (evidence: `src/aplicacao/usecase/evento/UpdateEvento.ts`)
- User use cases → User entity: maps entity (evidence: `src/aplicacao/usecase/usuario/ListUsuario.ts`)
- Composition root → Event module: loads module (evidence: `src/config/composition-root.ts`)
- Composition root → User module: loads module (evidence: `src/config/composition-root.ts`)
- Event module → Event use cases: constructs (evidence: `src/config/modules/evento-module.ts`)
- Event module → Event controller: constructs (evidence: `src/config/modules/evento-module.ts`)
- Event module → MySQL adapters: selects adapter (evidence: `src/config/modules/evento-module.ts`)
- Event module → PostgreSQL adapters: selects adapter (evidence: `src/config/modules/evento-module.ts`)
- User module → User use cases: constructs (evidence: `src/config/modules/usuario-module.ts`)
- User module → User controller: constructs (evidence: `src/config/modules/usuario-module.ts`)
- User module → MySQL adapters: selects adapter (evidence: `src/config/modules/usuario-module.ts`)
- User module → PostgreSQL adapters: selects adapter (evidence: `src/config/modules/usuario-module.ts`)
- MySQL adapters → Event repository port: implements (evidence: `src/infra/bd/mysql/EventoRepositorioMysql.ts`)
- MySQL adapters → User repository port: implements (evidence: `src/infra/bd/mysql/UsuarioRepositorioMysql.ts`)
- PostgreSQL adapters → Event repository port: implements (evidence: `src/infra/bd/pg/EventoRepositorioPg.ts`)
- PostgreSQL adapters → User repository port: implements (evidence: `src/infra/bd/pg/UsuarioRepositorioPg.ts`)
- MySQL adapters → MySQL connection: uses connection (evidence: `src/infra/bd/mysql/EventoRepositorioMysql.ts`)
- PostgreSQL adapters → MySQL connection: uses connection (evidence: `src/infra/bd/pg/EventoRepositorioPg.ts`)
