Skip to content

Repository Description A high-performance, production-ready WebSocket chat server built in Go, featuring built-in security, rate limiting, and seamless Docker integration.

License

Notifications You must be signed in to change notification settings

mindedal/gochat

Repository files navigation

GoChat

CI Pipeline License: MIT Go Version Go Report Card

A high-performance, production-ready WebSocket chat server built with Go. GoChat provides real-time multi-client communication with built-in security features, comprehensive testing, and cross-platform support.

Features

  • Real-time Communication - WebSocket-based instant messaging
  • Multi-client Support - Handle thousands of concurrent connections
  • Built-in Security - Origin validation, rate limiting, and message size limits
  • Production Ready - Comprehensive testing, CI/CD pipeline, and deployment guides
  • Cross-platform - Build and run on Windows, macOS, and Linux
  • Zero Dependencies - Statically linked binaries with no external runtime dependencies
  • Docker Support - Production-ready containerization with multi-stage builds
  • Environment Configuration - Easy configuration via environment variables
  • Easy Deployment - Simple binary or container deployment with reverse proxy support

Quick Start

Local Build

# Clone the repository
git clone https://github.com/Tyrowin/gochat.git
cd gochat

# Build the server
make build

# Run the server
./bin/gochat

Docker

# Using Docker Compose (recommended)
docker-compose up -d

# Or build and run manually
docker build -t gochat:latest .
docker run -d -p 8080:8080 --name gochat gochat:latest

Configuration

GoChat can be configured using environment variables. Copy .env.example to .env and customize:

cp .env.example .env
# Edit .env with your settings

The server starts on http://localhost:8080. Visit http://localhost:8080/test to try the interactive test page.

Documentation

Getting Started

Deployment

Development

Architecture

Simple and Focused

GoChat follows a clean, modular architecture:

Client (Browser/App)
    ↓ WebSocket (ws:// or wss://)
Reverse Proxy (Nginx/Caddy)
    ↓ HTTP
GoChat Server (Go)
    ├── Hub (Message Broker)
    ├── Clients (WebSocket Connections)
    └── Security (Rate Limiting, Origin Validation)

Key Components

  • Hub - Central message broker coordinating all connected clients
  • Client - WebSocket connection handler with read/write pumps
  • Rate Limiter - Token bucket per-connection rate limiting
  • Origin Validator - CSWSH attack prevention
  • Handlers - HTTP/WebSocket request handlers

See Development Guide for detailed architecture information.

Technology Stack

  • Language: Go 1.25.1+
  • WebSocket Library: gorilla/websocket
  • Testing: Go standard library + custom test helpers
  • CI/CD: GitHub Actions
  • Code Quality: golangci-lint, gosec, govulncheck

Project Status

GoChat is actively maintained and production-ready. We welcome contributions!

  • Stability: Stable, used in production
  • Test Coverage: 80%+ with unit and integration tests
  • Security: Regular dependency scanning and security audits
  • Performance: Handles thousands of concurrent connections

Use Cases

  • Chat Applications - Real-time messaging systems
  • Live Notifications - Push notifications to web clients
  • Collaborative Tools - Real-time collaboration features
  • Gaming - Multiplayer game communication
  • IoT - Device-to-server real-time communication
  • Monitoring Dashboards - Live data updates

Community and Support

License

This project is licensed under the MIT License - see the LICENSE file for details.

Acknowledgments

  • Built with gorilla/websocket
  • Inspired by the Go community's best practices
  • Thanks to all contributors

Ready to get started? Check out the Getting Started Guide or explore the API Documentation to integrate GoChat into your application.

About

Repository Description A high-performance, production-ready WebSocket chat server built in Go, featuring built-in security, rate limiting, and seamless Docker integration.

Topics

Resources

License

Contributing

Security policy

Stars

Watchers

Forks

Contributors 3

  •  
  •  
  •