Skip to content

NBWolfer/Playground

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

15 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

RTCP - Real-Time Conversation Platform

A full-stack, Discord-like real-time chat platform featuring a microservices backend in Go and a modern React frontend. Built with scalability, reliability, and developer experience in mind.

Go React TypeScript PostgreSQL Redis RabbitMQ Docker

Overview

RTCP is a comprehensive real-time communication platform that enables users to:

  • Create and manage servers (guilds) with text channels
  • Send real-time messages with WebSocket delivery
  • Have direct conversations with other users
  • See online/offline presence status
  • Moderate content with role-based permissions

Architecture

┌─────────────────────────────────────────────────────────────────────────────────┐
│                              RTCP Architecture                                  │
├─────────────────────────────────────────────────────────────────────────────────┤
│                                                                                 │
│  ┌──────────────────┐         ┌───────────────────────────────────────────────┐ │
│  │                  │         │              Backend Services                 │ │
│  │    Frontend      │◄───────►│  ┌─────────────────────────────────────────┐  │ │
│  │   (React/TS)     │   HTTP  │  │              API Gateway                │  │ │
│  │                  │   /WS   │  │  (Auth, Rate Limiting, Routing)         │  │ │
│  │  • Modern UI     │         │  └─────────────────┬───────────────────────┘  │ │
│  │  • Real-time     │         │                    │                          │ │
│  │  • Mock Support  │         │  ┌─────────────────┼────────────────┐         │ │
│  │                  │         │  │                 │                │         │ │
│  └──────────────────┘         │  ▼                 ▼                ▼         │ │
│                               │ ┌────────┐ ┌────────────┐ ┌──────────────┐    │ │
│                               │ │Identity│ │   Guild    │ │   Message    │    │ │
│                               │ │Service │ │  Service   │ │   Service    │    │ │
│                               │ └───┬────┘ └─────┬──────┘ └──────┬───────┘    │ │
│                               │     │            │               │            │ │
│                               │     └────────────┼───────────────┘            │ │
│                               │                  ▼                            │ │
│                               │  ┌───────────────────────────────────────┐    │ │
│                               │  │         Event Bus (RabbitMQ)          │    │ │
│                               │  └───────────────────┬───────────────────┘    │ │
│                               │                      │                        │ │
│                               │                      ▼                        │ │
│                               │  ┌───────────────────────────────────────┐    │ │
│                               │  │    Delivery Service (WebSocket Hub)   │    │ │
│                               │  └───────────────────────────────────────┘    │ │
│                               └───────────────────────────────────────────────┘ │
│                                                                                 │
│  ┌───────────────────────────────────────────────────────────────────────────┐  │
│  │                              Infrastructure                               │  │
│  │  ┌──────────┐  ┌──────────┐  ┌───────────┐  ┌──────────┐  ┌────────────┐  │  │
│  │  │PostgreSQL│  │  Redis   │  │ RabbitMQ  │  │Prometheus│  │  Grafana   │  │  │
│  │  │  (Data)  │  │ (Cache)  │  │ (Events)  │  │(Metrics) │  │(Dashboard) │  │  │
│  │  └──────────┘  └──────────┘  └───────────┘  └──────────┘  └────────────┘  │  │
│  └───────────────────────────────────────────────────────────────────────────┘  │
└─────────────────────────────────────────────────────────────────────────────────┘

Project Structure

Playground/
├── rtcp-backend/           # Go microservices backend
│   ├── cmd/               # Service entry points
│   ├── internal/          # Shared packages
│   ├── services/          # Business logic
│   ├── deployments/       # Docker, Kubernetes
│   └── docs/              # Architecture docs
│
├── rtcp-frontend/          # React/TypeScript web frontend
│   ├── src/
│   │   ├── api/          # API client & services
│   │   ├── components/   # React components
│   │   ├── hooks/        # Custom hooks
│   │   ├── pages/        # Page components
│   │   └── store/        # Zustand stores
│   └── ...
│
├── rtcp-mobile/            # React Native/Expo mobile app
│   ├── app/               # Expo Router screens
│   ├── src/               # Source code
│   │   ├── api/          # API client
│   │   ├── components/   # UI components
│   │   └── store/        # Zustand stores
│   └── ...
│
├── rtcp-tester app/        # Visual testing tool
│   └── index.html         # Single-page tester
│
└── README.md               # This file

Quick Start

Prerequisites

  • Docker & Docker Compose
  • Node.js 18+ (for frontend development)
  • Go 1.23+ (for backend development)

1. Start the Backend

cd rtcp-backend/deployments/docker

# Windows
./start.ps1

# Linux/Mac
./start.sh

This starts all services:

  • PostgreSQL - Database
  • Redis - Caching & rate limiting
  • RabbitMQ - Event messaging
  • All microservices - Identity, Guild, Message, etc.
  • Prometheus & Grafana - Monitoring
  • Jaeger - Distributed tracing

2. Start the Frontend

cd rtcp-frontend

# Install dependencies
npm install

# Start development server
npm run dev

3. Access the Application

Service URL Credentials
Frontend http://localhost:5173 (Register or use mock mode)
API Gateway http://localhost:8080 -
RabbitMQ http://localhost:15672 guest / guest
Grafana http://localhost:3001 admin / admin
Prometheus http://localhost:9090 -
Jaeger http://localhost:16686 -

Key Features

Backend Features

Feature Description
Microservices 8 independent services with clear boundaries
Event-Driven RabbitMQ with transactional outbox pattern
Distributed Caching Redis for caching and rate limiting
Distributed Locking Redlock for consistency
Dead Letter Queue Failed event handling with admin API
Saga Pattern Distributed transaction management
Observability Prometheus, Grafana, Jaeger integration
Testing Unit tests with 80%+ coverage

Frontend Features

Feature Description
Mock-First Works without backend (for development)
Real-Time WebSocket for live updates
Type-Safe Full TypeScript support
Modern UI TailwindCSS with dark theme
State Management Zustand for predictable state
Developer Tools Built-in endpoint health monitor

Development

Backend Development

cd rtcp-backend

# Run tests
go test ./...

# Run specific service
go run ./cmd/gateway

# Build all
go build ./...

Frontend Development

cd rtcp-frontend

# Development mode (with mocks)
npm run dev

# Connect to real backend
# Edit .env.development:
VITE_USE_MOCK_DATA=false
VITE_MOCK_WEBSOCKET=false

Testing

Backend Tests

cd rtcp-backend

# Unit tests
go test ./internal/... -v

# Integration tests (requires Docker)
go test ./tests/integration/... -v

# With coverage
go test ./internal/... -cover

Frontend Tests

cd rtcp-frontend

# (Tests can be run when configured)
npm test

Monitoring & Observability

Grafana Dashboard

Pre-configured dashboard showing:

  • Request rate by service
  • P95 latency
  • Error rates
  • HTTP status distribution

Prometheus Metrics

Available at /metrics on each service:

  • http_requests_total
  • http_request_duration_seconds
  • http_requests_in_flight

Jaeger Tracing

Distributed tracing across all services:

  • Request flow visualization
  • Latency breakdown
  • Error tracking

Security Features

  • JWT authentication with HTTP-only cookies
  • bcrypt password hashing (cost 12)
  • Rate limiting (sliding window algorithm)
  • Input validation on all endpoints
  • CORS configuration

Documentation

Document Location
Backend README rtcp-backend/README.md
Frontend README rtcp-frontend/README.md
Mobile README rtcp-mobile/README.md
Tester Tool rtcp-tester app/README.md
System Design rtcp-backend/docs/SYSTEM_DESIGN.md
Implementation Plan rtcp-backend/docs/IMPLEMENTATION_PLAN.md
Architecture Diagrams rtcp-backend/docs/Diagrams and Blueprints/

Roadmap

  • Voice channels (WebRTC)
  • File uploads
  • Message search (Elasticsearch)
  • Push notifications
  • Mobile apps (React Native)
  • Kubernetes deployment configs

License

This project is for educational and demonstration purposes.


[Backend](rtcp-backend/) · [Frontend](rtcp-frontend/) · [Mobile](rtcp-mobile/) · [Documentation](rtcp-backend/docs/)

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published