This project is a real-time chat room application built using Spring Boot on the backend and React on the frontend. It leverages WebSocket for real-time messaging and Stomp for handling communication between users. Users can join the chat room by entering their nickname and can send messages that are broadcasted to all connected clients in real-time.
- Features
- Technologies Used
- Getting Started
- Backend Setup
- Frontend Setup
- WebSocket Endpoints
- Available Scripts
- License
- Real-time communication using WebSockets.
- Users can join the chat with a nickname.
- Messages are broadcasted to all connected users.
- A simple, clean user interface built with Chakra UI.
- Nickname avatars are generated with random colors.
- Notification when a user joins or leaves the chat room.
- Spring Boot: Java framework for building the backend server.
- WebSocket: Protocol for real-time messaging.
- Stomp: Simple Text Oriented Messaging Protocol for handling WebSocket connections.
- React: JavaScript library for building the user interface.
- Chakra UI: React component library for building accessible UIs.
- TypeScript: Typed superset of JavaScript for better code reliability.
- SockJS: WebSocket emulation to support a fallback for older browsers.
To run this project locally, you will need to have the following installed:
- Java 17+
- Node.js 18+
- npm or yarn
- Clone the repository:
git clone https://github.com/yourusername/chat-room-app.git
- Move to correct folder
cd ChatRoom-SpringBoot/server
- Run server
./mvnw spring-boot:run
- Move to correct folder
cd ../client
- Install dependencies
npm install
- Start the React development server
npm run dev
- Subscribe: /topic/public – Receives messages sent to the chat room.
- Send Message: /app/chat.send – Sends a chat message to all connected clients.
- Join Chat: /app/chat.join – Notifies that a user has joined the chat room.
- ./mvnw spring-boot:run - Runs the Spring Boot backend server.
- npm run dev - Starts the development server for the React app.
- npm run build - Builds the app for production.
- npm run lint - Lints the codebase for issues.
This project is licensed under the MIT License - see the LICENSE file for details.