A real-time chat server implementation using Go and Redis, featuring:
- Multi-client support with concurrent connections
- Redis for message persistence and real-time data
- Command-based chat interface
- Support for both private and broadcast messages
- Admin controls and moderation features
- Scalable architecture with Docker support
- 🔒 User authentication and management
- 💭 Real-time messaging
- 📨 Private messaging support
- 📢 Broadcast messages
- 📜 Chat history with Redis persistence
- 🔨 Moderation tools (ban/mute users)
- 🐳 Docker and Docker Compose support
- 🚀 Easy to deploy and scale
For detailed feature list, please check Features
- Go 1.21 or higher
- Redis server
- Docker (optional)
- Make (optional)
- Clone the repository:
git clone https://github.com/Amul-Thantharate/redis-chat-golang.git
cd redis-chat-golang- Install dependencies:
make deps- Start Redis (choose one method):
# Using Docker Compose
make redis-up
# Or using your local Redis installation
redis-server- Start the server:
make run-server- Start the client (in a new terminal):
make run-client- Start the server:
go run main.go server- Start the client:
go run main.go client# Build and run the server
make docker-run
# Stop the server
make docker-stopOnce connected, users can use the following commands:
| Command | Description |
|---|---|
/name <username> |
👤 Set your username |
/pm <user> <message> |
📩 Send a private message |
/broadcast <message> |
📢 Send a message to all users |
/list_users |
👥 Show online users |
/history |
📜 View chat history |
/ban <user> |
🚫 Ban a user (admin only) |
/unban <user> |
✅ Unban a user (admin only) |
/mute <user> |
🔇 Mute a user (admin only) |
/unmute <user> |
🔊 Unmute a user (admin only) |
/help |
ℹ️ Show help menu |
/exit |
👋 Leave the chat |
redis-chat-golang/
├── server/ # Server implementation
├── client/ # Client implementation
├── bin/ # Compiled binaries
├── Dockerfile # Docker configuration
├── docker-compose.yml # Docker Compose configuration
├── Makefile # Build and run commands
└── README.md # Documentation
make test# Run linting
make lint
# Format code
make fmt| Command | Description |
|---|---|
make build |
🔨 Build both server and client |
make clean |
🧹 Clean build artifacts |
make deps |
📦 Download dependencies |
make all |
🔥 Run formatting, linting, build, and tests |
make help |
📜 Show all available commands |
The application includes Docker support for easy deployment:
# Build Docker image
make docker-build
# Run server in Docker
make docker-run
# Stop Docker container
make docker-stopThis project is licensed under the Apache License 2.0 - see the LICENSE file for details.
- Fork the repository
- Create your feature branch (
git checkout -b feature/amazing-feature) - Commit your changes (
git commit -m 'Add some amazing feature') - Push to the branch (
git push origin feature/amazing-feature) - Open a Pull Request
Give a ⭐️ if this project helped you!
- GitHub: @Amul-Thantharate
- Email: amulthantharate@gmail.com
- Go Redis Client
- Docker Community
- Open Source Community