# 🎮 Lila Games **Deployed Game:** [https://games.aetoskia.com](https://games.aetoskia.com) --- ## 🚀 Projects ### 🔷 **1. tic-tac-toe (Backend)** **Nakama 3 + Go Plugin • Authoritative Multiplayer Server** * Device authentication * Matchmaking queues * Authoritative match handler * Win/loss/draw validation * Disconnect → forfeit * Leaderboards * ARM-optimized Docker build * Automated CI/CD with Drone * Traefik WebSocket routing (`/ws`) 🔗 **Repo:** [https://git.aetoskia.com/lila-games/tic-tac-toe](https://git.aetoskia.com/lila-games/tic-tac-toe) --- ### 🔶 **2. tic-tac-toe-ui (Frontend)** **React + TypeScript + Vite** Production-grade multiplayer game client. * Device auth * Matchmaking * Real-time WebSocket gameplay * Authoritative board sync * Leaderboards * BusyBox-powered production Docker build 🔗 **Repo:** [https://git.aetoskia.com/lila-games/tic-tac-toe-ui](https://git.aetoskia.com/lila-games/tic-tac-toe-ui) --- ## 🛠 Infrastructure ### **Traefik Routing** * `https://games.aetoskia.com` – UI * `https://nakama.aetoskia.com` – Nakama (HTTP + WS) * Full CORS configuration * WebSocket upgrade headers * Automatic Let's Encrypt TLS --- ### **PostgreSQL Stack** Lila Games uses a production-ready PostgreSQL 16 setup with: * `pg_stat_statements` enabled for performance insights * Persistent storage volumes * `.env`-driven secure configuration * Optional pgAdmin 4 UI for database administration This stack powers the authoritative match state, player accounts, and leaderboards. --- ## 🤖 CI/CD Pipeline Powered by **Drone CI**, our automated pipeline handles: * Auto-detecting the latest Git tags * Skipping builds if an image already exists * Building Nakama + Go plugin (CGO-enabled) * Pushing production images to the private registry * Stopping old containers and deploying new ones * Supporting ARM/x86 builds ### Deployment Flowchart ```mermaid flowchart TD DevPush[Developer pushes Git tag] --> Drone[Drone CI Pipeline] Drone --> FetchTags[Fetch latest Git tags] FetchTags --> CheckImage[Check if Docker image exists] CheckImage -->|Image missing| Build[Build Docker Image] CheckImage -->|Image exists| Skip[Skip Build] Build --> Push[Push Image to Private Registry] Skip --> Deploy[Deploy Step] Push --> Deploy[Deploy Step] Deploy --> StopOld[Stop Old Nakama Container] StopOld --> RunNew[Run New Nakama Container] RunNew --> Live[Production Server Updated] ``` Powered by **Drone CI**: * Auto-detect latest Git tags * Skip builds if image exists * Build Nakama Go plugin (CGO-enabled) * Push to private registry * Stop old containers + deploy new * ARM-compatible builds for Raspberry Pi clusters --- ## 🐳 Docker & Deployment Our entire stack runs via Docker: * Backend image (`heroiclabs/nakama:arm`) * Go plugin layer * Frontend: Node → Vite → BusyBox * Traefik reverse proxy * PostgreSQL + pgAdmin Cloud-ready for: * Google Cloud (Compute Engine + Cloud SQL) * AWS EC2 * Bare metal * Raspberry Pi homelabs ## 📫 Contact Want to collaborate or review the backend architecture? **Website:** [https://games.aetoskia.com](https://games.aetoskia.com) **GitHub:** [https://git.aetoskia.com/lila-games](https://git.aetoskia.com/lila-games) **Tech Stack:** Go, Nakama, PostgreSQL, React, Vite, Docker, Traefik, Drone CI ---