# aadewunmi/javafx_chat_messenger_application architecture

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

- Interactive diagram: https://gitdiagram.com/aadewunmi/javafx_chat_messenger_application
- Repository: https://github.com/aadewunmi/javafx_chat_messenger_application

## Overview

##### Project Type & Purpose
- The project is a desktop chat application where users run a client and communicate with a server using TCP/IP.
- It leverages JavaFX for the graphical user interface and Java sockets for networking.
- The README specifies how to launch both the ClientApplication and the ServerApplication.

##### Analyzing the File Structure
- At the top level, you have standard Maven build files (pom.xml, mvnw, etc.) which indicate the build and dependency management.
- The src/main/java directory contains a package hierarchy under “com/application/javafx_chat_messenger_application” further divided into “client” and “server” subdirectories.
- Under “client” there are:
▪ Client.java, ClientApplication.java, and ClientController.java – which handle the client logic and UI interactions.
▪ The corresponding FXML file for the client UI is in src/main/resources under the matching package path (client-view.fxml).
- Under “server” there are:
▪ Server.java, ServerApplication.java, and ServerController.java – which manage the server logic and its interface.
▪ Its corresponding FXML is “server-view.fxml”.
- The presence of both “client” and “server” packages indicates well-separated responsibilities for each role in the application.

##### Key Architectural Components
- Client Module:
- ClientApplication (entry point for the client) which initializes JavaFX and displays the UI.
- ClientController that processes user events and interacts with the network layer.
- A separate Client class handling specific socket communications.
- Associated client-view.fxml for the JavaFX UI.
- Server Module:
- ServerApplication which starts the server side of the application.
- ServerController that manages server actions and UI events (if any).
- A Server class to manage TCP socket connections and client communications.
- Associated server-view.fxml for the UI.
- The Maven build system and module-info.java (for Java Platform Module System compatibility) are essential parts of the development environment.

- Client Application Module:
▪ UI Layer (represented by ClientApplication and client-view.fxml)
▪ Controller Layer (ClientController)
▪ Networking Module (Client handling socket communications)
- Server Application Module:
▪ UI Layer (ServerApplication and server-view.fxml)
▪ Controller Layer (ServerController)
▪ Networking Module (Server handling socket connections and communication logic)
- Infrastructure Component:
▪ TCP/IP network (illustrated as the channel over which client and server interact)
- Build/Deployment Environment:
▪ Maven build system and configuration files (pom.xml, mvnw, etc.)
b. Relationships and interactions:
- Bidirectional communication between the Client’s Networking Module and the Server’s Networking Module (TCP/IP channel).
- From the Server’s side, indicate how incoming connections are processed by the ServerController and UI.
c. Architectural Patterns / Design Principles:
- Separation of concerns: Each module (client and server) is clearly separated by functionality (UI, controller, networking).
- MVC-like structure: The use of FXML for views with separate controller classes follows a Model-View-Controller pattern.
- Client-Server Communication: Clearly established via socket programming over TCP/IP.
d. Specify Relevant Technologies:
- Java 11
- JavaFX for the UI
- Java sockets for networking
- Maven for building and dependency management

## Diagram (Mermaid)

```mermaid
flowchart TD
    %% Build/Configuration Section
    subgraph "Build & Configuration"
        MB("Maven Build/Configuration"):::build
        MC("Module Configuration"):::build
    end

    %% Client Module
    subgraph "Client Module"
        CAP("Client Application Entry Point"):::app
        CU("Client UI (FXML)"):::ui
        CC("Client Controller"):::controller
        CN("Client Networking Module"):::network
        CAP --> CU
        CU --> CC
        CC --> CN
    end

    %% Server Module
    subgraph "Server Module"
        SAP("Server Application Entry Point"):::app
        SU("Server UI (FXML)"):::ui
        SC("Server Controller"):::controller
        SN("Server Networking Module"):::network
        SAP --> SU
        SU --> SC
        SC --> SN
    end

    %% TCP/IP Channel
    TCP("TCP/IP Channel"):::tcp

    %% Inter-module Communication via Network Layer
    CN -->|"TCP/IP"| TCP
    TCP -->|"TCP/IP"| SN

    %% Styles
    classDef app fill:#F9E79F,stroke:#B7950B,stroke-width:2px;
    classDef ui fill:#AED6F1,stroke:#2471A3,stroke-width:2px;
    classDef controller fill:#A9DFBF,stroke:#28B463,stroke-width:2px;
    classDef network fill:#F5CBA7,stroke:#D35400,stroke-width:2px;
    classDef tcp fill:#E8DAEF,stroke:#8E44AD,stroke-width:2px;
    classDef build fill:#D5DBDB,stroke:#707B7C,stroke-width:2px;

    %% Click Events
    click CAP "https://github.com/aadewunmi/javafx_chat_messenger_application/blob/master/src/main/java/com/application/javafx_chat_messenger_application/client/ClientApplication.java"
    click CC "https://github.com/aadewunmi/javafx_chat_messenger_application/blob/master/src/main/java/com/application/javafx_chat_messenger_application/client/ClientController.java"
    click CN "https://github.com/aadewunmi/javafx_chat_messenger_application/blob/master/src/main/java/com/application/javafx_chat_messenger_application/client/Client.java"
    click CU "https://github.com/aadewunmi/javafx_chat_messenger_application/blob/master/src/main/resources/com/application/javafx_chat_messenger_application/client/client-view.fxml"
    click SAP "https://github.com/aadewunmi/javafx_chat_messenger_application/blob/master/src/main/java/com/application/javafx_chat_messenger_application/server/ServerApplication.java"
    click SC "https://github.com/aadewunmi/javafx_chat_messenger_application/blob/master/src/main/java/com/application/javafx_chat_messenger_application/server/ServerController.java"
    click SN "https://github.com/aadewunmi/javafx_chat_messenger_application/blob/master/src/main/java/com/application/javafx_chat_messenger_application/server/Server.java"
    click SU "https://github.com/aadewunmi/javafx_chat_messenger_application/blob/master/src/main/resources/com/application/javafx_chat_messenger_application/server/server-view.fxml"
    click MB "https://github.com/aadewunmi/javafx_chat_messenger_application/blob/master/pom.xml"
    click MC "https://github.com/aadewunmi/javafx_chat_messenger_application/blob/master/src/main/java/module-info.java"
```
