A high-performance, feature-rich real-time chat application built with Go (Fiber) on the backend and Vanilla JavaScript on the frontend. This project demonstrates a clean backend architecture, WebSocket-based real-time messaging, and secure JWT-based authentication.
Here are some screenshots from the application:
- Secure Authentication: Registration, login, logout using JWT (Access & Refresh Tokens).
- Multi-Room Chat:
- Direct Messages (DM): Auto-created 1-on-1 private chat rooms.
- Group Chats: Create or join group chats with multiple participants.
- Real-Time Messaging: Instant message delivery via WebSocket.
- Lobby & Chat History: View joined rooms and load previous messages on entry.
- Persistent Database: PostgreSQL for users, rooms, and message storage.
- Dynamic UI: Intuitive frontend with auto-generated avatars and readable user display names.
| Component | Technology |
|---|---|
| Backend | Go, Fiber v2, GORM, Google Wire, PostgreSQL, WebSocket |
| Frontend | Vanilla JavaScript (ES6+), HTML5, CSS3 |
| Deployment | Docker, Docker Compose |
| Cloud Storage | Cloudinary for image uploads and CDN delivery |
This project is compatible with a Flutter-based mobile frontend available here:
This project follows a layered architecture to ensure clean separation of concerns and maintainability:
+----------------+ +----------------+ +------------------+ +-------------+
| Client |----->| Handler |----->| Service |----->| Repository |
| (JS/WebSocket) | | (Validation) | | (Business Logic) | | (Database) |
+----------------+ +----------------+ +------------------+ +-------------+
- Handler: Receives HTTP/WebSocket requests and performs validation.
- Service: Contains application business logic.
- Repository: Handles communication with the database.
- Dependency Injection: Managed via Google Wire.
This project uses Cloudinary for hosting and delivering profile images with CDN support.
- Automatic image optimization and resizing
- High availability via CDN
- Public ID–based upload and retrieval
- Built-in image foldering (e.g.,
go-chat-app/profiles)
# Cloudinary Configuration
CLOUDINARY_CLOUD_NAME=your_cloud_name
CLOUDINARY_API_KEY=your_api_key
CLOUDINARY_API_SECRET=your_api_secret
CLOUDINARY_BASE_FOLDER=go-chat-app- Go (v1.24+)
- Docker & Docker Compose
# Clone the repository
git clone https://github.com/your-username/go-fiber-chatapp.git
cd go-fiber-chatapp
# Create a .env file
cp .env.example .env
# Fill in your database, JWT, and Cloudinary credentials
# Build and run
docker-compose up --buildAccess the app at http://localhost:8080
- Clone the repo and set up
.envas shown above. - Make sure PostgreSQL is running and create the necessary database.
- Install Go dependencies:
go mod tidy- Generate Dependency Injection files:
go generate ./...- Run the app:
go run .| Method | Endpoint | Description |
|---|---|---|
| POST | /api/auth/register |
Register a new user |
| POST | /api/auth/login |
Login and get access + refresh tokens |
| POST | /api/auth/logout |
Invalidate refresh token |
| POST | /api/auth/refresh |
Refresh access token |
| GET | /api/profile |
Get current user's profile |
| PUT | /api/profile |
Update current user's profile |
| GET | /api/users |
List all users |
| GET | /api/rooms |
List rooms joined by user |
| POST | /api/rooms |
Create a new room (group or DM) |
| GET | /chat/ws/:roomId |
WebSocket endpoint for a room |
- Online/Offline user status
- Typing indicators
- Unit and integration tests
- Group management (invite/kick)
- File and image attachments in chat
This project is licensed under the MIT License.


