Skip to content

ChatApi represents a significant advancement in the field of human-to-human digital communication systems. Developed with scholarly precision, this system facilitates the spontaneous connection of individuals through a methodical queuing mechanism and enables discourse through both textual and audio-visual means.

License

Notifications You must be signed in to change notification settings

girish-kor/ChatApi

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

16 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

chatApi

Version License Build Coverage API Status Issues Pull Requests Last Commit

A scalable, real-time messaging and matchmaking platform built with Spring Boot, WebSocket (STOMP), WebRTC signaling, and MongoDB.

Table of Contents

Features

  • 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

Technology Stack

Spring Boot Java Version MongoDB MongoDB Atlas CI/CD Deployment

Installation

Prerequisites

  • Java 17+
  • Maven 3.8+
  • MongoDB (local instance or Atlas)
  • Web browser with WebRTC support

Quick Start

git clone https://github.com/girish-kor/chatApi.git
cd chatApi
mvn clean install
mvn spring-boot:run

Configuration

Required Properties

# Server configuration
server.port=8080

# MongoDB configuration
spring.data.mongodb.uri=mongodb+srv://<username>:<password>@<cluster>.mongodb.net/<database>

# WebSocket configuration
websocket.enabled=true

Environment Variables

export MONGODB_URI=mongodb+srv://<username>:<password>@<cluster>.mongodb.net/<database>
export JWT_SECRET=your-secure-jwt-secret
export SERVER_PORT=8080

Usage

# Start the application
mvn spring-boot:run
# or
java -jar target/chatApi-4.0.0.jar

Access at:

  • API: http://localhost:8080/api/...
  • WebSocket: ws://localhost:8080/ws

API Documentation

Chat Endpoints

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

Queue Endpoints

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

Session Endpoints

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

WebSocket Integration

STOMP Endpoints

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

Data Models

ChatMessage

{
  "_id": "UUID",
  "fromSessionId": "String",
  "toSessionId": "String",
  "content": "String",
  "sentAt": "ISODate",
  "signature": "String"
}

QueueUser

{
  "_id": "String",
  "sessionId": "String",
  "joinedAt": "ISODate",
  "matched": "Boolean",
  "weight": "Float"
}

ActiveSession

{
  "_id": "UUID",
  "userSessionId1": "String",
  "userSessionId2": "String",
  "startedAt": "ISODate",
  "active": "Boolean"
}

Testing

# Run all tests
mvn test

# Run with coverage report
mvn verify

Monitoring

Spring Boot Actuator endpoints:

  • /actuator/health
  • /actuator/metrics
  • /actuator/loggers

Deployment

Docker

# Build Docker image
docker build -t chatapi:latest .

# Run container
docker run -p 8080:8080 -e MONGODB_URI=<connection-string> chatapi:latest

Vercel

Security

  • JWT-based authentication
  • Token validation for WebSocket handshake
  • CORS configuration
  • Rate limiting and input validation

Contributing

  1. Fork the repository
  2. Create a feature branch (git checkout -b feature/amazing-feature)
  3. Commit changes (git commit -m 'Add feature')
  4. Push to branch (git push origin feature/amazing-feature)
  5. Open a Pull Request

License

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

About

ChatApi represents a significant advancement in the field of human-to-human digital communication systems. Developed with scholarly precision, this system facilitates the spontaneous connection of individuals through a methodical queuing mechanism and enables discourse through both textual and audio-visual means.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Contributors 2

  •  
  •