# eramis152/proyecto-sepa architecture

> Architecture diagram of the GitHub repository eramis152/proyecto-sepa, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2025-05-14). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/eramis152/proyecto-sepa
- Repository: https://github.com/eramis152/proyecto-sepa

## Overview

##### Project type and purpose
- Proyecto-SEPA is a full-stack web application whose sole business function is to convert transaction data acquired from an external web page into a SEPA-compliant XML file.
- The backend is a Spring Boot microservice (Java 17+) exposing a REST endpoint; the frontend is an Angular single-page application (SPA) that calls that endpoint.

##### File structure
- Top-level directories:
- src/main/java/com/sepa/back_end – contains the Spring Boot application class, REST controllers, CORS config, entity models, and XML generator utilities.
- src/main/java/com/sepa/front_end – contains the Angular project (package.json, tsconfig.json, src/app/components, services, routing, styles).
- xml – target folder where the generated XML is written.
- target – Maven build output (back_end.jar) and compiled frontend assets packaged inside the JAR.
- doc/documentation – JavaDoc and PDF user manual.
- Configuration files: pom.xml (Maven), angular.json, package.json, shell/batch scripts to install dependencies and start each service.

##### Main components
a. User Web Browser (Angular SPA)
b. Frontend App Server (Node runtime hosting Angular dev server) – optional in dev
c. REST API Backend (Spring Boot Application)
d. XML Generator Module (XmlGenerator utility)
e. File Store (xml/info.xml folder)
f. External Validation Service (third-party SEPA validator)

##### Relationships and data flows
1. User interacts with the Angular SPA in the browser (HTTP(S) requests).
2. SPA calls the Spring Boot REST endpoint (/transactions) via HTTP, subject to CORS (WebConfig).
3. TransactionController processes the request, maps to Transaction entity, and delegates to XmlGenerator.
4. XmlGenerator writes the SEPA XML file into the local xml/ directory.
5. User downloads or retrieves the XML from the backend (or directly from the xml/ folder).
6. User submits the XML to the external validation service.

##### Architectural patterns and technologies
- SPA + REST API separation
- MVC on the backend: Controller (TransactionController), Model (Transaction entity), Utility (XmlGenerator)
- CORS configuration for cross-origin calls
- Build tools: Maven (backend), npm/Node (frontend)
- Packaging: the Angular build is bundled into the Spring Boot JAR under resources/static for production.

4. Inside the API rectangle, subdivide into:
- Controllers (TransactionController)
- Entities (Transaction)
- Utils (XmlGenerator)
- CORS Config (WebConfig)

## Diagram (Mermaid)

```mermaid
flowchart TD
    %% User and Front End
    User[(User Browser)]:::external
    subgraph "Front End"
        Angular["Angular SPA"]:::frontend
        PkgJson["package.json"]:::frontend
        AngConf["angular.json"]:::frontend
        StartFront["z4_start_front.bat"]:::tool
    end
    User -->|"Interacts with"| Angular

    %% Front End to Back End
    Angular -->|"HTTPS REST call"| SpringAPI

    %% Back End components
    subgraph "Back End"
        SpringAPI["Spring Boot REST API"]:::backend
        subgraph Controllers
            TC["TransactionController"]:::backend
        end
        subgraph Entities
            Transaction["Transaction Entity"]:::backend
        end
        subgraph Utils
            XmlGen["XmlGenerator"]:::backend
        end
        WebConfig["WebConfig (CORS)"]:::backend
    end
    SpringAPI --> TC
    TC --> Transaction
    TC --> XmlGen
    TC --> WebConfig

    %% Storage and External Service
    XmlGen --> FileStore
    FileStore["XML File Store\n(xml/)"]:::storage
    FileStore -->|"Submit XML"| Validator
    Validator["SEPA Validation Service"]:::external

    %% Build tools
    Npm["Node/NPM"]:::tool
    Maven["Maven"]:::tool
    Npm --> Angular
    Maven --> SpringAPI
    Maven -->|"uses"| Pom["pom.xml"]:::tool
    Maven -->|"scripts"| StartBack["z3_start_back.bat"]:::tool

    %% Click Events
    click Angular "https://github.com/eramis152/proyecto-sepa/tree/proyecto-reorg/src/main/java/com/sepa/front_end"
    click PkgJson "https://github.com/eramis152/proyecto-sepa/blob/proyecto-reorg/src/main/java/com/sepa/front_end/package.json"
    click AngConf "https://github.com/eramis152/proyecto-sepa/blob/proyecto-reorg/src/main/java/com/sepa/front_end/angular.json"
    click SpringAPI "https://github.com/eramis152/proyecto-sepa/blob/proyecto-reorg/src/main/java/com/sepa/back_end/BackEndApplication.java"
    click TC "https://github.com/eramis152/proyecto-sepa/blob/proyecto-reorg/src/main/java/com/sepa/back_end/controllers/TransactionController.java"
    click WebConfig "https://github.com/eramis152/proyecto-sepa/blob/proyecto-reorg/src/main/java/com/sepa/back_end/cors/WebConfig.java"
    click Transaction "https://github.com/eramis152/proyecto-sepa/blob/proyecto-reorg/src/main/java/com/sepa/back_end/entities/Transaction.java"
    click XmlGen "https://github.com/eramis152/proyecto-sepa/blob/proyecto-reorg/src/main/java/com/sepa/back_end/util/XmlGenerator.java"
    click FileStore "https://github.com/eramis152/proyecto-sepa/tree/proyecto-reorg/xml/"
    click Pom "https://github.com/eramis152/proyecto-sepa/blob/proyecto-reorg/pom.xml"
    click StartFront "https://github.com/eramis152/proyecto-sepa/blob/proyecto-reorg/z4_start_front.bat"
    click StartBack "https://github.com/eramis152/proyecto-sepa/blob/proyecto-reorg/z3_start_back.bat"

    %% Styles
    classDef frontend fill:#87CEEB,stroke:#333,stroke-width:1px;
    classDef backend fill:#98FB98,stroke:#333,stroke-width:1px;
    classDef storage fill:#D3D3D3,stroke:#333,stroke-width:1px;
    classDef external fill:#FFA500,stroke:#333,stroke-width:1px;
    classDef tool fill:#FFD700,stroke:#333,stroke-width:1px;
```
