# jeanzo1719/adulto-funcional-server architecture

> Architecture diagram of the GitHub repository jeanzo1719/adulto-funcional-server, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-04-23). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/jeanzo1719/adulto-funcional-server
- Repository: https://github.com/jeanzo1719/adulto-funcional-server

## Overview

1. **What this repository is**
   - This is a **Spring Boot 3 backend** for a personal management system combining **financial tracking**, **agenda/scheduling**, and **secure password storage**.
   - The README explicitly describes a **Clean Architecture** approach, so the codebase is intended to be organized by dependency direction: domain at the center, infrastructure at the edges.

2. **Likely architectural shape**
   - The main boundary is between **business logic** and **technical concerns**.
   - In a clean-architecture setup like this, you should expect:
     - **Domain layer**: core entities and rules for finances, agenda items, and password vault entries.
     - **Application/use-case layer**: orchestration of operations like create transaction, schedule event, store password.
     - **Infrastructure layer**: database access, authentication, migrations, and any crypto implementation details.

3. **Primary functional subsystems**
   - The README names three product areas:
     - **Personal finance management**
     - **Agenda / scheduling**
     - **Secure password storage**
   - For an architecture diagram, these should be shown as separate business modules that share platform services such as authentication and persistence.

4. **Authentication and identity boundary**
   - Authentication is explicitly **JWT-based**, which means the backend likely issues tokens after login and validates them on protected requests.
   - This makes authentication a cross-cutting subsystem sitting between the API layer and the use cases.
   - The system likely uses user identity as the tenant boundary for all three modules, with access to each user’s financial, agenda, and password data scoped by the authenticated principal.

5. **Password security subsystem**
   - The README calls out **Argon2**, indicating password hashing is a dedicated security concern.
   - This is important for the diagram because there are two different “password” concepts:
     - **Login credentials** hashed with Argon2
     - **Stored passwords** managed as user data, likely with additional protection beyond plain storage
   - Even without implementation details, it is safe to treat cryptographic handling as part of the security/infrastructure boundary, not the domain layer.

6. **Persistence and database layer**
   - The backend uses **MariaDB** as the relational datastore.
   - **Flyway** is included, so schema evolution is managed through versioned database migrations rather than ad hoc schema changes.
   - In the architecture diagram, MariaDB should sit behind repository/DAO adapters, with Flyway as a separate database provisioning/migration path at startup or deployment time.

7. **Identifier strategy**
   - The README mentions **UUID v7**, which suggests entities are identified with time-ordered UUIDs rather than auto-increment integers.
   - This affects persistence and API design because IDs are globally unique and suitable for distributed systems or safer public exposure.
   - In a diagram, this is a data-model characteristic rather than a separate subsystem.

8. **Request/data flow at a high level**
   - A typical flow is:
     1. Client sends request to the Spring Boot API.
     2. Authentication layer validates JWT or performs login.
     3. Application/use-case layer executes business logic for finances, agenda, or passwords.
     4. Domain objects enforce rules.
     5. Repository adapters persist or read data from MariaDB.
   - This is the main end-to-end path to depict.

9. **Security boundary**
   - The architecture clearly treats security as a first-class concern:
     - JWT for sessionless API authentication
     - Argon2 for credential hashing
     - Secure storage requirements for password vault data
   - For diagram purposes, security should be drawn as a boundary that protects all business modules, not as a feature of only one module.

10. **Infrastructure and runtime**
   - The runtime is **Java/Spring Boot 3**, which implies a standard server-side application packaged and deployed as a backend service.
   - There is no evidence in the README of additional external services such as message brokers, caches, or search engines, so the core architecture appears centered on a single application process plus MariaDB.

11. **What should be emphasized in an architecture diagram**
   - Show the backend as a layered system with:
     - **API/controllers**
     - **Application/use cases**
     - **Domain**
     - **Infrastructure adapters**
   - Show three business areas under the application/domain boundary:
     - finance
     - agenda
     - password vault
   - Show shared platform services:
     - JWT auth
     - Argon2 hashing
     - MariaDB persistence
     - Flyway migrations

12. **Confidence note**
   - This explanation is based only on the README and file listing, so it reflects the **intended architecture**, not verified implementation details.
   - If you want a deeper diagram, the next useful inputs would be the source tree under `src/`, especially packages for controllers, services, domain models, repositories, and security configuration.

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_group_api["API layer"]
  node_node_api["REST API<br/>spring boot entrypoint"]
  node_node_client(("Client<br/>api consumer"))
end

subgraph group_group_app["Application"]
  node_node_login["Login<br/>auth use-case"]
  node_node_fin_use["Finance use cases<br/>business orchestration"]
  node_node_agenda_use["Agenda use cases<br/>business orchestration"]
  node_node_vault_use["Vault use cases<br/>business orchestration"]
end

subgraph group_group_domain["Domain"]
  node_node_fin_dom(("Finance model<br/>domain module"))
  node_node_agenda_dom(("Agenda model<br/>domain module"))
  node_node_vault_dom(("Vault model<br/>domain module"))
  node_node_user_dom(("User model<br/>domain identity"))
end

subgraph group_group_infra["Infrastructure"]
  node_node_repos["Repositories<br/>persistence ports"]
  node_node_jpa["DB adapters"]
end

subgraph group_group_platform["Platform"]
  node_node_auth["Auth filter<br/>jwt security"]
  node_node_crypto{{"Argon2<br/>password hashing"}}
  node_node_flyway["Flyway<br/>db migrations"]
  node_node_mariadb[("MariaDB<br/>relational datastore")]
end

node_node_client -->|"requests"| node_node_api
node_node_api -->|"protects"| node_node_auth
node_node_auth -->|"allows"| node_node_login
node_node_api -->|"login"| node_node_login
node_node_api -->|"finance"| node_node_fin_use
node_node_api -->|"agenda"| node_node_agenda_use
node_node_api -->|"vault"| node_node_vault_use
node_node_login -->|"hashes"| node_node_crypto
node_node_login -->|"authenticates"| node_node_user_dom
node_node_fin_use -->|"applies"| node_node_fin_dom
node_node_agenda_use -->|"applies"| node_node_agenda_dom
node_node_vault_use -->|"applies"| node_node_vault_dom
node_node_fin_use -->|"reads/writes"| node_node_repos
node_node_agenda_use -->|"reads/writes"| node_node_repos
node_node_vault_use -->|"reads/writes"| node_node_repos
node_node_repos -->|"implemented by"| node_node_jpa
node_node_jpa -->|"stores"| node_node_mariadb
node_node_flyway -->|"migrates"| node_node_mariadb
node_node_user_dom -.->|"owns"| node_node_fin_dom
node_node_user_dom -.->|"owns"| node_node_agenda_dom
node_node_user_dom -.->|"owns"| node_node_vault_dom

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_node_api,node_node_client toneBlue
class node_node_login,node_node_fin_use,node_node_agenda_use,node_node_vault_use toneAmber
class node_node_fin_dom,node_node_agenda_dom,node_node_vault_dom,node_node_user_dom toneMint
class node_node_repos,node_node_jpa toneRose
class node_node_auth,node_node_crypto,node_node_flyway,node_node_mariadb toneIndigo
```

## Components

### API layer

HTTP entrypoints and request handling

- **REST API**: spring boot entrypoint · HTTP boundary for client requests and responses
- **Client**: api consumer · External user or frontend consuming the backend

### Application

Use-case orchestration

- **Login**: auth use-case · Authenticates users and issues JWTs
- **Finance use cases**: business orchestration · Coordinates personal finance operations
- **Agenda use cases**: business orchestration · Coordinates scheduling and agenda operations
- **Vault use cases**: business orchestration · Coordinates secure password storage operations

### Domain

Core business rules and models

- **Finance model**: domain module · Rules and entities for transactions and tracking
- **Agenda model**: domain module · Rules and entities for events and scheduling
- **Vault model**: domain module · Rules and entities for stored credentials
- **User model**: domain identity · Authenticated principal and ownership boundary

### Infrastructure

Persistence and technical adapters

- **Repositories**: persistence ports · Domain-facing storage interfaces
- **DB adapters**: maria db adapters · Repository implementations for relational persistence

### Platform

Shared security and runtime services

- **Auth filter**: jwt security · Validates tokens and guards protected routes
- **Argon2**: password hashing · Hashes login credentials and supports security handling
- **Flyway**: db migrations · Applies schema versioning during startup or deployment
- **MariaDB**: relational datastore · Primary persistent store for the application

## Connections

- Client → REST API: requests · Sends API calls to the backend
- REST API → Auth filter: protects · Requests pass through JWT validation
- Auth filter → Login: allows · Authenticated access reaches application logic
- REST API → Login: login · Handles credential submission and token issuance
- REST API → Finance use cases: finance · Routes finance operations to use cases
- REST API → Agenda use cases: agenda · Routes scheduling operations to use cases
- REST API → Vault use cases: vault · Routes password vault operations to use cases
- Login → Argon2: hashes · Uses Argon2 for credential verification and storage
- Login → User model: authenticates · Works with user identity as the access boundary
- Finance use cases → Finance model: applies · Executes finance rules and entity behavior
- Agenda use cases → Agenda model: applies · Executes agenda rules and entity behavior
- Vault use cases → Vault model: applies · Executes vault rules and entity behavior
- Finance use cases → Repositories: reads/writes · Persists finance data through ports
- Agenda use cases → Repositories: reads/writes · Persists agenda data through ports
- Vault use cases → Repositories: reads/writes · Persists vault data through ports
- Repositories → DB adapters: implemented by · Repository contracts are backed by infrastructure adapters
- DB adapters → MariaDB: stores · Reads and writes relational data
- Flyway → MariaDB: migrates · Manages schema evolution in the database
- User model → Finance model: owns · User identity scopes finance data
- User model → Agenda model: owns · User identity scopes agenda data
- User model → Vault model: owns · User identity scopes vault data
