Skip to content

loopholend/chat-application-firebase

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

7 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Firebase Firestore Spring Boot API

This project is a Spring Boot Maven application that uses the Firebase Admin SDK to connect to Firestore.

Firebase configuration

FirebaseConfig initializes Firebase using this service account JSON file:

C:\Users\Pranjal Pal\Downloads\chat-app-1e086-firebase-adminsdk-fbsvc-7dce8e839d.json

Dependency

The project uses:

  • com.google.firebase:firebase-admin:9.2.0

API endpoints

POST /register

Request body:

{
  "username": "alice",
  "email": "alice@example.com",
  "password": "secret123"
}

Stores the user in Firestore collection users.

POST /login

Request body:

{
  "email": "alice@example.com",
  "password": "secret123"
}

Checks the credentials against Firestore. On success, returns the list of all users.

GET /users

Returns all users from Firestore collection users.

POST /sendMessage

Request body:

{
  "senderId": "user-id-1",
  "receiverId": "user-id-2",
  "text": "Hello"
}

Stores the message in Firestore collection messages.

GET /messages/{userId}

Returns all messages sent or received by the given user.

Models

  • User: id, username, email, password
  • Message: id, senderId, receiverId, text, timestamp

Build and run

Requirements:

  • Java 17
  • Maven 3.9+

Build:

mvn clean package

Run:

mvn spring-boot:run

The API starts on http://localhost:8080.

About

Realtime chat application integrated with Firebase backend services.

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors