Skip to content

simonforsberg/JavaFX-Chat-App

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

27 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

JavaFX Chat App 💬

A real-time chat client built with JavaFX 25 and powered by ntfy as the messaging backend.

Java JavaFX Build


👤 About This Project

This project was developed as a school assignment during my Java studies. I'm including it in my portfolio as it demonstrates real-time messaging, JavaFX, MVC architecture, and testing.


✨ Features

  • MVC architecture — clean separation between HelloFX (app), HelloController (controller), and HelloModel (model)
  • Send messages to a configurable ntfy topic via JSON POST
  • Receive messages in real time via JSON stream
  • Switch topics — change the topic name and reconnect on the fly with the "Connect" button
  • Connection status indicator — live 🟢/🔴 status showing whether you're connected to a topic
  • Environment-based configuration — backend URL loaded from a .env file (excluded from version control)
  • Unit tested — model layer covered with JUnit 5, AssertJ, and Mockito

🛠️ Tech Stack

Layer Technology
Language Java 25
UI Framework JavaFX 25 (Controls + FXML)
HTTP java.net.http (built-in Java HTTP Client)
JSON Jackson Databind 3.0
Configuration dotenv-java 3.2
Testing JUnit Jupiter 6, AssertJ 3.27, Mockito 5.20, WireMock 4.0
Build Maven (with Maven Wrapper)

📋 Prerequisites

  • JDK 25 (set JAVA_HOME accordingly)
  • No separate Maven installation required — the included Maven Wrapper (mvnw) handles it

🚀 Getting Started

1. Configure environment

Create a .env file in the project root with your ntfy backend URL:

NTFY_URL=https://ntfy.sh

The .env file is listed in .gitignore and will not be committed.

2. Build & Run

./mvnw clean javafx:run

On Windows:

mvnw.cmd clean javafx:run

📁 Project Structure

JavaFX-Chat-App/
├── src/
│   ├── main/
│   │   ├── java/
│   │   │   ├── module-info.java
│   │   │   └── com/example/
│   │   │       ├── HelloFX.java             # Application entry point
│   │   │       ├── HelloController.java     # FXML controller
│   │   │       ├── HelloModel.java          # Business logic / model
│   │   │       ├── NtfyConnection.java      # Connection abstraction
│   │   │       ├── NtfyConnectionImpl.java  # HTTP-based ntfy connection
│   │   │       └── NtfyMessageDto.java      # Message data transfer object
│   │   └── resources/com/example/
│   │       └── hello-view.fxml              # FXML UI layout
│   └── test/java/com/example/
│       ├── HelloModelTest.java              # Model unit tests
│       ├── NtfyConnectionSpy.java           # Test spy
│       └── NtfyConnectionStub.java          # Test stub
├── .github/workflows/classroom.yml          # CI autograding workflow
├── pom.xml
└── README.md

📜 License

This project is for educational purposes.

About

A JavaFX chat client with real-time messaging via ntfy. Built with a focus on MVC architecture and testability.

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages

  • Java 100.0%