A full-stack real-time chat application built with Go and Next.js.
β οΈ Security Note: This repository contains example/development credentials. Always use strong, unique secrets in production environments.
βββββββββββββββββββ
β Browser β
ββββββββββ¬βββββββββ
β
ββββββββββΌβββββββββ
β nginx (port 80)β
β Reverse Proxy β
ββββββββββ¬βββββββββ
β
ββββββββββββββββββββββββΌ
β / β /api/* & /ws
βΌ βΌ
βββββββββββββββββββ βββββββββββββββββββ
β Next.js β β Go + Fiber β
β (port 3000) β β (port 8080) β
β Frontend β β Backend API β
βββββββββββββββββββ ββββββββββ¬βββββββββ
β
ββββββββββββββββΌβββββββββββββββ
βΌ βΌ βΌ
ββββββββββββ ββββββββββββ ββββββββββββββββ
β Redis β β Redis β β PostgreSQL β
β Pub/Sub β β Stream β β β
ββββββββββββ ββββββββββββ ββββββββββββββββ
gochat/
βββ backend/ # Go API (Fiber + WebSocket)
β βββ cmd/ # Application entrypoint
β βββ internal/ # Private application code
β βββ pkg/ # Reusable packages
β βββ database/ # SQL migrations & schema
β βββ docs/ # API documentation
β βββ README.md # Backend-specific docs
β
βββ frontend/ # Next.js Web App
β βββ src/
β β βββ app/ # Next.js App Router
β β βββ components/ # React components
β β βββ hooks/ # Custom hooks
β β βββ store/ # Redux state management
β β βββ lib/ # Utilities
β β βββ types/ # TypeScript types
β βββ README.md # Frontend-specific docs
β
βββ nginx.conf # Production reverse proxy config
βββ nginx-dev.conf # Development reverse proxy config
βββ docker-compose.yml # Full stack orchestration
βββ Makefile # Project commands
βββ README.md # You are here
| Layer | Technology |
|---|---|
| Frontend | Next.js 14, React 18, TypeScript, Tailwind CSS |
| State Management | Redux Toolkit, RTK Query |
| UI Components | Radix UI, Framer Motion (LazyMotion) |
| Forms | React Hook Form, Zod |
| Backend | Go 1.23, Fiber v2, Uber Fx |
| Database | PostgreSQL 16 |
| Cache/Realtime | Redis 7 (Pub/Sub + Streams) |
| Auth | JWT (HttpOnly cookies) |
| Realtime | WebSocket |
| Reverse Proxy | nginx |
| Infrastructure | Docker, Docker Compose |
- Docker & Docker Compose
- Make
- Go 1.23+ (for backend development)
- Node.js 20+ (for frontend development)
# Clone the repository
git clone https://github.com/Beretta350/gochat.git
cd gochat
# Start all services (builds and runs everything)
make docker-up
# Access the application:
# - App: http://localhost
# - Redis Commander: http://localhost:8081# Start infrastructure + nginx (for local development)
make docker-dev
# In one terminal - run backend with hot reload
make dev-api
# In another terminal - run frontend with hot reload
make dev-web
# Access the application:
# - App: http://localhost (nginx proxies to local services)
# - Redis Commander: http://localhost:8081
# Stop dev environment
make docker-dev-downmake help # Show all commands
# Docker - Full Stack
make docker-up # Build and start all services
make docker-down # Stop all services
make docker-logs # View all logs
make docker-build # Build all images
make docker-restart # Rebuild and restart all
# Docker - Development
make docker-dev # Start infra + nginx (for local dev with hot reload)
make docker-dev-down # Stop dev environment
make docker-infra # Start only PostgreSQL + Redis
make docker-infra-down # Stop infrastructure
# Docker - Backend Only
make docker-api-up # Start API + infra
make docker-api-build # Build API image
make docker-api-logs # View API logs
make docker-api-restart # Rebuild and restart API
# Docker - Frontend Only
make docker-web-up # Start Web + API + infra
make docker-web-build # Build Web image
make docker-web-logs # View Web logs
make docker-web-restart # Rebuild and restart Web
# Development (Local)
make dev-api # Run backend with hot reload
make dev-web # Run frontend dev server
# Backend (Go)
make api-build # Build backend binary
make api-test # Run backend tests
make api-lint # Lint backend code
make api-fmt # Format backend code
# Frontend (Next.js)
make web-install # Install dependencies
make web-build # Build frontend
make web-lint # Lint frontend code
make web-test # Run frontend tests| Method | Endpoint | Description |
|---|---|---|
| POST | /api/v1/auth/register |
Create account |
| POST | /api/v1/auth/login |
Login |
| POST | /api/v1/auth/refresh |
Refresh token |
| GET | /api/v1/auth/me |
Get current user |
| POST | /api/v1/conversations |
Create conversation |
| GET | /api/v1/conversations |
List conversations |
| GET | /api/v1/conversations/:id/messages |
Get messages |
| WS | /ws?token=<jwt> |
WebSocket connection |
π See backend/README.md for detailed API documentation.
- User authentication (register, login, JWT)
- Real-time messaging via WebSocket
- Direct messages (1:1)
- Group conversations
- Message history with pagination
- Multi-device support (Redis Pub/Sub)
- Offline message queue
- Modern responsive UI (mobile-first)
- Dark theme with custom color palette
- Smooth animations (Framer Motion)
- Form validation (React Hook Form + Zod)
- State management (Redux Toolkit)
- Data caching (RTK Query)
- Typing indicators
- Read receipts
- File sharing
- Push notifications
- PWA support
This project is published for portfolio and demonstration purposes only.
- β View source code for educational purposes
- β Commercial use prohibited without authorization
- β Copying, modifying, or distributing prohibited
- β Using as base for other projects prohibited
For licensing inquiries, contact: GitHub
See LICENSE for full terms.