# thaisodupe-coder/auctionsystem architecture

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

- Interactive diagram: https://gitdiagram.com/thaisodupe-coder/auctionsystem
- Repository: https://github.com/thaisodupe-coder/auctionsystem

## Overview

1. **Overall shape**
   This is a **Java desktop client-server auction system**. The runtime splits into a **JavaFX client**, a **socket-based backend server**, and a **PostgreSQL database** running in Docker. The server owns the business rules and persistence; the client is mostly UI plus network request/response handling.

2. **Runtime boundaries**
   The client and server are started separately, which is reflected in the codebase:
   - `AppClient` / `Launcher` boot the JavaFX UI.
   - `AuctionServer` bootstraps the backend socket listener.
   - Shell/batch scripts and Maven goals wrap startup on different OSes.
   This separation is the main architectural boundary in the repository.

3. **UI layer**
   The frontend lives under `controller/` and `resources/.../view/`:
   - FXML files define screens such as login, register, main page, item details, seller view, and add item.
   - Controllers like `LoginController`, `MainPageController`, and `ItemDetailsController` handle user actions and UI state.
   The UI does not talk directly to the database; it delegates to the client networking layer.

4. **Client networking layer**
   `network/ClientManager` is the client-side socket abstraction. It serializes domain intent into `network/message/Request` objects and receives `Response` objects back from the server. This layer is the client’s only gateway to server-side state and is the key interface to show between UI and backend in a diagram.

5. **Server concurrency and request handling**
   On the server side, `AuctionServer` accepts incoming connections and `ClientHandler` handles each connected client. The README mentions multithreading, thread pools, and scheduled execution, so the server is designed for concurrent client sessions and timed auction completion. The socket layer is the transport boundary into the backend.

6. **Business services**
   Core application logic is concentrated in `service/`:
   - `UserManager` handles account-related workflows.
   - `AuctionManager` handles auction lifecycle, bidding, and item/lot operations.
   These services sit between the network layer and the domain model, enforcing rules before any persistence change is made.

7. **Domain model**
   The `model/` package captures the business entities:
   - `model/user`: user hierarchy and roles (`Admin`, `Seller`, `Bidder`, `NormalUser`, `UserRole`, `UserDecorator`).
   - `model/item`: abstract `Item` plus concrete categories such as `Art`, `Electronics`, and `Vehicle`, with factories for each.
   - `model/auction`: `Auction`, `AuctionStatus`, `BidTransaction`, and `AuctionObserver`.
   This structure suggests a domain-rich design with inheritance, factories, and observer-style notifications for auction state changes.

8. **Persistence and database**
   `util/PersistenceService` is the database boundary. The project uses **JDBC** against **PostgreSQL**, with schema initialization in `src/main/resources/db/init.sql`. The database is provided via `docker-compose.yml`, so persistence is external to the Java process and is brought up as an infrastructure dependency.

9. **Validation and failure paths**
   Custom exceptions in `exception/` define the main failure modes:
   - `AuthenticationException`
   - `InvalidBidException`
   - `AuctionClosedException`
   These represent business-rule failures, not technical crashes, and should be drawn as part of the service/domain boundary rather than the UI layer.

10. **Data flow for a typical bid**
   A bid likely flows as: JavaFX controller action → `ClientManager` request → `ClientHandler` → `AuctionManager`/domain validation → persistence update via `PersistenceService` → `Response` back to the client. `AuctionObserver` suggests the system may also notify interested parties when auction state changes, which is important for “real-time bidding” behavior.

11. **Packaging and build**
   The project is Maven-based (`pom.xml`) and modular (`module-info.java`). It builds both a regular jar and an executable jar-with-dependencies, and uses JavaFX dependencies/plugin support. This matters because the client is a desktop GUI app rather than a web frontend.

12. **Operational tooling**
   GitHub Actions CI is present under `.github/workflows/ci.yml`. Runtime orchestration relies on Docker Compose for PostgreSQL plus OS-specific scripts under `windows/` and `linux_macos/`. These are deployment/support artifacts, not core runtime components, but they are part of how the system is operated end-to-end.

Main entry points: [`auctionsystem/src/main/java/com/auction/network/ClientManager.java`](https://github.com/thaisodupe-coder/auctionsystem/blob/main/auctionsystem/src/main/java/com/auction/network/ClientManager.java) (ClientManager), [`auctionsystem/src/main/java/com/auction/service/AuctionManager.java`](https://github.com/thaisodupe-coder/auctionsystem/blob/main/auctionsystem/src/main/java/com/auction/service/AuctionManager.java) (AuctionManager), [`auctionsystem/src/main/java/com/auction/server/ClientHandler.java`](https://github.com/thaisodupe-coder/auctionsystem/blob/main/auctionsystem/src/main/java/com/auction/server/ClientHandler.java) (ClientHandler), [`auctionsystem/src/main/java/com/auction/service/UserManager.java`](https://github.com/thaisodupe-coder/auctionsystem/blob/main/auctionsystem/src/main/java/com/auction/service/UserManager.java) (UserManager)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_client["Client"]
  node_com_auction_appclient["AppClient<br/>JavaFX entrypoint<br/>[AppClient.java]"]
  node_com_auction_launcher["Launcher<br/>startup wrapper<br/>[Launcher.java]"]
  node_com_auction_controller_login["Login<br/>UI controller"]
  node_com_auction_controller_main["Main page<br/>UI controller"]
  node_com_auction_controller_itemdetails["Item details<br/>UI controller"]
  node_com_auction_controller_register["Register<br/>UI controller"]
  node_com_auction_controller_additem["Add item<br/>UI controller"]
  node_com_auction_controller_seller["Seller view<br/>UI controller"]
  node_com_auction_network_clientmanager["ClientManager<br/>socket client<br/>[ClientManager.java]"]
  node_com_auction_network_request["Request<br/>wire message<br/>[Request.java]"]
  node_com_auction_network_response["Response<br/>wire message<br/>[Response.java]"]
end

subgraph group_server["Server"]
  node_com_auction_server_server["AuctionServer<br/>socket server<br/>[AuctionServer.java]"]
  node_com_auction_server_handler["ClientHandler<br/>connection worker<br/>[ClientHandler.java]"]
  node_com_auction_service_user["UserManager<br/>business service<br/>[UserManager.java]"]
  node_com_auction_service_auction["AuctionManager<br/>business service"]
  node_com_auction_util_persistence["PersistenceService<br/>JDBC gateway"]
end

subgraph group_domain["Domain"]
  node_com_auction_model_user{{"Users<br/>domain model"}}
  node_com_auction_model_item{{"Items<br/>domain model"}}
  node_com_auction_model_auction{{"Auctions<br/>domain model"}}
end

subgraph group_infra["Infrastructure"]
  node_db_init_sql["init.sql<br/>schema init<br/>[init.sql]"]
  node_docker_compose[("Docker Compose<br/>postgres runtime<br/>[docker-compose.yml]")]
end

node_com_auction_appclient -->|"loads"| node_com_auction_controller_login
node_com_auction_launcher -->|"starts"| node_com_auction_appclient
node_com_auction_controller_login -->|"auth request"| node_com_auction_network_clientmanager
node_com_auction_controller_register -->|"create account"| node_com_auction_network_clientmanager
node_com_auction_controller_main -->|"browse/bid"| node_com_auction_network_clientmanager
node_com_auction_controller_itemdetails -->|"bid/update"| node_com_auction_network_clientmanager
node_com_auction_controller_additem -->|"publish item"| node_com_auction_network_clientmanager
node_com_auction_controller_seller -->|"manage items"| node_com_auction_network_clientmanager
node_com_auction_network_clientmanager -->|"serializes"| node_com_auction_network_request
node_com_auction_network_clientmanager -->|"receives"| node_com_auction_network_response
node_com_auction_network_request -->|"socket"| node_com_auction_server_handler
node_com_auction_server_server -->|"accepts"| node_com_auction_server_handler
node_com_auction_server_handler -->|"user ops"| node_com_auction_service_user
node_com_auction_server_handler -->|"auction ops"| node_com_auction_service_auction
node_com_auction_service_user -->|"reads/writes"| node_com_auction_util_persistence
node_com_auction_service_auction -->|"reads/writes"| node_com_auction_util_persistence
node_com_auction_service_auction -->|"enforces"| node_com_auction_model_auction
node_com_auction_service_auction -->|"uses"| node_com_auction_model_item
node_com_auction_service_user -->|"uses"| node_com_auction_model_user
node_com_auction_model_auction -->|"observer/actor"| node_com_auction_model_user
node_com_auction_util_persistence -->|"schema"| node_db_init_sql
node_docker_compose -->|"starts with"| node_db_init_sql

click node_com_auction_appclient "https://github.com/thaisodupe-coder/auctionsystem/blob/main/auctionsystem/src/main/java/com/auction/AppClient.java"
click node_com_auction_launcher "https://github.com/thaisodupe-coder/auctionsystem/blob/main/auctionsystem/src/main/java/com/auction/Launcher.java"
click node_com_auction_controller_login "https://github.com/thaisodupe-coder/auctionsystem/blob/main/auctionsystem/src/main/java/com/auction/controller/LoginController.java"
click node_com_auction_controller_main "https://github.com/thaisodupe-coder/auctionsystem/blob/main/auctionsystem/src/main/java/com/auction/controller/MainPageController.java"
click node_com_auction_controller_itemdetails "https://github.com/thaisodupe-coder/auctionsystem/blob/main/auctionsystem/src/main/java/com/auction/controller/ItemDetailsController.java"
click node_com_auction_controller_register "https://github.com/thaisodupe-coder/auctionsystem/blob/main/auctionsystem/src/main/java/com/auction/controller/RegisterController.java"
click node_com_auction_controller_additem "https://github.com/thaisodupe-coder/auctionsystem/blob/main/auctionsystem/src/main/java/com/auction/controller/AddItemController.java"
click node_com_auction_controller_seller "https://github.com/thaisodupe-coder/auctionsystem/blob/main/auctionsystem/src/main/java/com/auction/controller/SellerViewController.java"
click node_com_auction_network_clientmanager "https://github.com/thaisodupe-coder/auctionsystem/blob/main/auctionsystem/src/main/java/com/auction/network/ClientManager.java"
click node_com_auction_network_request "https://github.com/thaisodupe-coder/auctionsystem/blob/main/auctionsystem/src/main/java/com/auction/network/message/Request.java"
click node_com_auction_network_response "https://github.com/thaisodupe-coder/auctionsystem/blob/main/auctionsystem/src/main/java/com/auction/network/message/Response.java"
click node_com_auction_server_server "https://github.com/thaisodupe-coder/auctionsystem/blob/main/auctionsystem/src/main/java/com/auction/server/AuctionServer.java"
click node_com_auction_server_handler "https://github.com/thaisodupe-coder/auctionsystem/blob/main/auctionsystem/src/main/java/com/auction/server/ClientHandler.java"
click node_com_auction_service_user "https://github.com/thaisodupe-coder/auctionsystem/blob/main/auctionsystem/src/main/java/com/auction/service/UserManager.java"
click node_com_auction_service_auction "https://github.com/thaisodupe-coder/auctionsystem/blob/main/auctionsystem/src/main/java/com/auction/service/AuctionManager.java"
click node_com_auction_util_persistence "https://github.com/thaisodupe-coder/auctionsystem/blob/main/auctionsystem/src/main/java/com/auction/util/PersistenceService.java"
click node_com_auction_model_user "https://github.com/thaisodupe-coder/auctionsystem/tree/main/auctionsystem/src/main/java/com/auction/model/user"
click node_com_auction_model_item "https://github.com/thaisodupe-coder/auctionsystem/tree/main/auctionsystem/src/main/java/com/auction/model/item"
click node_com_auction_model_auction "https://github.com/thaisodupe-coder/auctionsystem/tree/main/auctionsystem/src/main/java/com/auction/model/auction"
click node_db_init_sql "https://github.com/thaisodupe-coder/auctionsystem/blob/main/auctionsystem/src/main/resources/db/init.sql"
click node_docker_compose "https://github.com/thaisodupe-coder/auctionsystem/blob/main/docker-compose.yml"

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_com_auction_appclient,node_com_auction_launcher,node_com_auction_controller_login,node_com_auction_controller_main,node_com_auction_controller_itemdetails,node_com_auction_controller_register,node_com_auction_controller_additem,node_com_auction_controller_seller,node_com_auction_network_clientmanager,node_com_auction_network_request,node_com_auction_network_response toneBlue
class node_com_auction_server_server,node_com_auction_server_handler,node_com_auction_service_user,node_com_auction_service_auction,node_com_auction_util_persistence toneAmber
class node_com_auction_model_user,node_com_auction_model_item,node_com_auction_model_auction toneMint
class node_db_init_sql,node_docker_compose toneRose
```

## Components

### Client

JavaFX desktop UI and client-side request handling.

- [AppClient](https://github.com/thaisodupe-coder/auctionsystem/blob/main/auctionsystem/src/main/java/com/auction/AppClient.java): JavaFX entrypoint · Bootstraps the desktop client application. · `auctionsystem/src/main/java/com/auction/AppClient.java`
- [Launcher](https://github.com/thaisodupe-coder/auctionsystem/blob/main/auctionsystem/src/main/java/com/auction/Launcher.java): startup wrapper · Alternative entrypoint for launching the client UI. · `auctionsystem/src/main/java/com/auction/Launcher.java`
- [Login](https://github.com/thaisodupe-coder/auctionsystem/blob/main/auctionsystem/src/main/java/com/auction/controller/LoginController.java): UI controller · Handles authentication screen actions. · `auctionsystem/src/main/java/com/auction/controller/LoginController.java`
- [Main page](https://github.com/thaisodupe-coder/auctionsystem/blob/main/auctionsystem/src/main/java/com/auction/controller/MainPageController.java): UI controller · Coordinates the primary browsing and auction UI. · `auctionsystem/src/main/java/com/auction/controller/MainPageController.java`
- [Item details](https://github.com/thaisodupe-coder/auctionsystem/blob/main/auctionsystem/src/main/java/com/auction/controller/ItemDetailsController.java): UI controller · Shows selected item and bidding details. · `auctionsystem/src/main/java/com/auction/controller/ItemDetailsController.java`
- [Register](https://github.com/thaisodupe-coder/auctionsystem/blob/main/auctionsystem/src/main/java/com/auction/controller/RegisterController.java): UI controller · Handles account creation flow. · `auctionsystem/src/main/java/com/auction/controller/RegisterController.java`
- [Add item](https://github.com/thaisodupe-coder/auctionsystem/blob/main/auctionsystem/src/main/java/com/auction/controller/AddItemController.java): UI controller · Supports seller item creation workflow. · `auctionsystem/src/main/java/com/auction/controller/AddItemController.java`
- [Seller view](https://github.com/thaisodupe-coder/auctionsystem/blob/main/auctionsystem/src/main/java/com/auction/controller/SellerViewController.java): UI controller · Seller-oriented inventory and auction management screen. · `auctionsystem/src/main/java/com/auction/controller/SellerViewController.java`
- [ClientManager](https://github.com/thaisodupe-coder/auctionsystem/blob/main/auctionsystem/src/main/java/com/auction/network/ClientManager.java): socket client · Client-side gateway for sending requests and receiving responses. · `auctionsystem/src/main/java/com/auction/network/ClientManager.java`
- [Request](https://github.com/thaisodupe-coder/auctionsystem/blob/main/auctionsystem/src/main/java/com/auction/network/message/Request.java): wire message · Client-to-server command payload. · `auctionsystem/src/main/java/com/auction/network/message/Request.java`
- [Response](https://github.com/thaisodupe-coder/auctionsystem/blob/main/auctionsystem/src/main/java/com/auction/network/message/Response.java): wire message · Server-to-client result payload. · `auctionsystem/src/main/java/com/auction/network/message/Response.java`

### Server

Socket backend, business services, and persistence access.

- [AuctionServer](https://github.com/thaisodupe-coder/auctionsystem/blob/main/auctionsystem/src/main/java/com/auction/server/AuctionServer.java): socket server · Accepts incoming client connections and routes them to handlers. · `auctionsystem/src/main/java/com/auction/server/AuctionServer.java`
- [ClientHandler](https://github.com/thaisodupe-coder/auctionsystem/blob/main/auctionsystem/src/main/java/com/auction/server/ClientHandler.java): connection worker · Processes one connected client session. · `auctionsystem/src/main/java/com/auction/server/ClientHandler.java`
- [UserManager](https://github.com/thaisodupe-coder/auctionsystem/blob/main/auctionsystem/src/main/java/com/auction/service/UserManager.java): business service · Handles authentication and user-related workflows. · `auctionsystem/src/main/java/com/auction/service/UserManager.java`
- [AuctionManager](https://github.com/thaisodupe-coder/auctionsystem/blob/main/auctionsystem/src/main/java/com/auction/service/AuctionManager.java): business service · Controls auction lifecycle, bidding, and item operations. · `auctionsystem/src/main/java/com/auction/service/AuctionManager.java`
- [PersistenceService](https://github.com/thaisodupe-coder/auctionsystem/blob/main/auctionsystem/src/main/java/com/auction/util/PersistenceService.java): JDBC gateway · Database access boundary used by services. · `auctionsystem/src/main/java/com/auction/util/PersistenceService.java`

### Domain

Core auction, item, and user models.

- [Users](https://github.com/thaisodupe-coder/auctionsystem/tree/main/auctionsystem/src/main/java/com/auction/model/user): domain model · User hierarchy and roles. · `auctionsystem/src/main/java/com/auction/model/user`
- [Items](https://github.com/thaisodupe-coder/auctionsystem/tree/main/auctionsystem/src/main/java/com/auction/model/item): domain model · Item hierarchy and category factories. · `auctionsystem/src/main/java/com/auction/model/item`
- [Auctions](https://github.com/thaisodupe-coder/auctionsystem/tree/main/auctionsystem/src/main/java/com/auction/model/auction): domain model · Auction state, bids, and observer hooks. · `auctionsystem/src/main/java/com/auction/model/auction`

### Infrastructure

Database and runtime orchestration.

- [init.sql](https://github.com/thaisodupe-coder/auctionsystem/blob/main/auctionsystem/src/main/resources/db/init.sql): schema init · Initial database schema and setup script. · `auctionsystem/src/main/resources/db/init.sql`
- [Docker Compose](https://github.com/thaisodupe-coder/auctionsystem/blob/main/docker-compose.yml): postgres runtime · Runs the PostgreSQL database used by the application. · `docker-compose.yml`

## Connections

- AppClient → Login: loads · Client startup opens the initial UI flow.
- Launcher → AppClient: starts · Wrapper entrypoint launches the JavaFX application.
- Login → ClientManager: auth request · Login actions are sent through the network gateway.
- Register → ClientManager: create account · Registration uses the same client transport.
- Main page → ClientManager: browse/bid · Main page actions issue server requests.
- Item details → ClientManager: bid/update · Item detail actions go through the client manager.
- Add item → ClientManager: publish item · Seller item creation is sent to the backend.
- Seller view → ClientManager: manage items · Seller view uses server-backed operations.
- ClientManager → Request: serializes · Client intent is encoded as a request message.
- ClientManager → Response: receives · Responses are read back from the server.
- Request → ClientHandler: socket · Requests cross the client-server boundary.
- AuctionServer → ClientHandler: accepts · Server dispatches each client connection to a handler.
- ClientHandler → UserManager: user ops · Authentication and account flows are delegated to user service.
- ClientHandler → AuctionManager: auction ops · Bid and auction commands are delegated to auction service.
- UserManager → PersistenceService: reads/writes · User workflow persists through JDBC boundary.
- AuctionManager → PersistenceService: reads/writes · Auction workflow persists through JDBC boundary.
- AuctionManager → Auctions: enforces · Auction rules are expressed in the domain model.
- AuctionManager → Items: uses · Auction logic manipulates item entities.
- UserManager → Users: uses · Account logic works with the user model.
- Auctions → Users: observer/actor · Auctions involve bidders and state notifications.
- PersistenceService → init.sql: schema · Database setup comes from the initialization script.
- Docker Compose → init.sql: starts with · PostgreSQL is provisioned alongside the schema initialization.
