Skip to content
Β 
Β 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

964 Commits
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

Rallyu - Online Gaming Platform

Rallyu is a modern, scalable online gaming platform built with a microservices architecture. It provides real-time multiplayer gaming experiences with features like tournaments, matchmaking, chat, and comprehensive player statistics.

🎯 Features

  • Real-time Multiplayer Gaming: Engage in competitive matches with players worldwide
  • Tournament System: Organize and participate in gaming tournaments
  • Intelligent Matchmaking: Advanced algorithms to match players of similar skill levels
  • Live Chat: Real-time communication between players
  • User Authentication: Secure JWT-based authentication and authorization
  • Notifications: Real-time push notifications for game events
  • Statistics & Analytics: Comprehensive player statistics and game analytics
  • Responsive UI: Modern, responsive frontend built with Next.js

πŸ—οΈ Architecture

Rallyu follows a microservices architecture with the following components:

Frontend

  • Next.js 15 - React framework with server-side rendering
  • TypeScript - Type-safe development
  • Tailwind CSS - Modern utility-first CSS framework
  • Socket.io Client - Real-time bidirectional communication
  • i18n - Multi-language support

Backend Microservices

  • API Gateway - Central entry point for all client requests, handles routing and WebSocket connections
  • ms-auth - Authentication and authorization service (SQLite)
  • ms-game - Game logic and state management
  • ms-tournament - Tournament creation and management (SQLite)
  • ms-matchmaking - Player matchmaking and lobby management
  • ms-chat - Real-time chat functionality (SQLite)
  • ms-notif - Push notification service (SQLite)

Infrastructure Services

  • NGINX - Reverse proxy and load balancer with SSL/TLS support
  • Redis - In-memory data store for caching and session management
  • NATS - Message broker for inter-service communication

DevOps & Monitoring

  • Prometheus - Metrics collection and monitoring
  • Grafana - Metrics visualization and dashboards
  • Elasticsearch - Log aggregation and search
  • Logstash - Log processing pipeline
  • Kibana - Log visualization and analysis
  • HashiCorp Vault – Secure secrets management for credentials and API keys.

In this project, Vault is configured but not actively used.

πŸ› οΈ Technology Stack

Frontend

  • Next.js 15.5.3
  • React 19.1.0
  • TypeScript 5.8.3
  • Tailwind CSS 4.1.3
  • Socket.io Client 4.8.1
  • Axios 1.9.0
  • Framer Motion 12.19.2

Backend

  • Node.js (v20+)
  • Fastify 5.4.0
  • TypeScript 5.9.2
  • Socket.io 4.8.1
  • NATS 2.29.3
  • JWT Authentication
  • SQLite (for microservices databases)

DevOps

  • Docker & Docker Compose v2.20+
  • NGINX
  • Prometheus
  • Grafana
  • ELK Stack (Elasticsearch, Logstash, Kibana)
  • Redis Alpine 3.22
  • NATS Alpine 3.22

πŸ“‹ Prerequisites

Before you begin, ensure you have the following installed:

  • Node.js: v20 or above
  • npm: v11.3.0 or above
  • Docker: Latest version
  • Docker Compose: v2.20 or above (v2.30.0 recommended)
  • Git: For version control
  • Make: For using Makefile commands

πŸš€ Installation & Setup

1. Clone the Repository

git clone https://github.com/ismailassil/rallyu.git
cd rallyu

2. Environment Configuration

The project uses environment variables for configuration. Run the environment setup script:

make env

This will execute ./env-script/spread-env.sh to distribute environment variables across all services.

3. Docker Setup (Optional)

If you don't have Docker Compose v2.30.0, install it:

make docker

4. Start the Application

Start Application Only

make up_app

This will:

  • Build and start all application services (frontend, backend microservices, NGINX)
  • Enable watch mode for automatic rebuilds on code changes
  • Services will be accessible at http://localhost or https://localhost

Start Application + DevOps Services

make up_all

This starts both the application and DevOps services (monitoring and logging).

πŸ“– Usage

Makefile Commands

The project includes a comprehensive Makefile for easy management:

Application Management

make up_app          # Start application services
make down_app        # Stop application services
make clean_app       # Stop and remove containers and volumes
make ps_app          # List application containers with status
make re_app          # Rebuild and restart application

DevOps Services Management

make up_devops       # Start monitoring and logging services
make down_devops     # Stop DevOps services
make clean_devops    # Stop and remove DevOps containers and volumes
make ps_devops       # List DevOps containers with status
make re_devops       # Rebuild and restart DevOps services

Complete System Management

make up_all          # Start all services (app + devops)
make down_all        # Stop all services
make clean_all       # Clean all containers and volumes
make fclean          # Full cleanup (containers, volumes, images)
make prune           # Remove all unused Docker resources

Environment & Dependencies

make env             # Load environment variables
make docker          # Install Docker Compose 2.30.0
make help            # Display help information

πŸ“‚ Project Structure

rallyu/
β”œβ”€β”€ app/
β”‚   β”œβ”€β”€ frontend/              # Next.js frontend application
β”‚   β”‚   β”œβ”€β”€ src/
β”‚   β”‚   β”‚   β”œβ”€β”€ app/          # Next.js app directory
β”‚   β”‚   β”‚   └── messages/     # i18n message files
β”‚   β”‚   β”œβ”€β”€ public/           # Static assets
β”‚   β”‚   β”œβ”€β”€ Dockerfile
β”‚   β”‚   └── package.json
β”‚   β”‚
β”‚   β”œβ”€β”€ backend/              # Backend microservices
β”‚   β”‚   β”œβ”€β”€ api-gateway/     # API Gateway service
β”‚   β”‚   β”œβ”€β”€ ms-auth/         # Authentication service
β”‚   β”‚   β”œβ”€β”€ ms-game/         # Game logic service
β”‚   β”‚   β”œβ”€β”€ ms-tournament/   # Tournament service
β”‚   β”‚   β”œβ”€β”€ ms-matchmaking/  # Matchmaking service
β”‚   β”‚   β”œβ”€β”€ ms-chat/         # Chat service
β”‚   β”‚   β”œβ”€β”€ ms-notif/        # Notification service
β”‚   β”‚   └── compose.backend.yaml
β”‚   β”‚
β”‚   └── compose.app.yaml      # Frontend compose configuration
β”‚
β”œβ”€β”€ devops/
β”‚   β”œβ”€β”€ monitoring/           # Prometheus & Grafana
β”‚   β”‚   β”œβ”€β”€ prometheus/       # Prometheus configuration
β”‚   β”‚   β”œβ”€β”€ grafana/          # Grafana dashboards
β”‚   β”‚   β”œβ”€β”€ backend-exporter/ # Custom metrics exporter
β”‚   β”‚   └── compose.monitoring.yaml
β”‚   β”‚
β”‚   β”œβ”€β”€ logging/              # ELK Stack
β”‚   β”‚   β”œβ”€β”€ elasticsearch-policy/
β”‚   β”‚   β”œβ”€β”€ logstash/
β”‚   β”‚   β”œβ”€β”€ kibana/
β”‚   β”‚   └── compose.logging.yaml
β”‚   β”‚
β”‚   └── compose.devops.yaml   # Main DevOps compose file
β”‚
β”œβ”€β”€ nginx/                    # NGINX reverse proxy
β”‚   β”œβ”€β”€ conf/                 # NGINX configurations
β”‚   β”œβ”€β”€ logs/                 # NGINX logs
β”‚   └── Dockerfile
β”‚
β”œβ”€β”€ docker-compose.yaml       # Main Docker Compose file
β”œβ”€β”€ Makefile                  # Build and deployment automation
β”œβ”€β”€ .env                      # Environment variables
└── README.md                 # This file

🌐 Service Endpoints

Once the application is running, you can access:

πŸ”§ Development

Hot Reload

The application is configured with Docker Compose watch mode, enabling hot reload during development:

  • Frontend changes are synced automatically
  • Backend microservices sync source code changes
  • Package.json changes trigger rebuilds

Adding Dependencies

For frontend:

cd app/frontend
npm install <package-name>

For backend services:

cd app/backend/<service-name>
npm install <package-name>

Database Management

Each microservice that requires persistence uses SQLite:

  • ms-auth: app/backend/ms-auth/src/database/database.db
  • ms-tournament: app/backend/ms-tournament/database/tournament.db
  • ms-chat: app/backend/ms-chat/database/database.sqlite
  • ms-notif: app/backend/ms-notif/database/database.sqlite

These databases are mounted as volumes for data persistence.

πŸ“Š Monitoring & Logging

Prometheus Metrics

Prometheus collects metrics from:

  • NGINX (via nginx-prometheus-exporter)
  • Backend services (custom metrics via fastify-metrics)
  • System metrics

Grafana Dashboards

Grafana provides pre-configured dashboards for:

  • Application performance monitoring
  • Request rates and latencies
  • Error rates
  • Resource utilization

Access Grafana at https://localhost:3035 after running make up_devops.

ELK Stack Logging

Centralized logging with Elasticsearch, Logstash, and Kibana:

  • Logstash processes and transforms logs
  • Elasticsearch stores and indexes logs
  • Kibana provides search and visualization

Access Kibana at https://localhost:5601 after running make up_devops.

πŸ” Security

  • JWT-based authentication
  • NGINX reverse proxy with rate limiting
  • Helmet.js for security headers
  • CORS configuration
  • Environment-based secrets management
  • SSL/TLS support

πŸ› Troubleshooting

Services not starting

# Check service status
make ps_app

# Check logs
docker-compose logs <service-name>

# Restart services
make re_app

Port conflicts

Ensure the following ports are available:

  • 80, 443 (NGINX)
  • 3000 (Frontend - internal)
  • 4025 (API Gateway - internal)
  • 4222 (NATS - internal)
  • 6379 (Redis - internal)

Clean slate restart

make fclean  # Remove everything
make up_all  # Start fresh

πŸ“ License

This project is proprietary software.

πŸ‘₯ Authors

About

A modern, web-based version of the classic Pong game with real-time multiplayer, responsive controls, and integration with user profiles and match history.

Resources

Stars

Watchers

Forks

Releases

Packages

Contributors

Languages