SkyPong is a production-style multiplayer Pong platform built as a microservices architecture. The core is a real-time 3D Pong game with server-authoritative physics, PBR rendering, and multiple game modes. Around it sits a full product platform with authentication, profiles, social features, and game statistics.
This is a reupload with a fresh frontend UI of a project originally built by a team of 4 developers. The new version features a complete redesign of the Next.js web application with a unified design system while keeping the robust game engine and backend services intact.
- Web application โ Next.js (React), TypeScript, Tailwind v4, class-variance-authority, i18n (EN/ES/IT)
- Game client โ Babylon.js 8, React 18, Vite 5, Colyseus.js client
- Game server โ Colyseus 0.15, Babylon.js NullEngine (headless physics), Express
- Backend services โ Fastify, SQLite, JWT (Argon2), Sharp (avatar processing)
- Infrastructure โ Docker Compose, NGINX (TLS gateway), Prometheus, Grafana, Alertmanager
- Real-time sync โ WebSocket via Colyseus, Schema-based state diffs, client-side interpolation
- Physics โ Server-authoritative, continuous collision detection, angle-based bounce response
- Rendering โ PBR materials, EXR environment maps, refractive glass, real-time shadows
- Design system โ Unified design tokens, full CVA component library, responsive mobile layout
A complete redesign of the Next.js web application targeting consistency, maintainability, and scalable UI:
- Design tokens โ Single source of truth with TypeScript types for colors, typography, spacing, shadows
- Component library โ Full class-variance-authority patterns (Button, Card, TextField, Chip, Avatar, Badge, StatCard, Tabs)
- Pattern components โ Section, ListRow, EmptyState, LoadingState, PageContainer, FormCard, ProfileLayout
- Simplified CSS โ Reduced globals.css from 1300 to ~250 lines
- Background & shadow tokens โ Unified system replacing hardcoded values
- Navbar โ Auth-aware navigation with scroll behavior, dropdown menu
- Homepage โ Hero section, Footer, LanguageSelector, interactive PBR marble ball CTA
- Game scene background โ Babylon.js rotating EXR skybox integrated into Next.js layout
- i18n โ 477 translation keys verified across English, Spanish, and Italian
- TypeScript โ Strict typing on auth context, translation context, form validation
- Color system โ Updated from purple to slate palette for better contrast
Client (Browser) Gateway (NGINX) Services (Docker)
โโโโโโโโโโโโโโโโโโโโ โโโโโโโโโโโโโโโโโโโโ โโโโโโโโโโโโโโโโโโโโ
โ Next.js app โ โHTTPSโโบ โ TLS termination โ โ auth-service โ
โ (port 3000) โ โ Route mapping โโโโRESTโโโบโ profile-service โ
โ โ โ WebSocket proxy โ โ stats-service โ
โโโโโโโโโโโโโโโโโโโโค โโโโโโโโโโโโโโโโโโโโ โโโโโโโโโโโโโโโโโโโโค
โ Game client โ โWSโโโโบ โ โโโโWSโโโโโบโ game-service โ
โ (iframe/port 5173) โ โ โ โ (Colyseus) โ
โโโโโโโโโโโโโโโโโโโโ โโโโโโโโโโโโโโโโโโโโ โโโโโโโโโโโโโโโโโโโโ
โ
โโโโโโโดโโโโโโ
โ Observabilityโ
โ (Prometheus โ
โ Grafana) โ
โโโโโโโโโโโโโ
All external traffic enters via NGINX over HTTPS. Services communicate internally over Docker bridge networks with shared service tokens.
- Player sends input (keyboard/touch) via WebSocket message
- Server aggregates input, runs physics at 60 Hz (Babylon.js NullEngine)
- Server detects collisions (CCD), updates scores, broadcasts state diffs
- Client receives diffs, interpolates ball position toward extrapolated target
- Client renders at browser refresh rate (60-144 Hz)
- Game modes โ AI (3 difficulties), local 2-player, online PvP with room matchmaking
- PBR rendering โ Environment-based lighting, refractive glass paddles, marble materials, EXR skybox
- Server-authoritative โ Physics runs server-side (NullEngine), preventing cheating
- Real-time multiplayer โ WebSocket via Colyseus with 60 Hz server tick
- Client interpolation โ Exponential smoothing, wall reflection extrapolation, adaptive distance
- Design system โ TypeScript tokens, CVA components, unified shadows and backgrounds
- i18n โ Full UI in English, Spanish, and Italian with type-safe translation context
- Authentication โ JWT with access/refresh tokens, optional 2FA
- Social โ Friendship graph (send/accept/reject/block), global chat
- Statistics โ Game result ingestion, leaderboard aggregation
- Monitoring โ Prometheus metrics, Grafana dashboards, Alertmanager alerts
- Responsive โ Mobile touch controls, adaptive HUD sizing
skypong/
โโโ front/ # Next.js web application (redesigned)
โ โโโ app/
โ โโโ lib/design-tokens.ts # Single source of truth for design values
โ โโโ ui/base/ # CVA component library
โ โโโ ui/patterns/ # Reusable page patterns
โ โโโ ui/GameSceneBackground.tsx # Babylon.js skybox
โ โโโ ui/base/InteractiveMarbleBall.tsx # PBR marble CTA
โ
โโโ game/ # SkyPong game engine
โ โโโ client/src_cli/
โ โ โโโ game/GameLoop.ts # Interpolation + extrapolation
โ โ โโโ ui/GameHUD.ts # Real-time overlay
โ โ โโโ entities/ # Client-side ball/paddle/table
โ โโโ server/src_serv/
โ โ โโโ physics/PhysicsEngine.ts # Server-side physics (CCD, collision response)
โ โ โโโ rooms/ # Colyseus rooms (Game, AI, PvP)
โ โ โโโ entities/ # Server-side ball/paddle/table
โ โโโ common/ # Shared Schema, constants
โ
โโโ auth-service/ # Identity, tokens, 2FA
โโโ profile-service/ # Profiles, avatars, friendships
โโโ statistics-service/ # Stats, leaderboard
โโโ nginx-gateway/ # TLS termination + routing
โโโ prometheus/ # Metrics + alert rules
โโโ grafana/ # Dashboards
โโโ docker-compose.yml # Orchestrates all services
More detailed documentation is available in the repository:
- Game Engine README โ Full game architecture, PBR rendering, server setup, Docker deployment, troubleshooting
- Frontend README โ Next.js web application structure and components
- Design System README โ Design tokens, CVA components, refactoring documentation
- Auth Service README โ Authentication service API, JWT, 2FA
- Profile Service README โ Profile management, avatars, friendships
- Statistics Service README โ Game stats, leaderboard aggregation
| Layer | Technologies |
|---|---|
| Web App | Next.js, React 18, TypeScript, Tailwind v4, CVA |
| Game Client | Babylon.js 8, React 18, Vite 5, Colyseus.js |
| Game Server | Colyseus 0.15, Babylon.js NullEngine, Express, Node.js |
| Backend Services | Fastify, SQLite, JWT, Argon2, Sharp |
| Infrastructure | Docker, NGINX, Prometheus, Grafana |
| Languages | TypeScript (full-stack), CSS, GLSL |
- Docker + Docker Compose plugin
- GNU Make
- Git
git clone https://github.com/fabbbiodc/skypong
cd skypong
make config
make allThis will:
- Create
.envfrom.env.exampleif missing - Sync missing environment variables
- Generate
docker-compose.ymlfrom the template - Replace host path placeholders with local
./volumes/*paths - Build and start all containers
make up # Start all services
make down # Stop all services
make logs # View logs
make ps # Show container status- Main app:
https://localhost:8443 - Grafana:
https://localhost:3001

