A modern, full-stack real-time chat application built with Java Spring Boot, WebSocket, and PostgreSQL. Featuring a sleek Discord-inspired dark theme, multi-channel support, and secure authentication.
- Real-time Messaging: Instant message delivery powered by WebSocket and STOMP protocol.
- Multi-Channel Support: Seamlessly switch between distinct channels (
#general,#off-topic,#help) with isolated chat histories. - Live User Tracking: See who is currently online in the sidebar.
- Secure Authentication: User registration and login protected by JWT (JSON Web Tokens).
- Persistent History: All messages are stored securely in a PostgreSQL database.
- Modern UI/UX: Responsive, dark-themed interface with custom message bubbles and avatars.
- Message Types: Handles chat messages, user join/leave events, and system notifications intelligently.
- Java 17+
- Spring Boot 3.x (Web, Security, Data JPA, WebSocket)
- Spring Security 6.x (Stateless JWT Authentication)
- PostgreSQL (Database)
- Lombok (Boilerplate reduction)
- HTML5 & CSS3 (Custom Flexbox layouts, Variables)
- JavaScript (ES6+)
- SockJS & Stomp.js (WebSocket client)
- Java 17 or higher
- Maven 3.6+
- PostgreSQL 14+
-
Clone the Repository
git clone https://github.com/sujan58/Chat_application.git cd Chat_application -
Database Configuration Ensure PostgreSQL is running and create a database named
chatapp_db.- Default credentials are set to
postgres/password. - Update
src/main/resources/application.propertiesif your credentials differ:spring.datasource.url=jdbc:postgresql://localhost:5432/chatapp_db spring.datasource.username=your_username spring.datasource.password=your_password
- Default credentials are set to
-
Build the Project
mvn clean install
-
Run the Application
mvn spring-boot:run
The application will start on
http://localhost:8080.
- Open your browser and navigate to
http://localhost:8080. - Register a new account.
- Login with your credentials.
- Start chatting in the
#generalchannel or switch to others! - Open a second browser window (incognito) to simulate multiple users and see real-time updates.
Contributions are welcome! Please fork the repository and submit a pull request.
This project is licensed under the MIT License.