This is a real-time chat application built with Spring Boot and WebSocket.
- Real-time messaging between users.
- User connect and disconnect notifications.
- Simple and intuitive user interface.
- Backend:
- Java 21
- Spring Boot 3
- Spring WebSocket for real-time communication
- Spring Data JPA for database interaction
- H2 Database for in-memory data storage
- Maven for dependency management
- Frontend:
- Thymeleaf for server-side templating
- HTML5, CSS3, JavaScript
- StompJS for WebSocket communication
-
Prerequisites:
- Java 21 or later
- Maven 3.2+
-
Clone the repository:
git clone https://github.com/codingwitharmand/chat-app.git
-
Navigate to the project directory:
cd chat-app -
Run the application using Maven:
./mvnw spring-boot:run
-
Access the application: Open your web browser and go to
http://localhost:8080
.
├── src
│ ├── main
│ │ ├── java
│ │ │ └── com
│ │ │ └── cwa
│ │ │ └── chatapp
│ │ │ ├── config
│ │ │ │ ├── WebSocketConfig.java
│ │ │ │ └── WebSocketEventListener.java
│ │ │ ├── controller
│ │ │ │ ├── ApiController.java
│ │ │ │ ├── ChatController.java
│ │ │ │ └── WebController.java
│ │ │ ├── entity
│ │ │ │ ├── Message.java
│ │ │ │ └── User.java
│ │ │ ├── repository
│ │ │ │ ├── MessageRepository.java
│ │ │ │ └── UserRepository.java
│ │ │ └── service
│ │ │ ├── MessageService.java
│ │ │ └── UserService.java
│ │ └── resources
│ │ ├── static
│ │ │ ├── css
│ │ │ │ └── chat.css
│ │ │ └── js
│ │ │ └── chat.js
│ │ └── templates
│ │ ├── chat.html
│ │ └── index.html
│ └── test
└── pom.xml