# emiliom1983/delivery_app architecture

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

- Interactive diagram: https://gitdiagram.com/emiliom1983/delivery_app
- Repository: https://github.com/emiliom1983/delivery_app

## Overview

##### Project Type and Purpose
- This is a Java console‐based, layered “delivery-app” that simulates a food delivery platform.
- It is organized as a simple three‐tier system:
- Presentation (console UI)
- Business logic (services)
- Data access (repositories + MySQL)

##### File Structure Analysis
- Top-level:
- pom.xml – Maven build file
- README.md – Project description, GitFlow guidelines, module structure
- sql/ – DDL scripts and ER model for MySQL
- src/main/java/org/IngSoft/
– database/ – JDBC connection class
– models/ – POJOs (Client, Dealer, Order, Product, etc.)
– (expected but not yet present) repositories/, services/, ui/ per README

##### Key Insights from README
- The team follows GitFlow with branches for features (authentication, menus, orders, etc.).
- Directories to exist: database, models, repositories (DAO), services (business logic), ui (console interaction).
- The SQL folder holds the database creation and sample data scripts.

##### Core Components
a. Console UI Module (“ui”)
- Handles user prompts, reads input, displays output.
b. Service Layer (“services”)
- Implements business use cases (place order, process payment, track delivery).
c. Repository Layer (“repositories” / DAO)
- Encapsulates SQL/JDBC operations against MySQL (insert, update, queries).
d. Database Connection Module (“database/Conexion.java”)
- Single JDBC connector class reading credentials, providing Connection objects.
e. Domain Models (“models”)
- POJOs representing Clients, Orders, Payments, Products, Delivery, etc.
f. External System – MySQL Database
- Scripted schema + sample data in sql/*.sql

##### Relationships and Interactions
- UI → invokes → Service methods
- Service → uses → Repository DAOs
- Repository → calls → JDBC Connection → executes SQL on MySQL
- Models flow as method parameters/return types between all layers

##### Architectural Patterns and Principles
- Layered Architecture (Presentation → Business → Data Access)
- DAO Pattern in repositories to isolate SQL from business logic
- Single Responsibility for each package
- POJOs for data transfer (no logic in models)

##### Technologies and Frameworks
- Java (Maven project)
- JDBC (java.sql) for DB connectivity
- MySQL as relational database (scripts under sql/)
- Console I/O (java.util.Scanner or similar)
- Optional future: JUnit for tests, logging frameworks

##### Detailed Elements
- Component Blocks:
[Main.java / Launcher]
[org.IngSoft.ui.ConsoleUI]
[org.IngSoft.services.*Service]
[org.IngSoft.repositories.*DAO]
[org.IngSoft.database.Conexion]
[MySQL Database (sql schema & data)]
- Main → Conexion → MySQL
- ConsoleUI → Service methods → DAO → JDBC → MySQL → back up the chain
- Annotations:
- Package paths inside each block
- SQL scripts location (sql/Crea_db.sql) as initialization step

## Diagram (Mermaid)

```mermaid
flowchart TB
    %% Runtime Components
    subgraph "Runtime"
        direction TB
        Main["Main.java"]:::module
        ConsoleUI["ConsoleUI\n(org.IngSoft.ui)"]:::module
        Services["Services Layer\n(org.IngSoft.services.*Service)"]:::module
        Repositories["Repository Layer\n(org.IngSoft.repositories.*DAO)"]:::module
        Conexion["Conexion.java\n(org.IngSoft.database)"]:::module
        MySQL["MySQL Database"]:::db
        Models["Domain Models\n(org.IngSoft.models)"]:::module
    end

    %% Project Artifacts
    subgraph "Project Artifacts"
        direction TB
        POM["pom.xml"]:::artifact
        README["README.md"]:::artifact
        SQL["sql/ Scripts"]:::artifact
    end

    %% Data Flow
    Main -->|"initialize()"| Conexion
    Conexion -->|"getConnection()"| MySQL
    Main -->|"start UI loop"| ConsoleUI
    ConsoleUI -->|"invoke use cases"| Services
    Services -->|"uses DAOs"| Repositories
    Repositories -->|"execute SQL"| Conexion
    Services -->|"passes POJOs"| Models
    Repositories -->|"maps to POJOs"| Models

    %% Project Artifacts Associations
    POM -->|defines| Main
    README -->|guides| ConsoleUI
    SQL -->|schema & data| MySQL

    %% Click Events
    click Main "https://github.com/emiliom1983/delivery_app/blob/main/src/main/java/org/IngSoft/Main.java"
    click Conexion "https://github.com/emiliom1983/delivery_app/blob/main/src/main/java/org/IngSoft/database/Conexion.java"
    click Models "https://github.com/emiliom1983/delivery_app/tree/main/src/main/java/org/IngSoft/models/"
    click SQL "https://github.com/emiliom1983/delivery_app/blob/main/sql/Crea_db.sql"
    click POM "https://github.com/emiliom1983/delivery_app/blob/main/pom.xml"
    click README "https://github.com/emiliom1983/delivery_app/blob/main/README.md"

    %% Styles
    classDef module fill:#add8e6,stroke:#000,stroke-width:1px
    classDef db fill:#ffcc80,stroke:#000,stroke-width:1px
    classDef artifact fill:#e0e0e0,stroke:#000,stroke-width:1px
```
