This project is a real-time chat application built with modern web technologies, providing features like user authentication, group chats, friend requests, and real-time messaging. It uses Socket.IO for real-time communication and MongoDB for database management.
- User Authentication: Login and register functionality with JWT-based authentication.
- Real-Time Messaging: Instant chat updates using WebSocket communication.
- Group Chats:
- Create and manage chat rooms.
- Add or remove members from groups.
- Friend Requests: Send, accept, or decline friend requests.
- Message Types: Supports both text and photo messages.
- Node.js: Backend runtime environment.
- Express.js: Web framework for building RESTful APIs.
- Socket.IO: Enables real-time, bidirectional communication.
- MongoDB: NoSQL database for managing user, chat, and message data.
- Mongoose: ODM (Object Data Modeling) library for MongoDB.
- dotenv: For environment variable management.
- User Schema:
- Manages user credentials and their associated chats.
- Message Schema:
- Handles both text and photo messages.
- Validates the content based on its type.
- Room Schema:
- Manages group chat data, including users and room details.
- Friend Request Schema:
- Tracks friend request status between users.
- Authentication:
/login
,/register
- Friend Management:
- Get friend list:
/friends
- Send request:
/addfriend/:id
- Accept/Decline requests:
/friendrequests/accept
,/friendrequests/decline
- Get friend list:
- Group Management:
- Create group:
/groups/creategroup
- Manage members:
/groups/:id/addmember
,/groups/:id/removemember
- Fetch group members:
/groups/:id/members
- Create group:
- Messaging:
- Fetch all messages in a chat:
GetAll
- Send messages:
send-Messages
- Fetch all messages in a chat:
joinRoom
: Join a specific chat room.GetAll
: Retrieve all messages in a chat room.send-Messages
: Send a message to a specific chat room.get-Messages
: Broadcast messages to other users in the room.
Create a .env
file in the root directory with the following keys:
DB_URI=your_mongodb_connection_string
YOUR_SECRET=your_jwt_secret_key
-
Clone the repository:
git clone https://github.com/your-username/your-repo.git cd your-repo
-
Install dependencies:
npm install
-
Configure environment variables:
- Create a
.env
file with the keys mentioned above.
- Create a
-
Start the server:
npm start
-
Open the application at:
- Frontend: http://localhost:3000
- you can find frontend side at that link Lomza-web-fronted
- Backend: http://localhost:433
If you have any questions or suggestions, feel free to reach out:
- GitHub: SerhatcanBakir
- Email: serhat2534serhat@outlook.com