A robust real-time chat application with features for managing chat rooms and private conversations using WebSocket technology.
Explore API specs »
Report Bug
·
Request Feature
Table of Contents
This is a real-time chat application backend that enables users to create chat rooms, manage friendships, and engage in real-time conversations. The project utilizes WebSocket technology for real-time communication, MongoDB for persistent data storage, and Redis for managing real-time message delivery.
-
Chat Room Management
- Create new chat rooms
- Join existing chat rooms
- Leave chat rooms
- Real-time updates on room activities
-
Friend System
- Add new friends
- Manage friend list
- Real-time friend status updates
-
Real-time Messaging
- Send and receive messages instantly
- Private messaging between friends
- Message history persistence
- Real-time delivery status
Before running this project, make sure you have the following installed:
- Go 1.21 or higher
- MongoDB 6.0 or higher
- Redis 7.0 or higher
-
Clone the repository
git clone https://github.com/YourUsername/chat-app.git
-
Install Go dependencies
go mod download
-
Set up environment variables
cp .env.example .env
-
Configure your MongoDB connection
# In your .env file MONGODB_URI=mongodb://localhost:27017/chatapp
-
Configure Redis connection
# In your .env file REDIS_URL=redis://localhost:6379
-
Run the application
go run main.go
The application exposes both REST API endpoints and WebSocket connections for different functionalities:
POST /api/v1/rooms # Create a new chat room
GET /api/v1/rooms # List all available rooms
POST /api/v1/friends/add # Add a new friend
GET /api/v1/friends # Get friend list
ws://localhost:8080/ws/chat # Main WebSocket endpoint for chat
- Fork the Project
- Create your Feature Branch (
git checkout -b feature/AmazingFeature
) - Commit your Changes (
git commit -m 'Add some AmazingFeature'
) - Push to the Branch (
git push origin feature/AmazingFeature
) - Open a Pull Request
Distributed under the MIT License. See LICENSE
for more information.
Samuel Gamito |
---|
github.com/samuelgamito |