# jmgarridopaz/bluezone architecture

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

- Interactive diagram: https://gitdiagram.com/jmgarridopaz/bluezone
- Repository: https://github.com/jmgarridopaz/bluezone

## Overview

#### Purpose and shape
BlueZone is a Java 11/Maven multi-module example of hexagonal architecture for remote city parking. Drivers obtain rates and purchase tickets; inspectors check whether a car has a valid ticket. The business core is isolated from UI, storage, payment, and rate-provider implementations.

#### Runtime entry and composition
The operational entry point is the startup module, launched by `scripts/run_bluezone.sh`. It selects implementations declared in `scripts/ports-adapters.properties`, creates the application, and injects adapters:
- `src/bluezone-startup/src/main/bluezone.startup/io/github/jmgarridopaz/bluezone/startup/BlueZoneRunner.java`
- `src/bluezone-startup/src/main/bluezone.startup/io/github/jmgarridopaz/bluezone/startup/AdapterSelector.java`
- `src/bluezone-startup/src/main/bluezone.startup/io/github/jmgarridopaz/bluezone/startup/DependencyConfigurator.java`

#### Core application boundary
`bluezone-hexagon` owns use cases, domain orchestration, and port contracts; it must not depend on concrete adapters. `BlueZoneApp` is the core factory/composition-facing API, while configuration is exposed separately.
- `src/bluezone-hexagon/src/main/bluezone.hexagon/io/github/jmgarridopaz/bluezone/hexagon/factory/BlueZoneApp.java`
- `src/bluezone-hexagon/src/main/bluezone.hexagon/io/github/jmgarridopaz/bluezone/hexagon/AppConfigurator.java`
- `src/bluezone-hexagon/src/main/bluezone.hexagon/io/github/jmgarridopaz/bluezone/hexagon/AppFromDrivenSide.java`

#### Parking workflows
`CarParker` implements the driver-facing parking flow: retrieve available rates, accept a purchase request, calculate ticket validity from rate/amount, take payment, and persist the resulting ticket. Its inbound contract is `ForParkingCars`; payment, rates, and persistence cross outbound interfaces rather than concrete dependencies.
- `src/bluezone-hexagon/src/main/bluezone.hexagon/io/github/jmgarridopaz/bluezone/hexagon/CarParker.java`
- `src/bluezone-hexagon/src/main/bluezone.hexagon/io/github/jmgarridopaz/bluezone/hexagon/ports/driving/forparkingcars/ForParkingCars.java`
- `src/bluezone-hexagon/src/main/bluezone.hexagon/io/github/jmgarridopaz/bluezone/hexagon/RateCalculator.java`

#### Inspector workflow
`CarChecker` implements the second inbound use case: determine illegal parking by finding tickets for the car/rate and evaluating their validity against current time.
- `src/bluezone-hexagon/src/main/bluezone.hexagon/io/github/jmgarridopaz/bluezone/hexagon/CarChecker.java`
- `src/bluezone-hexagon/src/main/bluezone.hexagon/io/github/jmgarridopaz/bluezone/hexagon/ports/driving/forcheckingcars/ForCheckingCars.java`
- `src/bluezone-hexagon/src/main/bluezone.hexagon/io/github/jmgarridopaz/bluezone/hexagon/ports/driven/forstoringtickets/Ticket.java`

#### Driven ports and supplied infrastructure
Outbound dependencies are explicit contracts for rates, payments, and tickets. The provided runtime implementations are a stub rate source, payment spy, and fake in-memory-like ticket store; they are replaceable through startup selection.
- `src/bluezone-hexagon/src/main/bluezone.hexagon/io/github/jmgarridopaz/bluezone/hexagon/ports/driven/forobtainingrates/ForObtainingRates.java`
- `src/bluezone-hexagon/src/main/bluezone.hexagon/io/github/jmgarridopaz/bluezone/hexagon/ports/driven/forpaying/ForPaying.java`
- `src/bluezone-hexagon/src/main/bluezone.hexagon/io/github/jmgarridopaz/bluezone/hexagon/ports/driven/forstoringtickets/ForStoringTickets.java`

#### User-facing adapters
The primary interactive adapter is a Spring Boot web UI with MVC controllers and server-rendered templates for rate/ticket operations. It drives the `ForParkingCars` boundary, not core classes directly. A terminal-oriented checking-cars driver exists for inspector use, with test-oriented implementation shown in the repository.
- `src/bluezone-adapter-forparkingcars-webui/src/main/bluezone.adapter.forparkingcars.webui/io/github/jmgarridopaz/bluezone/adapter/forparkingcars/webui/WebUISpringBootApp.java`
- `src/bluezone-adapter-forparkingcars-webui/src/main/bluezone.adapter.forparkingcars.webui/io/github/jmgarridopaz/bluezone/adapter/forparkingcars/webui/PurchaseTicketController.java`
- `src/bluezone-driver-forcheckingcars-test/src/main/bluezone.driver.forcheckingcars.test/io/github/jmgarridopaz/bluezone/driver/forcheckingcars/test/ForCheckingCarsTestDriver.java`

Main entry points: [`src/bluezone-startup/src/main/bluezone.startup/io/github/jmgarridopaz/bluezone/startup/DependencyConfigurator.java`](https://github.com/jmgarridopaz/bluezone/blob/master/src/bluezone-startup/src/main/bluezone.startup/io/github/jmgarridopaz/bluezone/startup/DependencyConfigurator.java) (DependencyConfigurator), [`src/bluezone-hexagon/src/main/bluezone.hexagon/io/github/jmgarridopaz/bluezone/hexagon/CarParker.java`](https://github.com/jmgarridopaz/bluezone/blob/master/src/bluezone-hexagon/src/main/bluezone.hexagon/io/github/jmgarridopaz/bluezone/hexagon/CarParker.java) (CarParker), [`src/bluezone-hexagon/src/main/bluezone.hexagon/io/github/jmgarridopaz/bluezone/hexagon/CarChecker.java`](https://github.com/jmgarridopaz/bluezone/blob/master/src/bluezone-hexagon/src/main/bluezone.hexagon/io/github/jmgarridopaz/bluezone/hexagon/CarChecker.java) (CarChecker), [`src/bluezone-hexagon/src/main/bluezone.hexagon/io/github/jmgarridopaz/bluezone/hexagon/factory/BlueZoneApp.java`](https://github.com/jmgarridopaz/bluezone/blob/master/src/bluezone-hexagon/src/main/bluezone.hexagon/io/github/jmgarridopaz/bluezone/hexagon/factory/BlueZoneApp.java) (BlueZoneApp)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_startup["Startup"]
  node_run_script["Run script<br/>launcher<br/>[run_bluezone.sh]"]
  node_runner["BlueZoneRunner<br/>runtime bootstrap"]
  node_adapter_selector["AdapterSelector<br/>adapter selection"]
  node_dependency_configurator["DependencyConfigurator<br/>composition"]
end

subgraph group_core["Hexagon Core"]
  node_bluezone_app["BlueZoneApp<br/>core factory API<br/>[BlueZoneApp.java]"]
  node_app_configurator["AppConfigurator<br/>core configuration"]
  node_parking_port{{"ForParkingCars<br/>inbound port"}}
  node_car_parker["CarParker<br/>parking use case<br/>[CarParker.java]"]
  node_rate_calculator["RateCalculator<br/>domain service"]
  node_checking_port{{"ForCheckingCars<br/>inbound port"}}
  node_car_checker["CarChecker<br/>inspection use case<br/>[CarChecker.java]"]
  node_rates_port{{"ForObtainingRates<br/>outbound port"}}
  node_payment_port{{"ForPaying<br/>outbound port<br/>[ForPaying.java]"}}
  node_tickets_port{{"ForStoringTickets<br/>outbound port"}}
end

subgraph group_drivers["Driving Adapters"]
  node_web_ui["Spring Boot Web UI<br/>parking driver"]
  node_purchase_controller["PurchaseTicketController<br/>MVC controller"]
  node_inspection_driver["Checking-cars test driver<br/>inspector driver"]
end

subgraph group_infrastructure["Driven Infrastructure"]
  node_rate_source["Stub rate source<br/>rate adapter"]
  node_payment_spy["Payment spy<br/>payment adapter"]
  node_ticket_store[("Fake ticket store<br/>ticket adapter")]
end

node_run_script -->|"launches"| node_runner
node_runner -->|"selects adapters"| node_adapter_selector
node_adapter_selector -->|"provides selections"| node_dependency_configurator
node_dependency_configurator -->|"creates"| node_bluezone_app
node_dependency_configurator -->|"configures"| node_app_configurator
node_bluezone_app -->|"exposes"| node_car_parker
node_bluezone_app -->|"exposes"| node_car_checker
node_purchase_controller -->|"drives"| node_parking_port
node_web_ui -->|"hosts"| node_purchase_controller
node_inspection_driver -->|"drives"| node_checking_port
node_parking_port -->|"implemented by"| node_car_parker
node_checking_port -->|"implemented by"| node_car_checker
node_car_parker -->|"calculates validity"| node_rate_calculator
node_car_parker -->|"obtains rates"| node_rates_port
node_car_parker -->|"takes payment"| node_payment_port
node_car_parker -->|"stores ticket"| node_tickets_port
node_car_checker -->|"finds tickets"| node_tickets_port
node_car_checker -->|"checks rate"| node_rates_port
node_rate_source -.->|"implements"| node_rates_port
node_payment_spy -.->|"implements"| node_payment_port
node_ticket_store -.->|"implements"| node_tickets_port
node_dependency_configurator -->|"injects"| node_rate_source
node_dependency_configurator -->|"injects"| node_payment_spy
node_dependency_configurator -->|"injects"| node_ticket_store

click node_run_script "https://github.com/jmgarridopaz/bluezone/blob/master/scripts/run_bluezone.sh"
click node_runner "https://github.com/jmgarridopaz/bluezone/blob/master/src/bluezone-startup/src/main/bluezone.startup/io/github/jmgarridopaz/bluezone/startup/BlueZoneRunner.java"
click node_adapter_selector "https://github.com/jmgarridopaz/bluezone/blob/master/src/bluezone-startup/src/main/bluezone.startup/io/github/jmgarridopaz/bluezone/startup/AdapterSelector.java"
click node_dependency_configurator "https://github.com/jmgarridopaz/bluezone/blob/master/src/bluezone-startup/src/main/bluezone.startup/io/github/jmgarridopaz/bluezone/startup/DependencyConfigurator.java"
click node_bluezone_app "https://github.com/jmgarridopaz/bluezone/blob/master/src/bluezone-hexagon/src/main/bluezone.hexagon/io/github/jmgarridopaz/bluezone/hexagon/factory/BlueZoneApp.java"
click node_app_configurator "https://github.com/jmgarridopaz/bluezone/blob/master/src/bluezone-hexagon/src/main/bluezone.hexagon/io/github/jmgarridopaz/bluezone/hexagon/AppConfigurator.java"
click node_parking_port "https://github.com/jmgarridopaz/bluezone/blob/master/src/bluezone-hexagon/src/main/bluezone.hexagon/io/github/jmgarridopaz/bluezone/hexagon/ports/driving/forparkingcars/ForParkingCars.java"
click node_car_parker "https://github.com/jmgarridopaz/bluezone/blob/master/src/bluezone-hexagon/src/main/bluezone.hexagon/io/github/jmgarridopaz/bluezone/hexagon/CarParker.java"
click node_rate_calculator "https://github.com/jmgarridopaz/bluezone/blob/master/src/bluezone-hexagon/src/main/bluezone.hexagon/io/github/jmgarridopaz/bluezone/hexagon/RateCalculator.java"
click node_checking_port "https://github.com/jmgarridopaz/bluezone/blob/master/src/bluezone-hexagon/src/main/bluezone.hexagon/io/github/jmgarridopaz/bluezone/hexagon/ports/driving/forcheckingcars/ForCheckingCars.java"
click node_car_checker "https://github.com/jmgarridopaz/bluezone/blob/master/src/bluezone-hexagon/src/main/bluezone.hexagon/io/github/jmgarridopaz/bluezone/hexagon/CarChecker.java"
click node_rates_port "https://github.com/jmgarridopaz/bluezone/blob/master/src/bluezone-hexagon/src/main/bluezone.hexagon/io/github/jmgarridopaz/bluezone/hexagon/ports/driven/forobtainingrates/ForObtainingRates.java"
click node_payment_port "https://github.com/jmgarridopaz/bluezone/blob/master/src/bluezone-hexagon/src/main/bluezone.hexagon/io/github/jmgarridopaz/bluezone/hexagon/ports/driven/forpaying/ForPaying.java"
click node_tickets_port "https://github.com/jmgarridopaz/bluezone/blob/master/src/bluezone-hexagon/src/main/bluezone.hexagon/io/github/jmgarridopaz/bluezone/hexagon/ports/driven/forstoringtickets/ForStoringTickets.java"
click node_web_ui "https://github.com/jmgarridopaz/bluezone/blob/master/src/bluezone-adapter-forparkingcars-webui/src/main/bluezone.adapter.forparkingcars.webui/io/github/jmgarridopaz/bluezone/adapter/forparkingcars/webui/WebUISpringBootApp.java"
click node_purchase_controller "https://github.com/jmgarridopaz/bluezone/blob/master/src/bluezone-adapter-forparkingcars-webui/src/main/bluezone.adapter.forparkingcars.webui/io/github/jmgarridopaz/bluezone/adapter/forparkingcars/webui/PurchaseTicketController.java"
click node_inspection_driver "https://github.com/jmgarridopaz/bluezone/blob/master/src/bluezone-driver-forcheckingcars-test/src/main/bluezone.driver.forcheckingcars.test/io/github/jmgarridopaz/bluezone/driver/forcheckingcars/test/ForCheckingCarsTestDriver.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_run_script,node_runner,node_adapter_selector,node_dependency_configurator toneBlue
class node_bluezone_app,node_app_configurator,node_parking_port,node_car_parker,node_rate_calculator,node_checking_port,node_car_checker,node_rates_port,node_payment_port,node_tickets_port toneAmber
class node_web_ui,node_purchase_controller,node_inspection_driver toneMint
class node_rate_source,node_payment_spy,node_ticket_store toneRose
```

## Components

### Startup

Selects and wires adapters at runtime.

- [Run script](https://github.com/jmgarridopaz/bluezone/blob/master/scripts/run_bluezone.sh): launcher · `scripts/run_bluezone.sh`
- [BlueZoneRunner](https://github.com/jmgarridopaz/bluezone/blob/master/src/bluezone-startup/src/main/bluezone.startup/io/github/jmgarridopaz/bluezone/startup/BlueZoneRunner.java): runtime bootstrap · `src/bluezone-startup/src/main/bluezone.startup/io/github/jmgarridopaz/bluezone/startup/BlueZoneRunner.java`
- [AdapterSelector](https://github.com/jmgarridopaz/bluezone/blob/master/src/bluezone-startup/src/main/bluezone.startup/io/github/jmgarridopaz/bluezone/startup/AdapterSelector.java): adapter selection · `src/bluezone-startup/src/main/bluezone.startup/io/github/jmgarridopaz/bluezone/startup/AdapterSelector.java`
- [DependencyConfigurator](https://github.com/jmgarridopaz/bluezone/blob/master/src/bluezone-startup/src/main/bluezone.startup/io/github/jmgarridopaz/bluezone/startup/DependencyConfigurator.java): composition · `src/bluezone-startup/src/main/bluezone.startup/io/github/jmgarridopaz/bluezone/startup/DependencyConfigurator.java`

### Hexagon Core

Use cases and port contracts, independent of adapters.

- [BlueZoneApp](https://github.com/jmgarridopaz/bluezone/blob/master/src/bluezone-hexagon/src/main/bluezone.hexagon/io/github/jmgarridopaz/bluezone/hexagon/factory/BlueZoneApp.java): core factory API · `src/bluezone-hexagon/src/main/bluezone.hexagon/io/github/jmgarridopaz/bluezone/hexagon/factory/BlueZoneApp.java`
- [AppConfigurator](https://github.com/jmgarridopaz/bluezone/blob/master/src/bluezone-hexagon/src/main/bluezone.hexagon/io/github/jmgarridopaz/bluezone/hexagon/AppConfigurator.java): core configuration · `src/bluezone-hexagon/src/main/bluezone.hexagon/io/github/jmgarridopaz/bluezone/hexagon/AppConfigurator.java`
- [ForParkingCars](https://github.com/jmgarridopaz/bluezone/blob/master/src/bluezone-hexagon/src/main/bluezone.hexagon/io/github/jmgarridopaz/bluezone/hexagon/ports/driving/forparkingcars/ForParkingCars.java): inbound port · `src/bluezone-hexagon/src/main/bluezone.hexagon/io/github/jmgarridopaz/bluezone/hexagon/ports/driving/forparkingcars/ForParkingCars.java`
- [CarParker](https://github.com/jmgarridopaz/bluezone/blob/master/src/bluezone-hexagon/src/main/bluezone.hexagon/io/github/jmgarridopaz/bluezone/hexagon/CarParker.java): parking use case · Gets rates, calculates validity, pays, and stores tickets. · `src/bluezone-hexagon/src/main/bluezone.hexagon/io/github/jmgarridopaz/bluezone/hexagon/CarParker.java`
- [RateCalculator](https://github.com/jmgarridopaz/bluezone/blob/master/src/bluezone-hexagon/src/main/bluezone.hexagon/io/github/jmgarridopaz/bluezone/hexagon/RateCalculator.java): domain service · `src/bluezone-hexagon/src/main/bluezone.hexagon/io/github/jmgarridopaz/bluezone/hexagon/RateCalculator.java`
- [ForCheckingCars](https://github.com/jmgarridopaz/bluezone/blob/master/src/bluezone-hexagon/src/main/bluezone.hexagon/io/github/jmgarridopaz/bluezone/hexagon/ports/driving/forcheckingcars/ForCheckingCars.java): inbound port · `src/bluezone-hexagon/src/main/bluezone.hexagon/io/github/jmgarridopaz/bluezone/hexagon/ports/driving/forcheckingcars/ForCheckingCars.java`
- [CarChecker](https://github.com/jmgarridopaz/bluezone/blob/master/src/bluezone-hexagon/src/main/bluezone.hexagon/io/github/jmgarridopaz/bluezone/hexagon/CarChecker.java): inspection use case · `src/bluezone-hexagon/src/main/bluezone.hexagon/io/github/jmgarridopaz/bluezone/hexagon/CarChecker.java`
- [ForObtainingRates](https://github.com/jmgarridopaz/bluezone/blob/master/src/bluezone-hexagon/src/main/bluezone.hexagon/io/github/jmgarridopaz/bluezone/hexagon/ports/driven/forobtainingrates/ForObtainingRates.java): outbound port · `src/bluezone-hexagon/src/main/bluezone.hexagon/io/github/jmgarridopaz/bluezone/hexagon/ports/driven/forobtainingrates/ForObtainingRates.java`
- [ForPaying](https://github.com/jmgarridopaz/bluezone/blob/master/src/bluezone-hexagon/src/main/bluezone.hexagon/io/github/jmgarridopaz/bluezone/hexagon/ports/driven/forpaying/ForPaying.java): outbound port · `src/bluezone-hexagon/src/main/bluezone.hexagon/io/github/jmgarridopaz/bluezone/hexagon/ports/driven/forpaying/ForPaying.java`
- [ForStoringTickets](https://github.com/jmgarridopaz/bluezone/blob/master/src/bluezone-hexagon/src/main/bluezone.hexagon/io/github/jmgarridopaz/bluezone/hexagon/ports/driven/forstoringtickets/ForStoringTickets.java): outbound port · `src/bluezone-hexagon/src/main/bluezone.hexagon/io/github/jmgarridopaz/bluezone/hexagon/ports/driven/forstoringtickets/ForStoringTickets.java`

### Driving Adapters

User-facing parking and inspection entry points.

- [Spring Boot Web UI](https://github.com/jmgarridopaz/bluezone/blob/master/src/bluezone-adapter-forparkingcars-webui/src/main/bluezone.adapter.forparkingcars.webui/io/github/jmgarridopaz/bluezone/adapter/forparkingcars/webui/WebUISpringBootApp.java): parking driver · MVC rate and ticket interface. · `src/bluezone-adapter-forparkingcars-webui/src/main/bluezone.adapter.forparkingcars.webui/io/github/jmgarridopaz/bluezone/adapter/forparkingcars/webui/WebUISpringBootApp.java`
- [PurchaseTicketController](https://github.com/jmgarridopaz/bluezone/blob/master/src/bluezone-adapter-forparkingcars-webui/src/main/bluezone.adapter.forparkingcars.webui/io/github/jmgarridopaz/bluezone/adapter/forparkingcars/webui/PurchaseTicketController.java): MVC controller · `src/bluezone-adapter-forparkingcars-webui/src/main/bluezone.adapter.forparkingcars.webui/io/github/jmgarridopaz/bluezone/adapter/forparkingcars/webui/PurchaseTicketController.java`
- [Checking-cars test driver](https://github.com/jmgarridopaz/bluezone/blob/master/src/bluezone-driver-forcheckingcars-test/src/main/bluezone.driver.forcheckingcars.test/io/github/jmgarridopaz/bluezone/driver/forcheckingcars/test/ForCheckingCarsTestDriver.java): inspector driver · Terminal-oriented inspection driver. · `src/bluezone-driver-forcheckingcars-test/src/main/bluezone.driver.forcheckingcars.test/io/github/jmgarridopaz/bluezone/driver/forcheckingcars/test/ForCheckingCarsTestDriver.java`

### Driven Infrastructure

Replaceable rate, payment, and ticket implementations.

- **Stub rate source**: rate adapter
- **Payment spy**: payment adapter
- **Fake ticket store**: ticket adapter · In-memory-like ticket persistence.

## Connections

- Run script → BlueZoneRunner: launches
- BlueZoneRunner → AdapterSelector: selects adapters
- AdapterSelector → DependencyConfigurator: provides selections
- DependencyConfigurator → BlueZoneApp: creates
- DependencyConfigurator → AppConfigurator: configures
- BlueZoneApp → CarParker: exposes
- BlueZoneApp → CarChecker: exposes
- PurchaseTicketController → ForParkingCars: drives
- Spring Boot Web UI → PurchaseTicketController: hosts
- Checking-cars test driver → ForCheckingCars: drives
- ForParkingCars → CarParker: implemented by
- ForCheckingCars → CarChecker: implemented by
- CarParker → RateCalculator: calculates validity
- CarParker → ForObtainingRates: obtains rates
- CarParker → ForPaying: takes payment
- CarParker → ForStoringTickets: stores ticket
- CarChecker → ForStoringTickets: finds tickets
- CarChecker → ForObtainingRates: checks rate
- Stub rate source → ForObtainingRates: implements
- Payment spy → ForPaying: implements
- Fake ticket store → ForStoringTickets: implements
- DependencyConfigurator → Stub rate source: injects
- DependencyConfigurator → Payment spy: injects
- DependencyConfigurator → Fake ticket store: injects
