PubSubGo is a modern, production-ready message broker that implements the publish-subscribe pattern with enterprise-grade features. Built from the ground up in Go, it provides blazing-fast message delivery, horizontal scalability, and comprehensive observability.
Goal: Simplify distributed system communication with a lightweight, feature-rich message broker that scales from development to production.
- 100K+ messages/sec throughput
- Sub-5ms latency (P99)
- Horizontal scaling with partitioned topics
- Connection pooling and batch operations
- Redis clustering support for persistence
- Message acknowledgments (ACK/NACK)
- Dead letter queues for failed messages
- Consumer groups with automatic rebalancing
- Prometheus metrics integration
- Jaeger distributed tracing
- Grafana dashboards included
- Health checks and monitoring APIs
- HTTP REST API for universal access
- WebSocket real-time subscriptions
- Go library for native integration
- CLI tool for operations and testing
Clean Architecture: Domain-driven design with clear separation of concerns
βββββββββββββββ ββββββββββββββββ βββββββββββββββββββ
β Clients ββββΆβ PubSubGo ββββΆβ Storage/Redis β
βββββββββββββββ ββββββββββββββββ βββββββββββββββββββ
β
βΌ
ββββββββββββββββ
β Monitoring β
ββββββββββββββββ
What makes it unique:
- Clean Architecture - Testable, maintainable, and extensible
- Multiple Storage - Memory, Redis, or custom adapters
- Real-time & Batch - WebSocket streams + HTTP REST
- Production Ready - Monitoring, tracing, and deployment tools included
# Clone and build
git clone https://github.com/zacksfF/PubSubGo.git
cd PubSubGo
make build
# Or using Docker
docker run -p 8081:8081 -p 9092:9092 pubsubgo/server./bin/pubsubgo-server
# Server starts on :8081, metrics on :9092package main
import (
"net/http"
"encoding/json"
)
func main() {
// Create topic
http.Post("http://localhost:8081/v1/topics", "application/json",
strings.NewReader(`{"name":"events","partitions":3}`))
// Publish message
http.Post("http://localhost:8081/v1/publish/events", "application/json",
strings.NewReader(`{"payload":"Hello World!"}`))
// Subscribe via WebSocket
ws, _ := websocket.Dial("ws://localhost:8081/ws", "", "http://localhost/")
ws.Write([]byte(`{"action":"subscribe","topic":"events"}`))
}# Create topic
pubsubgo-cli topics create --name orders --partitions 3
# Publish message
pubsubgo-cli publish --topic orders --message "New order #123"
# Subscribe
pubsubgo-cli subscribe --topic orders --consumer worker-1# Health check
curl http://localhost:8081/health
# Create topic
curl -X POST http://localhost:8081/v1/topics \
-d '{"name":"events","partitions":3}'
# Publish message
curl -X POST http://localhost:8081/v1/publish/events \
-d '{"payload":"Hello World!"}'
# WebSocket (using wscat)
wscat -c ws://localhost:8081/ws
> {"action":"subscribe","topic":"events"}// Order processing pipeline
orders β validation β payment β fulfillment β notifications// Event-driven architecture
user-service β pubsubgo β [email-service, analytics-service, audit-service]// Live data streaming
sensors β pubsubgo β [dashboard, alerts, storage]// Real-time messaging
game-events β pubsubgo β [players, leaderboards, analytics]version: '3.8'
services:
pubsubgo:
image: pubsubgo/server
ports: ["8081:8081", "9092:9092"]
redis:
image: redis:7-alpine
ports: ["6379:6379"]kubectl apply -k deployments/kubernetes/overlays/production/make monitoring-up
# Grafana: http://localhost:3000 (admin/admin123)
# Prometheus: http://localhost:9090
# Jaeger: http://localhost:16686- Quick Start Guide - Get running in 5 minutes
- Examples - Go library, CLI, and HTTP examples
- Monitoring Setup - Grafana dashboards and metrics
- Deployment Guide - Docker, Kubernetes, and Istio
- Architecture Overview - System design and patterns
We welcome contributions! See our Contributing Guide for details.
- Fork the repository
- Create your feature branch (
git checkout -b feature/amazing-feature) - Commit your changes (
git commit -m 'Add amazing feature') - Push to the branch (
git push origin feature/amazing-feature) - Open a Pull Request
This project is licensed under the MIT License - see the LICENSE file for details.
Built with β€οΈ by ZacksfF
Documentation β’ Report Bug β’ Request Feature