# klap-s/noevo-backend-api architecture

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

- Interactive diagram: https://gitdiagram.com/klap-s/noevo-backend-api
- Repository: https://github.com/klap-s/noevo-backend-api

## Overview

##### Project Type and Purpose
- This is a standalone backend service (“Backend – NOEVO”) built with Spring Boot and Java 17.
- Its role is to expose REST endpoints that handle user, conversation, message, and AI-related operations, persist data in a MySQL database via JPA, and relay requests to external voice-to-text and text-to-voice APIs.

##### File Structure Analysis
- src/main/java/noevo/controller – REST Controllers
- src/main/java/noevo/service/interfaces & implement – Business-logic interfaces and implementations
- src/main/java/noevo/repository – Spring Data JPA repositories for persistence
- src/main/java/noevo/model – JPA Entity classes
- src/main/resources/application.properties – DB and server configuration
- Test folder under src/test for unit/integration tests

This clearly follows a layered architecture:
- API layer (Controllers)
- Service layer (Interfaces + Implementations)
- Data access layer (Repositories)
- Persistence (MySQL)
- External integration (voice/text APIs)

##### Key README Insights
- Describes Spring Boot + Java stack
- MySQL as the database
- Connects to two external services: voice→text and text→voice
- Runs on port 8080

##### Main Components
a. Client(s)
- Mobile or Web front end (not in this repo)
- Test clients (Postman, automated tests)
b. API Layer
- ConversacionController, MensajeController, UsuarioController, IAController
c. Service Layer
- IAServiceImpl, UsuarioServiceImpl, MensajeServiceImpl, ConversacionServiceImpl
d. Persistence Layer
- JPA Repositories (IARepository, UsuarioRepository, MensajeRepository, ConversacionRepository)
- MySQL Database (logical schema of User, Message, Conversation, IA tables)
e. External Services
- Voice-to-Text API (e.g., Google Speech-to-Text)
- Text-to-Voice API (e.g., AWS Polly)

##### Relationships and Data Flows
- Client → HTTP requests → Controllers
- Controllers → invoke Service interfaces → Service implementations
- Service implementations → read/write via Repositories → MySQL
- Service implementations → call external voice APIs → get/return audio/text data
- Controllers → return JSON (or audio binary) → Client

##### Architectural Patterns & Principles
- Layered architecture (controller → service → repository → DB)
- Dependency inversion via service interfaces
- Single responsibility: each layer has a distinct concern
- Spring-managed beans and annotations for wiring

##### Elements
- Clear labels for each component (e.g., ConversacionController)
- Rectangles for code modules (controllers, services, repos)

##### Tooling and Detail Recommendations
- Ports (8080) and protocols (HTTP, JDBC, REST)
- Data model as an ER overlay or separate inset
- Version notes (Java 17, Spring Boot) in a corner

## Diagram (Mermaid)

```mermaid
flowchart TB
    %% Clients
    subgraph Clients
        Web["Web/Mobile Client"]:::client
        Test["Postman/Test Clients"]:::client
    end

    %% Entry Point
    BA["BackendApplication"]:::app

    %% API Layer
    subgraph "API Layer"
        CC["ConversacionController"]:::controller
        MC["MensajeController"]:::controller
        UC["UsuarioController"]:::controller
        IAC["IAController"]:::controller
    end

    %% Service Layer
    subgraph "Service Layer"
        CSI["ConversacionService"]:::service
        IS["IAService"]:::service
        MS["MensajesService"]:::service
        US["UsuarioService"]:::service
        CSImp["ConversacionServiceImpl"]:::service
        ISImp["IAServiceImpl"]:::service
        MSImp["MensajeServiceImpl"]:::service
        USImp["UsuarioServiceImpl"]:::service
    end

    %% Data Access Layer
    subgraph "Data Access Layer"
        CRepo["ConversacionRepository"]:::repo
        IRepo["IARepository"]:::repo
        MRepo["MensajeRepository"]:::repo
        URepo["UsuarioRepository"]:::repo
    end

    %% Persistence
    DB["MySQL Database"]:::database

    %% External Services
    cloud1["Voice-to-Text API"]:::external
    cloud2["Text-to-Voice API"]:::external

    %% Relationships
    Web -->|HTTP/REST| CC
    Web -->|HTTP/REST| MC
    Web -->|HTTP/REST| UC
    Web -->|HTTP/REST| IAC
    Test -->|HTTP/REST| CC
    Test -->|HTTP/REST| MC
    Test -->|HTTP/REST| UC
    Test -->|HTTP/REST| IAC

    BA --> CC
    BA --> MC
    BA --> UC
    BA --> IAC

    CC -->|uses| CSImp
    MC -->|uses| MSImp
    UC -->|uses| USImp
    IAC -->|uses| ISImp

    CSImp -->|calls| CRepo
    MSImp -->|calls| MRepo
    USImp -->|calls| URepo
    ISImp -->|calls| IRepo

    CRepo -->|JPA| DB
    MRepo -->|JPA| DB
    URepo -->|JPA| DB
    IRepo -->|JPA| DB

    ISImp -->|REST| cloud1
    ISImp -->|REST| cloud2
    CSImp -->|REST| cloud1
    CSImp -->|REST| cloud2
    MSImp -->|REST| cloud1
    MSImp -->|REST| cloud2
    USImp -->|REST| cloud1
    USImp -->|REST| cloud2

    %% Click Events
    click BA "https://github.com/klap-s/noevo-backend-api/blob/main/src/main/java/noevo/BackendApplication.java"
    click CC "https://github.com/klap-s/noevo-backend-api/blob/main/src/main/java/noevo/controller/ConversacionController.java"
    click MC "https://github.com/klap-s/noevo-backend-api/blob/main/src/main/java/noevo/controller/MensajeController.java"
    click UC "https://github.com/klap-s/noevo-backend-api/blob/main/src/main/java/noevo/controller/UsuarioController.java"
    click IAC "https://github.com/klap-s/noevo-backend-api/blob/main/src/main/java/noevo/controller/IAController.java"
    click CSI "https://github.com/klap-s/noevo-backend-api/blob/main/src/main/java/noevo/service/interfaces/ConversacionService.java"
    click IS "https://github.com/klap-s/noevo-backend-api/blob/main/src/main/java/noevo/service/interfaces/IAService.java"
    click MS "https://github.com/klap-s/noevo-backend-api/blob/main/src/main/java/noevo/service/interfaces/MensajesService.java"
    click US "https://github.com/klap-s/noevo-backend-api/blob/main/src/main/java/noevo/service/interfaces/UsuarioService.java"
    click CSImp "https://github.com/klap-s/noevo-backend-api/blob/main/src/main/java/noevo/service/implement/ConversacionServiceImpl.java"
    click ISImp "https://github.com/klap-s/noevo-backend-api/blob/main/src/main/java/noevo/service/implement/IAServiceImpl.java"
    click MSImp "https://github.com/klap-s/noevo-backend-api/blob/main/src/main/java/noevo/service/implement/MensajeServiceImpl.java"
    click USImp "https://github.com/klap-s/noevo-backend-api/blob/main/src/main/java/noevo/service/implement/UsuarioServiceImpl.java"
    click CRepo "https://github.com/klap-s/noevo-backend-api/blob/main/src/main/java/noevo/repository/ConversacionRepository.java"
    click IRepo "https://github.com/klap-s/noevo-backend-api/blob/main/src/main/java/noevo/repository/IARepository.java"
    click MRepo "https://github.com/klap-s/noevo-backend-api/blob/main/src/main/java/noevo/repository/MensajeRepository.java"
    click URepo "https://github.com/klap-s/noevo-backend-api/blob/main/src/main/java/noevo/repository/UsuarioRepository.java"
    click DB "https://github.com/klap-s/noevo-backend-api/blob/main/src/main/resources/application.properties"

    %% Styles
    classDef client fill:#E8F5E9,stroke:#2E7D32,color:#2E7D32;
    classDef app fill:#E3F2FD,stroke:#1565C0,color:#1565C0;
    classDef controller fill:#BBDEFB,stroke:#0D47A1,color:#0D47A1;
    classDef service fill:#C8E6C9,stroke:#1B5E20,color:#1B5E20;
    classDef repo fill:#FFE0B2,stroke:#E65100,color:#E65100;
    classDef database fill:#F3E5F5,stroke:#6A1B9A,color:#6A1B9A,stroke-dasharray: 5 5;
    classDef external fill:#ECEFF1,stroke:#455A64,color:#455A64,stroke-dasharray: 2 2;
```
