Backend API for Ruleta Familiar, a real-time multiplayer game show inspired by SquidCraft, built with Laravel 12, Reverb (WebSockets), and designed for 30-50 simultaneous players.
- Backend: Laravel 12 (PHP 8.2+)
- WebSockets: Laravel Reverb
- Database: MySQL 8 / MariaDB
- Cache/Queue: Redis
- Storage: RustFS (S3-compatible)
- Audio: ElevenLabs API / TopMediai API
- Deployment: Docker + Dokploy + Traefik
- PHP 8.2+ with extensions: redis, mbstring, curl, pdo, bcmath, tokenizer, dom, gd, fileinfo, xml, zip
- Composer 2.x
- Node.js 22+
- MySQL 8.0+ or MariaDB (local or Docker)
- Redis (local or Docker)
- Dokploy configured with Traefik
- MySQL database (external)
- Redis (can be in container)
- Domain configured in Traefik for automatic SSL
git clone <repository-url>
cd ruleta-api
composer install
npm installcp .env.example .env
php artisan key:generateEdit .env and configure:
- Database credentials
- Redis connection
- RustFS/S3 credentials
- ElevenLabs API key
- Frontend URL for CORS
php artisan migrate
php artisan db:seedOption A: Multiple terminals
# Terminal 1: Laravel server
php artisan serve --host=0.0.0.0 --port=8000
# Terminal 2: Reverb WebSocket server
php artisan reverb:start --host=0.0.0.0 --port=8080
# Terminal 3: Queue worker
php artisan queue:work redis --sleep=3 --tries=3
# Terminal 4 (optional): Vite dev server
npm run devOption B: Using composer script
composer devapp/
├── Domain/ # Domain-driven design layers
│ ├── Show/ # Show management
│ ├── Game/ # Game logic (6 games)
│ ├── Player/ # Player management
│ ├── Audio/ # Audio system
│ ├── Achievement/ # 35+ achievements
│ └── Audit/ # Audit logging
├── Services/ # Application services
├── Events/ # WebSocket events (28+)
├── Http/Controllers/ # API controllers
└── Models/ # Eloquent models
- 🎮 6 Games: 4 elimination games + 2 bonus games
- 🏆 Achievement System: 35+ unlockable achievements
- 📊 Unified Scoreboard: Normalized scoring across all games
- 🔊 3-Channel Audio: Music, SFX, and voice with independent volume control
- 🌐 Real-time WebSockets: 28+ event types via Reverb
- 🔐 PIN Reconnection: 4-digit PIN for reconnecting players
- 📝 Audit System: Dual storage (DB 30 days + S3 permanent)
- 🌍 i18n Support: Spanish (Colombian) + English
- Millionaire - Q&A game (Who Wants to Be a Millionaire style)
- The Rope - Group click competition with 3D visualization
- Spell It - Word spelling with audio validation
- The Wheel (Final) - Cumulative points roulette
- Word Search (Bonus) - 15×15 word search, non-eliminatory
- Flappy Bird (Bonus) - Survival game, non-eliminatory
php artisan test./vendor/bin/pintphp artisan pailSet these in Dokploy:
APP_ENV=production
APP_DEBUG=false
APP_URL=https://api.yourdomain.com
DB_HOST=<mysql-host>
DB_DATABASE=<database>
DB_USERNAME=<username>
DB_PASSWORD=<password>
REVERB_APP_KEY=<production-key>
REVERB_APP_SECRET=<production-secret>
WEB_APP_URL=https://yourdomain.comConfigure 2 routers in Dokploy:
-
API Router (port 80)
- Host:
api.yourdomain.com - Container port: 80
- SSL: Automatic
- Host:
-
WebSocket Router (port 8080)
- Host:
api.yourdomain.comorws.yourdomain.com - Container port: 8080
- SSL: Automatic
- Headers: Configure
UpgradeandConnectionfor WebSocket
- Host:
Dokploy will automatically:
- Build Docker image
- Run migrations
- Start Supervisor (Nginx + PHP-FPM + Reverb + Queue Workers + Redis)
- Configure SSL via Traefik
Full documentation available in .ai-context-backend/:
- Goals: Project overview and objectives
- Implementation: Step-by-step implementation guides (18 steps)
- Knowledge: Technical documentation (architecture, systems, schemas)
- Rules: Implementation rules and contracts
POST /api/auth/register- Register playerPOST /api/auth/login- Login with PINPOST /api/auth/logout- Logout
GET /api/shows- List showsPOST /api/shows- Create show (supervisor)GET /api/shows/{id}- Show detailsPOST /api/shows/{id}/start- Start showGET /api/games/{id}- Game state
Connect to: ws://localhost:8080 (dev) or wss://api.yourdomain.com (prod)
See .ai-context-backend/knowledge/reverb-websockets.md for full event list.
MIT License
Version: 1.0
Last Updated: December 2025
- Simple, fast routing engine.
- Powerful dependency injection container.
- Multiple back-ends for session and cache storage.
- Expressive, intuitive database ORM.
- Database agnostic schema migrations.
- Robust background job processing.
- Real-time event broadcasting.
Laravel is accessible, powerful, and provides tools required for large, robust applications.
Laravel has the most extensive and thorough documentation and video tutorial library of all modern web application frameworks, making it a breeze to get started with the framework. You can also check out Laravel Learn, where you will be guided through building a modern Laravel application.
If you don't feel like reading, Laracasts can help. Laracasts contains thousands of video tutorials on a range of topics including Laravel, modern PHP, unit testing, and JavaScript. Boost your skills by digging into our comprehensive video library.
We would like to extend our thanks to the following sponsors for funding Laravel development. If you are interested in becoming a sponsor, please visit the Laravel Partners program.
Thank you for considering contributing to the Laravel framework! The contribution guide can be found in the Laravel documentation.
In order to ensure that the Laravel community is welcoming to all, please review and abide by the Code of Conduct.
If you discover a security vulnerability within Laravel, please send an e-mail to Taylor Otwell via taylor@laravel.com. All security vulnerabilities will be promptly addressed.
The Laravel framework is open-sourced software licensed under the MIT license.