A modern real-time messaging platform built with React, Spring Boot, MySQL, and WebSockets. Baatein enables users to connect, chat instantly, manage friendships, receive real-time notifications, and maintain seamless conversations through a scalable full-stack architecture.
Baatein is a full-stack real-time chat application designed to provide a fast, reliable, and engaging communication experience. The platform combines modern frontend technologies with a robust backend architecture to deliver instant messaging, user presence management, friend interactions, and real-time updates.
The project was built to explore and implement real-world software engineering concepts including:
- Authentication and Authorization
- Real-Time Communication
- WebSocket Architecture
- RESTful API Design
- Database Modeling
- Scalable Backend Systems
- Secure Session Management
- Cloud Deployment
- User Registration
- Secure Login & Logout
- JWT-based Authentication
- Refresh Token Mechanism
- Protected Routes
- Session Persistence
- Send Friend Requests
- Accept Friend Requests
- Reject Friend Requests
- Remove Friends
- Block Users
- Unblock Users
- Real-Time Friend Updates
- One-to-One Conversations
- Instant Message Delivery
- Persistent Chat History
- Real-Time Message Updates
- Conversation Management
- Message Timestamps
- Friend Request Notifications
- Friend Acceptance Notifications
- New Message Notifications
- Live Updates using WebSockets
- Profile Information Management
- Profile Picture Upload
- Dynamic Profile Updates
- STOMP over WebSocket
- Live Event Broadcasting
- User-Specific Messaging Queues
- Conversation Subscriptions
Frontend (React)
│
▼
REST APIs (Spring Boot)
│
▼
MySQL
│
▼
WebSocket / STOMP
│
▼
Real-Time Updates
User Action
│
▼
React Frontend
│
▼
REST API Request
│
▼
Spring Boot Backend
│
▼
Database Operation
│
▼
WebSocket Notification
│
▼
Connected Clients
- React.js
- React Router
- Axios
- Tailwind CSS
- Material UI
- STOMP Client
- SockJS
- Java
- Spring Boot
- Spring Security
- Spring Data JPA
- Hibernate
- WebSocket
- STOMP
- JWT Authentication
- MySQL
- Google Cloud Platform (GCP)
- Firebase Hosting
- Git
- GitHub
- Postman
- IntelliJ IDEA
- VS Code
src/
├── components/
├── pages/
├── hooks/
├── services/
├── contexts/
├── routes/
├── utils/
└── assets/
src/main/java
├── controller/
├── service/
├── repository/
├── entity/
├── dto/
├── mapper/
├── config/
├── security/
├── websocket/
└── exception/
User
├── userId
├── email
├── password
├── username
├── profileImage
├── createdAt
└── updatedAtFriendship
├── friendshipId
├── sender
├── receiver
├── status
├── conversation
└── createdAtConversation
├── conversationId
├── conversationCode
├── type
├── participants
└── createdAtMessage
├── messageId
├── conversation
├── sender
├── content
├── timestamp
└── statusBaatein uses JWT-based authentication with refresh token support.
- User submits credentials.
- Backend validates credentials.
- Access Token is generated.
- Refresh Token is generated.
- Access Token is returned to frontend.
- Refresh Token is stored securely in cookies.
- Access Token expires.
- Frontend automatically requests a new token.
- Backend validates Refresh Token.
- New Access Token is issued.
- User remains logged in.
Baatein uses WebSockets with STOMP protocol to achieve real-time communication.
- Incoming Messages
- Friend Requests
- Notification Updates
- Friend Status Changes
- Conversation Updates
User Sends Message
│
▼
REST API
│
▼
Message Saved
│
▼
WebSocket Event
│
▼
Recipient Receives Message
User A
│
▼
Send Request
│
▼
Friendship Created (PENDING)
│
▼
Notification Sent
User B Accepts
│
▼
Status → FRIENDS
│
▼
Conversation Created
│
▼
Real-Time Update Sent
Baatein follows a service-oriented backend architecture where APIs are organized by domain responsibility. The application exposes REST APIs for authentication, user management, friendships, conversations, messaging, and notifications, while WebSockets are used for real-time communication.
Handles user authentication, authorization, and session management using JWT and Refresh Tokens.
| Method | Endpoint | Description |
|---|---|---|
| POST | /auth/register |
Register a new user account |
| POST | /auth/login |
Authenticate user and issue JWT access token |
| POST | /auth/refresh-token |
Generate a new access token using refresh token |
| POST | /auth/logout |
Logout user and invalidate session |
Manages user profiles and account information.
| Method | Endpoint | Description |
|---|---|---|
| GET | /user/getProfile |
Retrieve authenticated user's profile |
| POST | /user/updateProfilePic |
Upload or update profile picture |
Handles friend requests, friendship lifecycle management, and user relationships.
| Method | Endpoint | Description |
|---|---|---|
| POST | /friend//{friendId}/addFriend |
Send a friend request |
| GET | /friend/getFriendList |
Retrieve all friends |
| GET | /friend/getFriendRequests |
Retrieve incoming friend requests |
| PUT | /friend/{friendshipId}/accept |
Accept a friend request |
| PUT | /friend/{friendshipId}/reject |
Reject a friend request |
| DELETE | /friend/{friendshipId}/delete |
Remove a friend |
| PUT | /friend/{friendshipId}/block |
Block a user |
| PUT | /friend/{friendshipId}/unblock |
Unblock a user |
| State | Description |
|---|---|
| PENDING | Friend request awaiting response |
| FRIENDS | Friend request accepted |
| BLOCKED | User blocked by another user |
Responsible for managing conversations between users.
| Method | Endpoint | Description |
|---|---|---|
| GET | /conversation/getConversations |
Retrieve all user conversations |
| GET | /conversation/code/{conversationCode} |
Retrieve conversation using conversation code |
| GET | /conversation/friend/{friendCode} |
Get conversation associated with a friend |
| POST | /conversation/create |
Create a new conversation |
| DELETE | /conversation//{conversationCode}/leave |
Delete conversation |
Handles chat messages and conversation history.
| Method | Endpoint | Description |
|---|---|---|
| GET | /chat/{conversationId}/messages |
Retrieve messages from a conversation |
| POST | /chat/{conversationId}/message |
Send a new message |
| PUT | /chat/message/{messageId} |
Edit an existing message |
| DELETE | /chat/message/{messageId} |
Delete a message |
Handles profile picture storage and retrieval.
| Method | Endpoint | Description |
|---|---|---|
| POST | files/profilePic/{filename} |
Upload profile picture |
Baatein uses STOMP over WebSocket to enable real-time communication.
| Endpoint | Description |
|---|---|
/ws |
Establish WebSocket connection |
Used when clients send real-time events to the server.
| Destination | Description |
|---|---|
/app/sendMessage |
Send chat message |
/app/friendRequest |
Send friend request event |
/app/acceptFriendRequest |
Accept friend request |
/app/notification |
Send notification event |
Broadcast channels used for real-time updates.
| Destination | Description |
|---|---|
/topic/conversation/{conversationId} |
Receive conversation messages |
/topic/friends |
Receive friend list updates |
/topic/notifications |
Receive notification broadcasts |
Private channels for delivering user-specific events.
| Destination | Description |
|---|---|
/user/queue/messages |
Receive private messages |
/user/queue/notifications |
Receive personal notifications |
/user/queue/friend-requests |
Receive friend request updates |
/user/queue/conversations |
Receive conversation updates |
- Instant Message Delivery
- Friend Request Notifications
- Friend Acceptance Notifications
- Conversation Updates
- User-Specific Notifications
- Live Synchronization Across Connected Clients
The following APIs are planned for future releases:
| Feature | Endpoint |
|---|---|
| Group Chats | /group/* |
| Message Reactions | /message/reaction |
| Message Replies | /message/reply |
| File Sharing | /file/upload |
| Message Search | /search/messages |
| Voice Calling | /call/* |
| Video Calling | /video-call/* |
git clone https://github.com/yourusername/baatein.git
cd baateinUpdate:
application.propertiesspring.datasource.url=YOUR_DB_URL
spring.datasource.username=YOUR_DB_USERNAME
spring.datasource.password=YOUR_DB_PASSWORD./mvnw spring-boot:runBackend runs on:
http://localhost:8080
Install dependencies:
npm installCreate:
.envExample:
VITE_BACKEND_BASE_URL=http://localhost:8080
VITE_WEBSOCKET_BASE_URL=http://localhost:8080
VITE_BASE_IMAGE_URL=http://localhost:8080/uploads/Run frontend:
npm run devFrontend runs on:
http://localhost:5173
Implemented bidirectional communication using STOMP over WebSockets for instant updates.
Implemented secure JWT authentication with refresh token rotation and automatic token renewal.
Maintained consistent state between multiple connected users through event-driven updates.
Designed friendship lifecycle management with request, acceptance, blocking, and deletion workflows.
Automatically creates and manages conversations between connected users.
- Group Chats
- Message Reactions
- Read Receipts
- Typing Indicators
- File Sharing
- Image Sharing
- Voice Notes
- Message Search
- End-to-End Encryption
- Push Notifications
- Voice Calling
- Video Calling
- Group Calling
Through Baatein, I gained practical experience in:
- Full-Stack Development
- Spring Boot Architecture
- React Application Design
- WebSocket Communication
- Authentication & Security
- Database Modeling
- REST API Development
- Cloud Deployment
- Real-Time Systems Design
- Scalable Software Architecture
Mohammad Junaid
Computer Science & Engineering Jamia Millia Islamia
Feel free to connect, contribute, or provide feedback.