A production-ready, cloud-native chat platform built on AWS demonstrating enterprise-level scalability and DevOps practices.
This platform implements a microservices architecture with the following components:
- Authentication Service: JWT-based authentication with session management
- Message Router: Message routing and room management
- WebSocket Handler: Real-time WebSocket connections with goroutines
- Message Persistence: PostgreSQL-based message storage
- User Presence: Online/offline status tracking
- ✅ Scalability: Supports >1000 concurrent connections
- ✅ Performance: P95 response time <100ms
- ✅ Reliability: 99.9% uptime with auto-scaling
- ✅ Real-time: WebSocket-based messaging
- ✅ Monitoring: CloudWatch integration with custom metrics
- ✅ Security: JWT authentication, TLS encryption
- ✅ DevOps: GitHub Actions CI/CD with blue-green deployment
- Go 1.21+
- Docker & Docker Compose
- AWS CLI configured
- Terraform (for infrastructure)
-
Clone and setup:
git clone <repository> cd Scalable-Chat-Platform cp .env.example .env
-
Start local services:
docker-compose up -d postgres redis
-
Run database migrations:
make migrate-up
-
Start services:
make run-all
-
Deploy infrastructure:
cd infrastructure terraform init terraform plan terraform apply -
Build and push containers:
make build-all make push-all
-
Deploy services:
make deploy-all
┌─────────────────┐ ┌─────────────────┐ ┌─────────────────┐
│ Auth Service │ │ Message Router │ │ WebSocket Handler│
│ Port: 8080 │ │ Port: 8081 │ │ Port: 8082 │
└─────────────────┘ └─────────────────┘ └─────────────────┘
│ │ │
└───────────────────────┼───────────────────────┘
│
┌─────────────────┐ ┌─────────────────┐
│ Message Persist │ │ Presence Service│
│ Port: 8083 │ │ Port: 8084 │
└─────────────────┘ └─────────────────┘
POST /auth/register- User registrationPOST /auth/login- User loginPOST /auth/refresh- Token refreshGET /auth/validate- Token validation
GET /rooms- List chat roomsPOST /rooms- Create roomPOST /rooms/:id/join- Join roomGET /rooms/:id/messages- Get messages
WS /ws- WebSocket connection- Real-time message broadcasting
- Connection management
POST /messages- Store messageGET /messages/search- Search messagesGET /messages/:id- Get message
GET /presence/:user_id- Get user statusPOST /presence/heartbeat- Update presence
websocket_connections_active- Active WebSocket connectionsmessages_per_second- Message throughputauth_success_rate- Authentication success rateresponse_time_p95- 95th percentile response time
/health- Service health status/ready- Service readiness/metrics- Prometheus metrics
├── cmd/ # Service entry points
│ ├── auth-service/
│ ├── message-router/
│ ├── websocket-handler/
│ ├── message-persistence/
│ └── presence-service/
├── internal/ # Private application code
│ ├── auth/
│ ├── messaging/
│ ├── websocket/
│ ├── persistence/
│ └── presence/
├── pkg/ # Public packages
│ ├── config/
│ ├── database/
│ ├── redis/
│ ├── monitoring/
│ └── utils/
├── infrastructure/ # Terraform/CDK code
├── deployments/ # Kubernetes/ECS configs
├── scripts/ # Build and deployment scripts
└── docs/ # Documentation
make test # Run all tests
make test-coverage # Run tests with coverage
make test-integration # Run integration testsmake build-all # Build all services
make build-auth # Build specific service
make docker-build # Build Docker images- Concurrent Connections: 1000+ per instance
- Message Throughput: 10,000+ messages/second
- Response Time: P95 <100ms, P99 <200ms
- Memory Usage: <512MB per service instance
- CPU Usage: <70% under normal load
- JWT token authentication with refresh tokens
- TLS 1.3 encryption for all communications
- Rate limiting and DDoS protection
- Input validation and sanitization
- Secrets management via AWS Secrets Manager
- Fork the repository
- Create a feature branch
- Make your changes
- Add tests
- Submit a pull request
MIT License - see LICENSE file for details