# gustavodejesus/mentoria-java architecture

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

- Interactive diagram: https://gitdiagram.com/gustavodejesus/mentoria-java
- Repository: https://github.com/gustavodejesus/mentoria-java

## Overview

##### Project type and purpose
- This is a desktop Java application built with JavaFX. It serves as a teaching platform (“Mentoria Java”) where students build a CRUD‐style desktop app covering clients, products, orders, coupons, payment methods, vendors, and pets.
- It uses Maven for build and dependency management, JavaFX for UI, plain Java domain/model classes for business logic, and a simple relational database accessed via a custom DataSource class.

##### File structure
- Top‐level:
- pom.xml, mvnw scripts – Maven build/configuration
- scripts/ – helpers to install JavaFX on each OS
- src/main/java/br/com/mentoriajava/… – code organized by feature packages:
– base (common domain classes: Pessoa, Endereco, CPF validation)
– clientes, cupons, formaspagamento, pedido, produtos, vendedores, exemplo (Pet)
– database (PetDataSource)
– HomeApp.java & PedidoApp.java – main application entry points
- There's no separate “service” or “controller” packages; the JavaFX Screen classes (e.g., ClientesScreen.java) serve both as controllers and views.
- Only one DataSource class suggests a lightweight persistence layer.

##### README for additional insights
- Confirms Java 23+, JavaFX, Maven, relational DB.
- Emphasizes JavaFX VM options, but that only affects local setup, not runtime architecture.

##### Detailed capture of essential elements
- Model classes under “Domain Model” with sub-groups (base, clientes, cupons, etc.)
- PetDataSource as the representative of persistence; note that additional DataSources would slot here
- Maven lifecycle (Compile → Test → Package) feeding into a runnable JAR with JavaFX modules attached

## Diagram (Mermaid)

```mermaid
flowchart TB
    %% Global actor
    User["User"]:::external

    %% Presentation Layer
    subgraph "JavaFX UI" 
        direction TB
        HomeApp["HomeApp"]:::frontend
        PedidoApp["PedidoApp"]:::frontend
        ClientesScreen["ClientesScreen"]:::frontend
        CuponsScreen["CuponsScreen"]:::frontend
        FormaPagamentoScreen["FormaPagamentoScreen"]:::frontend
        PedidosScreen["PedidosScreen"]:::frontend
        ProdutosScreen["ProdutosScreen"]:::frontend
        VendedoresScreen["VendedoresScreen"]:::frontend
        PetScreen["PetScreen"]:::frontend
    end

    %% Domain Layer
    subgraph "Domain Model"
        direction TB
        Pessoa["Pessoa"]:::domain
        Endereco["Endereco"]:::domain
        ValidaCPF["ValidaCPF"]:::domain
        ValidarCamposObrigatorios["ValidarCamposObrigatorios"]:::domain
        Cliente["Cliente"]:::domain
        StatusCivilEnum["StatusCivilEnum"]:::domain
        CupomDeDesconto["CupomDeDesconto"]:::domain
        FormaDePagamento["FormaDePagamento"]:::domain
        TiposDePagamentos["TiposDePagamentos"]:::domain
        Vendedor["Vendedor"]:::domain
        Pet["Pet"]:::domain
        Entrega["Entrega"]:::domain
    end

    %% Persistence Layer
    subgraph "Persistence"
        direction TB
        PetDataSource["PetDataSource"]:::persistence
    end

    %% External Database
    Database[(Relational Database)]:::external

    %% Build & Deployment
    subgraph "Build & Deployment"
        direction TB
        MavenPOM["pom.xml"]:::external
        MavenWrapper["mvnw / mvnw.cmd / .mvn"]:::external
        Scripts["install-openjfx scripts"]:::external
        README["README.md"]:::external
    end

    %% Connections
    User -->|"interacts with"| HomeApp
    User -->|"interacts with"| PedidoApp

    HomeApp -->|"opens screens"| ClientesScreen
    HomeApp -->|"opens screens"| CuponsScreen
    HomeApp -->|"opens screens"| FormaPagamentoScreen
    HomeApp -->|"opens screens"| PedidosScreen
    HomeApp -->|"opens screens"| ProdutosScreen
    HomeApp -->|"opens screens"| VendedoresScreen
    HomeApp -->|"opens screens"| PetScreen

    PedidoApp -->|"opens screens"| PedidosScreen

    ClientesScreen -->|"uses models"| Cliente
    ClientesScreen -->|"uses models"| Pessoa
    ClientesScreen -->|"validates via"| ValidaCPF
    ClientesScreen -->|"validates via"| ValidarCamposObrigatorios

    CuponsScreen -->|"uses models"| CupomDeDesconto
    FormaPagamentoScreen -->|"uses models"| FormaDePagamento
    FormaPagamentoScreen -->|"uses models"| TiposDePagamentos
    VendedoresScreen -->|"uses models"| Vendedor
    PetScreen -->|"uses models"| Pet
    PedidosScreen -->|"uses models"| Entrega

    %% UI to Persistence
    ClientesScreen -->|"CRUD via"| PetDataSource
    CuponsScreen -->|"CRUD via"| PetDataSource
    FormaPagamentoScreen -->|"CRUD via"| PetDataSource
    PedidosScreen -->|"CRUD via"| PetDataSource
    ProdutosScreen -->|"CRUD via"| PetDataSource
    VendedoresScreen -->|"CRUD via"| PetDataSource
    PetScreen -->|"CRUD via"| PetDataSource

    %% Persistence to DB
    PetDataSource -->|"JDBC"| Database

    %% Build pipeline
    MavenPOM -->|"defines build"| MavenWrapper
    MavenWrapper -->|"executes scripts"| Scripts
    MavenWrapper -->|"packages app"| HomeApp
    MavenWrapper -->|"packages app"| PedidoApp

    %% Click Events
    click HomeApp "https://github.com/gustavodejesus/mentoria-java/blob/main/src/main/java/br/com/mentoriajava/home/HomeApp.java"
    click PedidoApp "https://github.com/gustavodejesus/mentoria-java/blob/main/src/main/java/br/com/mentoriajava/PedidoApp.java"
    click ClientesScreen "https://github.com/gustavodejesus/mentoria-java/blob/main/src/main/java/br/com/mentoriajava/clientes/ClientesScreen.java"
    click CuponsScreen "https://github.com/gustavodejesus/mentoria-java/blob/main/src/main/java/br/com/mentoriajava/cupons/CuponsScreen.java"
    click FormaPagamentoScreen "https://github.com/gustavodejesus/mentoria-java/blob/main/src/main/java/br/com/mentoriajava/formaspagamento/FormaPagamentoScreen.java"
    click PedidosScreen "https://github.com/gustavodejesus/mentoria-java/blob/main/src/main/java/br/com/mentoriajava/pedido/PedidosScreen.java"
    click ProdutosScreen "https://github.com/gustavodejesus/mentoria-java/blob/main/src/main/java/br/com/mentoriajava/produtos/ProdutosScreen.java"
    click VendedoresScreen "https://github.com/gustavodejesus/mentoria-java/blob/main/src/main/java/br/com/mentoriajava/vendedores/VendedoresScreen.java"
    click PetScreen "https://github.com/gustavodejesus/mentoria-java/blob/main/src/main/java/br/com/mentoriajava/exemplo/PetScreen.java"
    click Pessoa "https://github.com/gustavodejesus/mentoria-java/blob/main/src/main/java/br/com/mentoriajava/base/Pessoa.java"
    click Endereco "https://github.com/gustavodejesus/mentoria-java/blob/main/src/main/java/br/com/mentoriajava/base/Endereco.java"
    click ValidaCPF "https://github.com/gustavodejesus/mentoria-java/blob/main/src/main/java/br/com/mentoriajava/base/ValidaCPF.java"
    click ValidarCamposObrigatorios "https://github.com/gustavodejesus/mentoria-java/blob/main/src/main/java/br/com/mentoriajava/base/ValidarCamposObrigatorios.java"
    click Cliente "https://github.com/gustavodejesus/mentoria-java/blob/main/src/main/java/br/com/mentoriajava/clientes/Cliente.java"
    click StatusCivilEnum "https://github.com/gustavodejesus/mentoria-java/blob/main/src/main/java/br/com/mentoriajava/clientes/StatusCivilEnum.java"
    click CupomDeDesconto "https://github.com/gustavodejesus/mentoria-java/blob/main/src/main/java/br/com/mentoriajava/cupons/CupomDeDesconto.java"
    click FormaDePagamento "https://github.com/gustavodejesus/mentoria-java/blob/main/src/main/java/br/com/mentoriajava/formaspagamento/FormaDePagamento.java"
    click TiposDePagamentos "https://github.com/gustavodejesus/mentoria-java/blob/main/src/main/java/br/com/mentoriajava/formaspagamento/TiposDePagamentos.java"
    click Vendedor "https://github.com/gustavodejesus/mentoria-java/blob/main/src/main/java/br/com/mentoriajava/vendedores/Vendedor.java"
    click Pet "https://github.com/gustavodejesus/mentoria-java/blob/main/src/main/java/br/com/mentoriajava/exemplo/Pet.java"
    click Entrega "https://github.com/gustavodejesus/mentoria-java/blob/main/src/main/java/br/com/mentoriajava/pedido/Entrega.java"
    click PetDataSource "https://github.com/gustavodejesus/mentoria-java/blob/main/src/main/java/br/com/mentoriajava/database/PetDataSource.java"
    click MavenPOM "https://github.com/gustavodejesus/mentoria-java/blob/main/pom.xml"
    click MavenWrapper "https://github.com/gustavodejesus/mentoria-java/tree/main/mvnw"
    click Scripts "https://github.com/gustavodejesus/mentoria-java/blob/main/scripts/install-openjfx.ps1"
    click README "https://github.com/gustavodejesus/mentoria-java/blob/main/README.md"

    %% Styles
    classDef frontend fill:#ADD8E6,stroke:#333,stroke-width:1px
    classDef domain fill:#90EE90,stroke:#333,stroke-width:1px
    classDef persistence fill:#FFA500,stroke:#333,stroke-width:1px
    classDef external fill:#D3D3D3,stroke:#333,stroke-width:1px
```
