A scalable, real-time messaging and matchmaking platform built with Spring Boot, WebSocket (STOMP), WebRTC signaling, and MongoDB.
- Features
- Technology Stack
- Installation
- Configuration
- Usage
- API Documentation
- WebSocket Integration
- Testing
- Monitoring
- Deployment
- Security
- Contributing
- License
- Real-time messaging with WebSocket/STOMP
- Intelligent matchmaking queue system
- WebRTC signaling for peer-to-peer connections
- Session management and persistence
- Comprehensive API for chat operations
- Java 17+
- Maven 3.8+
- MongoDB (local instance or Atlas)
- Web browser with WebRTC support
git clone https://github.com/girish-kor/chatApi.git
cd chatApi
mvn clean install
mvn spring-boot:run# Server configuration
server.port=8080
# MongoDB configuration
spring.data.mongodb.uri=mongodb+srv://<username>:<password>@<cluster>.mongodb.net/<database>
# WebSocket configuration
websocket.enabled=trueexport MONGODB_URI=mongodb+srv://<username>:<password>@<cluster>.mongodb.net/<database>
export JWT_SECRET=your-secure-jwt-secret
export SERVER_PORT=8080# Start the application
mvn spring-boot:run
# or
java -jar target/chatApi-4.0.0.jarAccess at:
- API:
http://localhost:8080/api/... - WebSocket:
ws://localhost:8080/ws
| Method | Endpoint | Description | Auth |
|---|---|---|---|
| POST | /api/chat |
Send a message | Token |
| GET | /api/chat/{id} |
Get a message | Token |
| GET | /api/chat/history |
Get chat history | Token |
| PUT | /api/chat/{id} |
Edit message | Token |
| DELETE | /api/chat/{id} |
Delete message | Token |
| Method | Endpoint | Description | Auth |
|---|---|---|---|
| POST | /api/queue |
Join matchmaking queue | Token |
| GET | /api/queue/{sessionId} |
Check queue status | Token |
| GET | /api/queue |
View all (admin only) | Admin |
| PUT | /api/queue/{sessionId} |
Update queue entry | Token |
| DELETE | /api/queue/{sessionId} |
Leave queue | Token |
| Method | Endpoint | Description | Auth |
|---|---|---|---|
| POST | /api/sessions |
Start a session | Token |
| GET | /api/sessions/{id} |
Get session info | Token |
| GET | /api/sessions |
List sessions (admin only) | Admin |
| PUT | /api/sessions/{id} |
Modify session | Token |
| DELETE | /api/sessions/{id} |
End session | Token |
| Destination | Description | Payload |
|---|---|---|
/session.message |
Chat message | ChatMessage |
/session.signal |
WebRTC signaling | SignalingMessage |
/session.disconnect |
Leave session | String |
/queue.join |
Enter matchmaking | String |
/queue.leave |
Exit matchmaking | String |
{
"_id": "UUID",
"fromSessionId": "String",
"toSessionId": "String",
"content": "String",
"sentAt": "ISODate",
"signature": "String"
}{
"_id": "String",
"sessionId": "String",
"joinedAt": "ISODate",
"matched": "Boolean",
"weight": "Float"
}{
"_id": "UUID",
"userSessionId1": "String",
"userSessionId2": "String",
"startedAt": "ISODate",
"active": "Boolean"
}# Run all tests
mvn test
# Run with coverage report
mvn verifySpring Boot Actuator endpoints:
/actuator/health/actuator/metrics/actuator/loggers
# Build Docker image
docker build -t chatapi:latest .
# Run container
docker run -p 8080:8080 -e MONGODB_URI=<connection-string> chatapi:latest- Production URL: https://chatapi-girish-kor.vercel.app
- JWT-based authentication
- Token validation for WebSocket handshake
- CORS configuration
- Rate limiting and input validation
- Fork the repository
- Create a feature branch (
git checkout -b feature/amazing-feature) - Commit changes (
git commit -m 'Add feature') - Push to branch (
git push origin feature/amazing-feature) - Open a Pull Request
This project is licensed under the MIT License - see the LICENSE file for details.
Engineered with care using Spring Boot and WebSocket technology.
© 2025 Girish Kor | MIT License