Skip to content

Anton-dev3306/Bloom-backend

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

18 Commits
 
 
 
 
 
 
 
 

Repository files navigation

🌸 Bloom – Backend

Real-time messaging backend built with Spring Boot, providing REST APIs, WebSocket/STOMP communication, and integrations with Twilio, Cloudinary, and PostgreSQL.


📌 Endpoints

Auth

Method URL Description
POST /api/auth/login Login with phone/email and password
POST /api/auth/register Register a new user
POST /api/auth/send-verification Send SMS verification code via Twilio
POST /api/auth/verify-code Verify SMS code

Users

Method URL Description
GET /api/users/{id} Get user by ID
PUT /api/users/{id} Update display name
PUT /api/users/{id}/change-password Change password
DELETE /api/users/{id} Delete account
POST /api/users/{id}/profile-picture Upload profile picture

Chats

Method URL Description
GET /api/chats/user/{userId} Get all chats for a user
POST /api/chats Create private or group chat
GET /api/chats/private/{userId}/{contactId} Check if private chat exists
DELETE /api/chats/{chatId} Delete a chat

Messages

Method URL Description
GET /messages/chat/{chatId} Get message history for a chat
DELETE /messages/{messageId} Delete a message

Contacts

Method URL Description
GET /api/contacts/owner/{userId} Get contacts for a user
POST /api/contacts Add a new contact
DELETE /api/contacts/{contactId} Remove a contact

Files

Method URL Description
POST /api/files/upload/image Upload image to Cloudinary
POST /api/files/upload/video Upload video to Cloudinary
POST /api/files/upload/audio Upload audio to Cloudinary
POST /api/files/upload/file Upload generic file to Cloudinary

Presence

Method URL Description
GET /api/presence/online/ids Get list of online user IDs

🔌 WebSocket

Connect to the WebSocket endpoint:

Destination Description
/app/chat.sendMessage Send a message to a chat
/app/user.connect Notify user connection
/topic/chat.{chatId} Subscribe to a chat's messages
/topic/user.presence Subscribe to online presence updates
/topic/user.profileUpdate Subscribe to profile picture updates

Send Message Payload

{
  "chatId": 1,
  "senderId": 1,
  "content": "Hello!",
  "messageType": "TEXT",
  "metadata": null
}

🧪 Example — Send a text message via WebSocket

Connect to /ws, then send to /app/chat.sendMessage:

{
  "chatId": 1,
  "senderId": 1,
  "content": "Hello from Bloom!",
  "messageType": "TEXT"
}

Expected broadcast on /topic/chat.1:

{
  "messageId": 42,
  "chatId": 1,
  "senderId": 1,
  "senderName": "Antonio",
  "content": "Hello from Bloom!",
  "messageType": "TEXT",
  "sentAt": "2026-03-11T02:21:04",
  "reactions": []
}

🔗 Links

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors