# lea-machado/anotaai architecture

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

- Interactive diagram: https://gitdiagram.com/lea-machado/anotaai
- Repository: https://github.com/lea-machado/anotaai

## Overview

AnotaAI is a student note-taking web app. The implemented workflow is to create, browse, edit, and delete notes, with saved original-content versions and a dashboard of note and character metrics. The browser UI communicates with Spring REST endpoints, whose services apply validation and business logic over JPA repositories and PostgreSQL. Although the README describes AI-generated study aids as a goal and lists Gemini, the supplied source does not establish an implemented AI workflow, so it is not mapped. Frontend request wiring is inferred from the editor source and documented API use; other unsampled links are omitted.

Main entry points: [`AnotaAI/src/main/java/br/com/anotaai/service/AnotacaoService.java`](https://github.com/lea-machado/anotaai/blob/main/AnotaAI/src/main/java/br/com/anotaai/service/AnotacaoService.java) (Note workflow), [`AnotaAI/src/main/resources/static/js/api.js`](https://github.com/lea-machado/anotaai/blob/main/AnotaAI/src/main/resources/static/js/api.js) (API client), [`AnotaAI/src/main/java/br/com/anotaai/controller/AnotacaoController.java`](https://github.com/lea-machado/anotaai/blob/main/AnotaAI/src/main/java/br/com/anotaai/controller/AnotacaoController.java) (Notes endpoints), [`AnotaAI/src/main/java/br/com/anotaai/controller/DesempenhoController.java`](https://github.com/lea-machado/anotaai/blob/main/AnotaAI/src/main/java/br/com/anotaai/controller/DesempenhoController.java) (Metrics endpoint)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_ui["Student interface"]
  node_note_pages["Note pages<br/>[anotacoes.html]"]
  node_editor_page["Editor page<br/>[nova-anotacao.html]"]
  node_metrics_page["Metrics page<br/>[desempenho.html]"]
  node_notes_ui["Notes UI<br/>[anotacoes.js]"]
  node_editor_ui["Editor UI<br/>[editor.js]"]
  node_metrics_ui["Metrics UI<br/>[desempenho.js]"]
  node_api_client["API client<br/>[api.js]"]
end

subgraph group_api["REST API"]
  node_notes_api["Notes endpoints"]
  node_metrics_api["Metrics endpoint"]
  node_error_handler["API errors"]
end

subgraph group_domain["Note services"]
  node_notes_service["Note workflow"]
  node_metrics_service["Metric calculation"]
  node_note_entity["Note entity<br/>[Anotacao.java]"]
  node_version_entity["Version entity"]
end

subgraph group_data["Persistence"]
  node_note_repo["Note repository"]
  node_version_repo["Version repository"]
  node_postgres[("PostgreSQL")]
end

node_student(("Student"))

node_student -->|"uses"| node_note_pages
node_student -->|"uses"| node_editor_page
node_student -->|"uses"| node_metrics_page
node_notes_ui -->|"requests"| node_api_client
node_editor_ui -->|"requests"| node_api_client
node_metrics_ui -->|"requests"| node_api_client
node_api_client -->|"HTTP calls"| node_notes_api
node_api_client -->|"HTTP calls"| node_metrics_api
node_notes_api -->|"dispatches"| node_notes_service
node_metrics_api -->|"dispatches"| node_metrics_service
node_notes_service -->|"reads/writes"| node_note_repo
node_notes_service -->|"stores/reads versions"| node_version_repo
node_metrics_service -->|"reads"| node_note_repo
node_notes_service -->|"validates/updates"| node_note_entity
node_notes_service -->|"creates versions"| node_version_entity
node_metrics_service -->|"counts content"| node_note_entity
node_note_repo -->|"persists notes"| node_postgres
node_version_repo -->|"persists versions"| node_postgres
node_notes_api -->|"exceptions handled"| node_error_handler
node_metrics_api -->|"exceptions handled"| node_error_handler

click node_note_pages "https://github.com/lea-machado/anotaai/blob/main/AnotaAI/src/main/resources/static/pages/anotacoes.html"
click node_editor_page "https://github.com/lea-machado/anotaai/blob/main/AnotaAI/src/main/resources/static/pages/nova-anotacao.html"
click node_metrics_page "https://github.com/lea-machado/anotaai/blob/main/AnotaAI/src/main/resources/static/pages/desempenho.html"
click node_notes_ui "https://github.com/lea-machado/anotaai/blob/main/AnotaAI/src/main/resources/static/js/anotacoes.js"
click node_editor_ui "https://github.com/lea-machado/anotaai/blob/main/AnotaAI/src/main/resources/static/js/editor.js"
click node_metrics_ui "https://github.com/lea-machado/anotaai/blob/main/AnotaAI/src/main/resources/static/js/desempenho.js"
click node_api_client "https://github.com/lea-machado/anotaai/blob/main/AnotaAI/src/main/resources/static/js/api.js"
click node_notes_api "https://github.com/lea-machado/anotaai/blob/main/AnotaAI/src/main/java/br/com/anotaai/controller/AnotacaoController.java"
click node_metrics_api "https://github.com/lea-machado/anotaai/blob/main/AnotaAI/src/main/java/br/com/anotaai/controller/DesempenhoController.java"
click node_error_handler "https://github.com/lea-machado/anotaai/blob/main/AnotaAI/src/main/java/br/com/anotaai/controller/ApiExceptionHandler.java"
click node_notes_service "https://github.com/lea-machado/anotaai/blob/main/AnotaAI/src/main/java/br/com/anotaai/service/AnotacaoService.java"
click node_metrics_service "https://github.com/lea-machado/anotaai/blob/main/AnotaAI/src/main/java/br/com/anotaai/service/DesempenhoService.java"
click node_note_entity "https://github.com/lea-machado/anotaai/blob/main/AnotaAI/src/main/java/br/com/anotaai/model/Anotacao.java"
click node_version_entity "https://github.com/lea-machado/anotaai/blob/main/AnotaAI/src/main/java/br/com/anotaai/model/VersaoAnotacao.java"
click node_note_repo "https://github.com/lea-machado/anotaai/blob/main/AnotaAI/src/main/java/br/com/anotaai/repository/AnotacaoRepository.java"
click node_version_repo "https://github.com/lea-machado/anotaai/blob/main/AnotaAI/src/main/java/br/com/anotaai/repository/VersaoAnotacaoRepository.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_note_pages,node_editor_page,node_metrics_page,node_notes_ui,node_editor_ui,node_metrics_ui,node_api_client toneBlue
class node_notes_api,node_metrics_api,node_error_handler toneAmber
class node_notes_service,node_metrics_service,node_note_entity,node_version_entity toneMint
class node_note_repo,node_version_repo,node_postgres toneRose
class node_student toneIndigo
```

## Components

### Student interface

- [Note pages](https://github.com/lea-machado/anotaai/blob/main/AnotaAI/src/main/resources/static/pages/anotacoes.html): `AnotaAI/src/main/resources/static/pages/anotacoes.html`
- [Editor page](https://github.com/lea-machado/anotaai/blob/main/AnotaAI/src/main/resources/static/pages/nova-anotacao.html): `AnotaAI/src/main/resources/static/pages/nova-anotacao.html`
- [Metrics page](https://github.com/lea-machado/anotaai/blob/main/AnotaAI/src/main/resources/static/pages/desempenho.html): `AnotaAI/src/main/resources/static/pages/desempenho.html`
- [Notes UI](https://github.com/lea-machado/anotaai/blob/main/AnotaAI/src/main/resources/static/js/anotacoes.js): `AnotaAI/src/main/resources/static/js/anotacoes.js`
- [Editor UI](https://github.com/lea-machado/anotaai/blob/main/AnotaAI/src/main/resources/static/js/editor.js): `AnotaAI/src/main/resources/static/js/editor.js`
- [Metrics UI](https://github.com/lea-machado/anotaai/blob/main/AnotaAI/src/main/resources/static/js/desempenho.js): `AnotaAI/src/main/resources/static/js/desempenho.js`
- [API client](https://github.com/lea-machado/anotaai/blob/main/AnotaAI/src/main/resources/static/js/api.js): `AnotaAI/src/main/resources/static/js/api.js`

### REST API

- [Notes endpoints](https://github.com/lea-machado/anotaai/blob/main/AnotaAI/src/main/java/br/com/anotaai/controller/AnotacaoController.java): `AnotaAI/src/main/java/br/com/anotaai/controller/AnotacaoController.java`
- [Metrics endpoint](https://github.com/lea-machado/anotaai/blob/main/AnotaAI/src/main/java/br/com/anotaai/controller/DesempenhoController.java): `AnotaAI/src/main/java/br/com/anotaai/controller/DesempenhoController.java`
- [API errors](https://github.com/lea-machado/anotaai/blob/main/AnotaAI/src/main/java/br/com/anotaai/controller/ApiExceptionHandler.java): `AnotaAI/src/main/java/br/com/anotaai/controller/ApiExceptionHandler.java`

### Note services

- [Note workflow](https://github.com/lea-machado/anotaai/blob/main/AnotaAI/src/main/java/br/com/anotaai/service/AnotacaoService.java): `AnotaAI/src/main/java/br/com/anotaai/service/AnotacaoService.java`
- [Metric calculation](https://github.com/lea-machado/anotaai/blob/main/AnotaAI/src/main/java/br/com/anotaai/service/DesempenhoService.java): `AnotaAI/src/main/java/br/com/anotaai/service/DesempenhoService.java`
- [Note entity](https://github.com/lea-machado/anotaai/blob/main/AnotaAI/src/main/java/br/com/anotaai/model/Anotacao.java): `AnotaAI/src/main/java/br/com/anotaai/model/Anotacao.java`
- [Version entity](https://github.com/lea-machado/anotaai/blob/main/AnotaAI/src/main/java/br/com/anotaai/model/VersaoAnotacao.java): `AnotaAI/src/main/java/br/com/anotaai/model/VersaoAnotacao.java`

### Persistence

- [Note repository](https://github.com/lea-machado/anotaai/blob/main/AnotaAI/src/main/java/br/com/anotaai/repository/AnotacaoRepository.java): `AnotaAI/src/main/java/br/com/anotaai/repository/AnotacaoRepository.java`
- [Version repository](https://github.com/lea-machado/anotaai/blob/main/AnotaAI/src/main/java/br/com/anotaai/repository/VersaoAnotacaoRepository.java): `AnotaAI/src/main/java/br/com/anotaai/repository/VersaoAnotacaoRepository.java`
- **PostgreSQL**

### Other components

- **Student**

## Connections

- Student → Note pages: uses
- Student → Editor page: uses
- Student → Metrics page: uses
- Notes UI → API client: requests
- Editor UI → API client: requests
- Metrics UI → API client: requests
- API client → Notes endpoints: HTTP calls
- API client → Metrics endpoint: HTTP calls
- Notes endpoints → Note workflow: dispatches
- Metrics endpoint → Metric calculation: dispatches
- Note workflow → Note repository: reads/writes
- Note workflow → Version repository: stores/reads versions
- Metric calculation → Note repository: reads
- Note workflow → Note entity: validates/updates
- Note workflow → Version entity: creates versions
- Metric calculation → Note entity: counts content
- Note repository → PostgreSQL: persists notes
- Version repository → PostgreSQL: persists versions
- Notes endpoints → API errors: exceptions handled
- Metrics endpoint → API errors: exceptions handled
