# fabricios0/3fsgerenciamento architecture

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

- Interactive diagram: https://gitdiagram.com/fabricios0/3fsgerenciamento
- Repository: https://github.com/fabricios0/3fsgerenciamento

## Overview

Gerenciamento is a Spring Boot API for document and employee administration across sectors. Users authenticate or register, then manage employees and documents, move documents between sectors, and review per-document history or a sector-scoped dashboard. The sampled services show document creation, updates, and moves recording history; the dashboard controller queries document and history repositories directly. Repository wiring is shown where supported by sampled code; paths for other capabilities use their exact enclosing directories from the tree.

Main entry points: [`gerenciamento/src/main/java/com/tresfs/gerenciamento/repository/SetorRepository.java`](https://github.com/fabricios0/3fsgerenciamento/blob/main/gerenciamento/src/main/java/com/tresfs/gerenciamento/repository/SetorRepository.java) (Sector repository), [`gerenciamento/src/main/java/com/tresfs/gerenciamento/service/DocumentoService.java`](https://github.com/fabricios0/3fsgerenciamento/blob/main/gerenciamento/src/main/java/com/tresfs/gerenciamento/service/DocumentoService.java) (Document service), [`gerenciamento/src/main/java/com/tresfs/gerenciamento/repository/DocumentoRepository.java`](https://github.com/fabricios0/3fsgerenciamento/blob/main/gerenciamento/src/main/java/com/tresfs/gerenciamento/repository/DocumentoRepository.java) (Document repository), [`gerenciamento/src/main/java/com/tresfs/gerenciamento/repository/FuncionarioRepository.java`](https://github.com/fabricios0/3fsgerenciamento/blob/main/gerenciamento/src/main/java/com/tresfs/gerenciamento/repository/FuncionarioRepository.java) (Employee repository)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_access["Access and API"]
  node_auth["Authentication API"]
  node_security["Security and tokens"]
end

subgraph group_workflow["Document Workflow"]
  node_document_api["Document API"]
  node_document_service["Document service"]
  node_history_api["History API"]
  node_history_service["History service"]
  node_dashboard["Sector dashboard"]
end

subgraph group_directory["People and Sectors"]
  node_employee_api["Employee API"]
  node_employee_service["Employee service"]
  node_sector_api["Sector API"]
end

subgraph group_persistence["Persistence"]
  node_document_repo["Document repository"]
  node_history_repo["History repository"]
  node_employee_repo["Employee repository"]
  node_sector_repo["Sector repository"]
  node_domain["Domain entities"]
  node_schema["SQL schema<br/>[gerenciamento.sql]"]
end

node_user(("API user"))
node_database[("Relational database")]

node_user -->|"signs in"| node_auth
node_auth -->|"authenticates, issues token"| node_security
node_auth -->|"registers account"| node_employee_repo
node_auth -->|"looks up sector"| node_sector_repo
node_user -->|"manages documents"| node_document_api
node_document_api -->|"delegates writes"| node_document_service
node_document_service -->|"reads, saves"| node_document_repo
node_document_service -->|"looks up sector"| node_sector_repo
node_document_service -->|"looks up employee"| node_employee_repo
node_document_service -->|"records actions"| node_history_service
node_document_api -->|"lists, filters"| node_document_repo
node_user -->|"requests history"| node_history_api
node_history_api -->|"delegates query"| node_history_service
node_history_service -->|"queries, saves"| node_history_repo
node_user -->|"views dashboard"| node_dashboard
node_dashboard -->|"counts, lists recent"| node_document_repo
node_dashboard -->|"lists recent activity"| node_history_repo
node_user -->|"manages employees"| node_employee_api
node_employee_api -->|"delegates"| node_employee_service
node_employee_service -->|"lists, saves"| node_employee_repo
node_employee_service -->|"looks up sector"| node_sector_repo
node_user -->|"lists sectors"| node_sector_api
node_sector_api -->|"reads sectors"| node_sector_repo
node_document_repo -->|"reads, writes"| node_database
node_history_repo -->|"reads, writes"| node_database
node_employee_repo -->|"reads, writes"| node_database
node_sector_repo -->|"reads, writes"| node_database
node_document_repo -->|"maps entities"| node_domain
node_history_repo -->|"maps entities"| node_domain
node_employee_repo -->|"maps entities"| node_domain
node_sector_repo -->|"maps entities"| node_domain
node_schema -.->|"defines schema"| node_database

click node_auth "https://github.com/fabricios0/3fsgerenciamento/blob/main/gerenciamento/src/main/java/com/tresfs/gerenciamento/controller/AuthController.java"
click node_security "https://github.com/fabricios0/3fsgerenciamento/tree/main/gerenciamento/src/main/java/com/tresfs/gerenciamento/config"
click node_document_api "https://github.com/fabricios0/3fsgerenciamento/blob/main/gerenciamento/src/main/java/com/tresfs/gerenciamento/controller/DocumentoController.java"
click node_document_service "https://github.com/fabricios0/3fsgerenciamento/blob/main/gerenciamento/src/main/java/com/tresfs/gerenciamento/service/DocumentoService.java"
click node_history_api "https://github.com/fabricios0/3fsgerenciamento/blob/main/gerenciamento/src/main/java/com/tresfs/gerenciamento/controller/HistoricoController.java"
click node_history_service "https://github.com/fabricios0/3fsgerenciamento/blob/main/gerenciamento/src/main/java/com/tresfs/gerenciamento/service/HistoricoService.java"
click node_dashboard "https://github.com/fabricios0/3fsgerenciamento/blob/main/gerenciamento/src/main/java/com/tresfs/gerenciamento/controller/DocumentoController.java"
click node_employee_api "https://github.com/fabricios0/3fsgerenciamento/blob/main/gerenciamento/src/main/java/com/tresfs/gerenciamento/controller/FuncionarioController.java"
click node_employee_service "https://github.com/fabricios0/3fsgerenciamento/blob/main/gerenciamento/src/main/java/com/tresfs/gerenciamento/service/FuncionarioService.java"
click node_sector_api "https://github.com/fabricios0/3fsgerenciamento/blob/main/gerenciamento/src/main/java/com/tresfs/gerenciamento/controller/SetorController.java"
click node_document_repo "https://github.com/fabricios0/3fsgerenciamento/blob/main/gerenciamento/src/main/java/com/tresfs/gerenciamento/repository/DocumentoRepository.java"
click node_history_repo "https://github.com/fabricios0/3fsgerenciamento/blob/main/gerenciamento/src/main/java/com/tresfs/gerenciamento/repository/HistoricoRepository.java"
click node_employee_repo "https://github.com/fabricios0/3fsgerenciamento/blob/main/gerenciamento/src/main/java/com/tresfs/gerenciamento/repository/FuncionarioRepository.java"
click node_sector_repo "https://github.com/fabricios0/3fsgerenciamento/blob/main/gerenciamento/src/main/java/com/tresfs/gerenciamento/repository/SetorRepository.java"
click node_domain "https://github.com/fabricios0/3fsgerenciamento/tree/main/gerenciamento/src/main/java/com/tresfs/gerenciamento/entity"
click node_schema "https://github.com/fabricios0/3fsgerenciamento/blob/main/gerenciamento/Banco/gerenciamento.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,node_security,node_user toneBlue
class node_document_api,node_document_service,node_history_api,node_history_service,node_dashboard,node_database toneAmber
class node_employee_api,node_employee_service,node_sector_api toneMint
class node_document_repo,node_history_repo,node_employee_repo,node_sector_repo,node_domain,node_schema toneRose
```

## Components

### Access and API

- [Authentication API](https://github.com/fabricios0/3fsgerenciamento/blob/main/gerenciamento/src/main/java/com/tresfs/gerenciamento/controller/AuthController.java): `gerenciamento/src/main/java/com/tresfs/gerenciamento/controller/AuthController.java`
- [Security and tokens](https://github.com/fabricios0/3fsgerenciamento/tree/main/gerenciamento/src/main/java/com/tresfs/gerenciamento/config): `gerenciamento/src/main/java/com/tresfs/gerenciamento/config`

### Document Workflow

- [Document API](https://github.com/fabricios0/3fsgerenciamento/blob/main/gerenciamento/src/main/java/com/tresfs/gerenciamento/controller/DocumentoController.java): `gerenciamento/src/main/java/com/tresfs/gerenciamento/controller/DocumentoController.java`
- [Document service](https://github.com/fabricios0/3fsgerenciamento/blob/main/gerenciamento/src/main/java/com/tresfs/gerenciamento/service/DocumentoService.java): `gerenciamento/src/main/java/com/tresfs/gerenciamento/service/DocumentoService.java`
- [History API](https://github.com/fabricios0/3fsgerenciamento/blob/main/gerenciamento/src/main/java/com/tresfs/gerenciamento/controller/HistoricoController.java): `gerenciamento/src/main/java/com/tresfs/gerenciamento/controller/HistoricoController.java`
- [History service](https://github.com/fabricios0/3fsgerenciamento/blob/main/gerenciamento/src/main/java/com/tresfs/gerenciamento/service/HistoricoService.java): `gerenciamento/src/main/java/com/tresfs/gerenciamento/service/HistoricoService.java`
- [Sector dashboard](https://github.com/fabricios0/3fsgerenciamento/blob/main/gerenciamento/src/main/java/com/tresfs/gerenciamento/controller/DocumentoController.java): `gerenciamento/src/main/java/com/tresfs/gerenciamento/controller/DocumentoController.java`

### People and Sectors

- [Employee API](https://github.com/fabricios0/3fsgerenciamento/blob/main/gerenciamento/src/main/java/com/tresfs/gerenciamento/controller/FuncionarioController.java): `gerenciamento/src/main/java/com/tresfs/gerenciamento/controller/FuncionarioController.java`
- [Employee service](https://github.com/fabricios0/3fsgerenciamento/blob/main/gerenciamento/src/main/java/com/tresfs/gerenciamento/service/FuncionarioService.java): `gerenciamento/src/main/java/com/tresfs/gerenciamento/service/FuncionarioService.java`
- [Sector API](https://github.com/fabricios0/3fsgerenciamento/blob/main/gerenciamento/src/main/java/com/tresfs/gerenciamento/controller/SetorController.java): `gerenciamento/src/main/java/com/tresfs/gerenciamento/controller/SetorController.java`

### Persistence

- [Document repository](https://github.com/fabricios0/3fsgerenciamento/blob/main/gerenciamento/src/main/java/com/tresfs/gerenciamento/repository/DocumentoRepository.java): `gerenciamento/src/main/java/com/tresfs/gerenciamento/repository/DocumentoRepository.java`
- [History repository](https://github.com/fabricios0/3fsgerenciamento/blob/main/gerenciamento/src/main/java/com/tresfs/gerenciamento/repository/HistoricoRepository.java): `gerenciamento/src/main/java/com/tresfs/gerenciamento/repository/HistoricoRepository.java`
- [Employee repository](https://github.com/fabricios0/3fsgerenciamento/blob/main/gerenciamento/src/main/java/com/tresfs/gerenciamento/repository/FuncionarioRepository.java): `gerenciamento/src/main/java/com/tresfs/gerenciamento/repository/FuncionarioRepository.java`
- [Sector repository](https://github.com/fabricios0/3fsgerenciamento/blob/main/gerenciamento/src/main/java/com/tresfs/gerenciamento/repository/SetorRepository.java): `gerenciamento/src/main/java/com/tresfs/gerenciamento/repository/SetorRepository.java`
- [Domain entities](https://github.com/fabricios0/3fsgerenciamento/tree/main/gerenciamento/src/main/java/com/tresfs/gerenciamento/entity): `gerenciamento/src/main/java/com/tresfs/gerenciamento/entity`
- [SQL schema](https://github.com/fabricios0/3fsgerenciamento/blob/main/gerenciamento/Banco/gerenciamento.sql): `gerenciamento/Banco/gerenciamento.sql`

### Other components

- **API user**
- **Relational database**

## Connections

- API user → Authentication API: signs in
- Authentication API → Security and tokens: authenticates, issues token
- Authentication API → Employee repository: registers account
- Authentication API → Sector repository: looks up sector
- API user → Document API: manages documents
- Document API → Document service: delegates writes
- Document service → Document repository: reads, saves
- Document service → Sector repository: looks up sector
- Document service → Employee repository: looks up employee
- Document service → History service: records actions
- Document API → Document repository: lists, filters
- API user → History API: requests history
- History API → History service: delegates query
- History service → History repository: queries, saves
- API user → Sector dashboard: views dashboard
- Sector dashboard → Document repository: counts, lists recent
- Sector dashboard → History repository: lists recent activity
- API user → Employee API: manages employees
- Employee API → Employee service: delegates
- Employee service → Employee repository: lists, saves
- Employee service → Sector repository: looks up sector
- API user → Sector API: lists sectors
- Sector API → Sector repository: reads sectors
- Document repository → Relational database: reads, writes
- History repository → Relational database: reads, writes
- Employee repository → Relational database: reads, writes
- Sector repository → Relational database: reads, writes
- Document repository → Domain entities: maps entities
- History repository → Domain entities: maps entities
- Employee repository → Domain entities: maps entities
- Sector repository → Domain entities: maps entities
- SQL schema → Relational database: defines schema
