# appacta/acta-pg-api architecture

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

- Interactive diagram: https://gitdiagram.com/appacta/acta-pg-api
- Repository: https://github.com/appacta/acta-pg-api

## Overview

ACTA is a stateless REST API for managing organizations, users, and the PDCA improvement cycle. The main workflow is authenticated client requests routed through controllers to domain services, which enforce authorization and business rules, map DTOs to entities, and persist through JPA repositories. Domain capabilities span onboarding, problem analysis and planning, task execution, and outcome verification. The README describes these layers and capabilities; several domain nodes therefore use existing directories where implementation files were not sampled, and unsampled internal calls are not asserted.

Main entry points: [`src/main/java/br/com/acta/controller`](https://github.com/appacta/acta-pg-api/tree/main/src/main/java/br/com/acta/controller) (REST endpoints), [`src/main/java/br/com/acta/service/AuthService.java`](https://github.com/appacta/acta-pg-api/blob/main/src/main/java/br/com/acta/service/AuthService.java) (Auth and scope), [`src/main/java/br/com/acta/service/base/BaseService.java`](https://github.com/appacta/acta-pg-api/blob/main/src/main/java/br/com/acta/service/base/BaseService.java) (CRUD template), [`src/main/java/br/com/acta/repository`](https://github.com/appacta/acta-pg-api/tree/main/src/main/java/br/com/acta/repository) (JPA repositories)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_identity["Identity and access"]
  node_authfilter["Firebase filter"]
  node_authservice["Auth and scope<br/>[AuthService.java]"]
  node_authdata["User lookup"]
end

subgraph group_organization["Organization management"]
  node_onboarding["Onboarding and invites"]
  node_people["Users and staff"]
  node_company["Company records"]
  node_contacts["Contact details<br/>[EmailService.java]"]
  node_inviteemail["Invitation email<br/>[BrevoClient.java]"]
end

subgraph group_pdca["PDCA improvement cycle"]
  node_cycle["PDCA cycles<br/>[CicloService.java]"]
  node_problem["Problem analysis"]
  node_planning["Priorities and plans"]
  node_tasks["Tasks and dependencies<br/>[TarefaService.java]"]
  node_followup["Goals and training"]
  node_verification["Results and alerts"]
end

subgraph group_runtime["API runtime"]
  node_controllers["REST endpoints"]
  node_baseservice["CRUD template<br/>[BaseService.java]"]
  node_repositories["JPA repositories"]
  node_entities["Domain entities"]
  node_health["Health check<br/>[HealthService.java]"]
end

node_client(("API client"))
node_postgres[("PostgreSQL")]

node_client -->|"sends requests"| node_controllers
node_controllers -->|"protected by"| node_authfilter
node_controllers -->|"routes operations"| node_authservice
node_authfilter -->|"provides identity"| node_authservice
node_authservice -->|"looks up users"| node_authdata
node_authservice -->|"checks scope"| node_people
node_controllers -->|"routes onboarding"| node_onboarding
node_controllers -->|"routes company work"| node_company
node_controllers -->|"routes people work"| node_people
node_controllers -->|"routes contacts"| node_contacts
node_onboarding -->|"sends invitations"| node_inviteemail
node_controllers -->|"routes cycle work"| node_cycle
node_controllers -->|"routes problem work"| node_problem
node_controllers -->|"routes planning work"| node_planning
node_controllers -->|"routes task work"| node_tasks
node_controllers -->|"routes follow-up"| node_followup
node_controllers -->|"routes verification"| node_verification
node_controllers -->|"routes health check"| node_health
node_people -->|"inherits CRUD flow"| node_baseservice
node_tasks -->|"reuses CRUD flow"| node_baseservice
node_baseservice -->|"configures actor"| node_authservice
node_baseservice -->|"persists entities"| node_repositories
node_repositories -->|"loads and saves"| node_entities
node_repositories -->|"accesses database"| node_postgres
node_health -->|"checks database"| node_postgres

click node_controllers "https://github.com/appacta/acta-pg-api/tree/main/src/main/java/br/com/acta/controller"
click node_authfilter "https://github.com/appacta/acta-pg-api/blob/main/src/main/java/br/com/acta/common/config/firebase/FirebaseAuthFilter.java"
click node_authservice "https://github.com/appacta/acta-pg-api/blob/main/src/main/java/br/com/acta/service/AuthService.java"
click node_authdata "https://github.com/appacta/acta-pg-api/blob/main/src/main/java/br/com/acta/repository/padrao/UsuarioRepository.java"
click node_onboarding "https://github.com/appacta/acta-pg-api/blob/main/src/main/java/br/com/acta/service/OnboardingService.java"
click node_people "https://github.com/appacta/acta-pg-api/blob/main/src/main/java/br/com/acta/service/UsuarioService.java"
click node_company "https://github.com/appacta/acta-pg-api/blob/main/src/main/java/br/com/acta/service/EmpresaService.java"
click node_contacts "https://github.com/appacta/acta-pg-api/blob/main/src/main/java/br/com/acta/service/EmailService.java"
click node_inviteemail "https://github.com/appacta/acta-pg-api/blob/main/src/main/java/br/com/acta/common/client/BrevoClient.java"
click node_cycle "https://github.com/appacta/acta-pg-api/blob/main/src/main/java/br/com/acta/service/CicloService.java"
click node_problem "https://github.com/appacta/acta-pg-api/blob/main/src/main/java/br/com/acta/service/ProblemaService.java"
click node_planning "https://github.com/appacta/acta-pg-api/tree/main/src/main/java/br/com/acta/service"
click node_tasks "https://github.com/appacta/acta-pg-api/blob/main/src/main/java/br/com/acta/service/TarefaService.java"
click node_followup "https://github.com/appacta/acta-pg-api/tree/main/src/main/java/br/com/acta/service"
click node_verification "https://github.com/appacta/acta-pg-api/tree/main/src/main/java/br/com/acta/service"
click node_baseservice "https://github.com/appacta/acta-pg-api/blob/main/src/main/java/br/com/acta/service/base/BaseService.java"
click node_repositories "https://github.com/appacta/acta-pg-api/tree/main/src/main/java/br/com/acta/repository"
click node_entities "https://github.com/appacta/acta-pg-api/tree/main/src/main/java/br/com/acta/entity"
click node_health "https://github.com/appacta/acta-pg-api/blob/main/src/main/java/br/com/acta/service/HealthService.java"

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_authfilter,node_authservice,node_authdata,node_client toneBlue
class node_onboarding,node_people,node_company,node_contacts,node_inviteemail,node_postgres toneAmber
class node_cycle,node_problem,node_planning,node_tasks,node_followup,node_verification toneMint
class node_controllers,node_baseservice,node_repositories,node_entities,node_health toneRose
```

## Components

### Identity and access

- [Firebase filter](https://github.com/appacta/acta-pg-api/blob/main/src/main/java/br/com/acta/common/config/firebase/FirebaseAuthFilter.java): `src/main/java/br/com/acta/common/config/firebase/FirebaseAuthFilter.java`
- [Auth and scope](https://github.com/appacta/acta-pg-api/blob/main/src/main/java/br/com/acta/service/AuthService.java): `src/main/java/br/com/acta/service/AuthService.java`
- [User lookup](https://github.com/appacta/acta-pg-api/blob/main/src/main/java/br/com/acta/repository/padrao/UsuarioRepository.java): `src/main/java/br/com/acta/repository/padrao/UsuarioRepository.java`

### Organization management

- [Onboarding and invites](https://github.com/appacta/acta-pg-api/blob/main/src/main/java/br/com/acta/service/OnboardingService.java): `src/main/java/br/com/acta/service/OnboardingService.java`
- [Users and staff](https://github.com/appacta/acta-pg-api/blob/main/src/main/java/br/com/acta/service/UsuarioService.java): `src/main/java/br/com/acta/service/UsuarioService.java`
- [Company records](https://github.com/appacta/acta-pg-api/blob/main/src/main/java/br/com/acta/service/EmpresaService.java): `src/main/java/br/com/acta/service/EmpresaService.java`
- [Contact details](https://github.com/appacta/acta-pg-api/blob/main/src/main/java/br/com/acta/service/EmailService.java): `src/main/java/br/com/acta/service/EmailService.java`
- [Invitation email](https://github.com/appacta/acta-pg-api/blob/main/src/main/java/br/com/acta/common/client/BrevoClient.java): `src/main/java/br/com/acta/common/client/BrevoClient.java`

### PDCA improvement cycle

- [PDCA cycles](https://github.com/appacta/acta-pg-api/blob/main/src/main/java/br/com/acta/service/CicloService.java): `src/main/java/br/com/acta/service/CicloService.java`
- [Problem analysis](https://github.com/appacta/acta-pg-api/blob/main/src/main/java/br/com/acta/service/ProblemaService.java): `src/main/java/br/com/acta/service/ProblemaService.java`
- [Priorities and plans](https://github.com/appacta/acta-pg-api/tree/main/src/main/java/br/com/acta/service): `src/main/java/br/com/acta/service`
- [Tasks and dependencies](https://github.com/appacta/acta-pg-api/blob/main/src/main/java/br/com/acta/service/TarefaService.java): `src/main/java/br/com/acta/service/TarefaService.java`
- [Goals and training](https://github.com/appacta/acta-pg-api/tree/main/src/main/java/br/com/acta/service): `src/main/java/br/com/acta/service`
- [Results and alerts](https://github.com/appacta/acta-pg-api/tree/main/src/main/java/br/com/acta/service): `src/main/java/br/com/acta/service`

### API runtime

- [REST endpoints](https://github.com/appacta/acta-pg-api/tree/main/src/main/java/br/com/acta/controller): `src/main/java/br/com/acta/controller`
- [CRUD template](https://github.com/appacta/acta-pg-api/blob/main/src/main/java/br/com/acta/service/base/BaseService.java): `src/main/java/br/com/acta/service/base/BaseService.java`
- [JPA repositories](https://github.com/appacta/acta-pg-api/tree/main/src/main/java/br/com/acta/repository): `src/main/java/br/com/acta/repository`
- [Domain entities](https://github.com/appacta/acta-pg-api/tree/main/src/main/java/br/com/acta/entity): `src/main/java/br/com/acta/entity`
- [Health check](https://github.com/appacta/acta-pg-api/blob/main/src/main/java/br/com/acta/service/HealthService.java): `src/main/java/br/com/acta/service/HealthService.java`

### Other components

- **API client**
- **PostgreSQL**

## Connections

- API client → REST endpoints: sends requests (evidence: `README.md`)
- REST endpoints → Firebase filter: protected by (evidence: `README.md`)
- REST endpoints → Auth and scope: routes operations (evidence: `README.md`)
- Firebase filter → Auth and scope: provides identity (evidence: `README.md`)
- Auth and scope → User lookup: looks up users (evidence: `src/main/java/br/com/acta/service/AuthService.java`)
- Auth and scope → Users and staff: checks scope (evidence: `README.md`)
- REST endpoints → Onboarding and invites: routes onboarding (evidence: `README.md`)
- REST endpoints → Company records: routes company work (evidence: `README.md`)
- REST endpoints → Users and staff: routes people work (evidence: `README.md`)
- REST endpoints → Contact details: routes contacts (evidence: `README.md`)
- Onboarding and invites → Invitation email: sends invitations
- REST endpoints → PDCA cycles: routes cycle work (evidence: `README.md`)
- REST endpoints → Problem analysis: routes problem work (evidence: `README.md`)
- REST endpoints → Priorities and plans: routes planning work (evidence: `README.md`)
- REST endpoints → Tasks and dependencies: routes task work (evidence: `src/main/java/br/com/acta/controller/TarefaController.java`)
- REST endpoints → Goals and training: routes follow-up (evidence: `README.md`)
- REST endpoints → Results and alerts: routes verification (evidence: `README.md`)
- REST endpoints → Health check: routes health check (evidence: `README.md`)
- Users and staff → CRUD template: inherits CRUD flow (evidence: `src/main/java/br/com/acta/service/UsuarioService.java`)
- Tasks and dependencies → CRUD template: reuses CRUD flow (evidence: `src/main/java/br/com/acta/service/TarefaService.java`)
- CRUD template → Auth and scope: configures actor (evidence: `src/main/java/br/com/acta/service/base/BaseService.java`)
- CRUD template → JPA repositories: persists entities (evidence: `src/main/java/br/com/acta/service/base/BaseService.java`)
- JPA repositories → Domain entities: loads and saves (evidence: `src/main/java/br/com/acta/repository/padrao/TarefaRepository.java`)
- JPA repositories → PostgreSQL: accesses database (evidence: `README.md`)
- Health check → PostgreSQL: checks database (evidence: `README.md`)
