A real-time multiplayer word game platform built with Go, featuring WebSocket-based gameplay, chat functionality, and Google OAuth authentication.
The React Native mobile app for this backend is available at: Playzio-app
WhatsApp.Video.2025-08-05.at.10.18.20.PM.mp4
- 🎯 Real-time Multiplayer Gameplay: Turn-based word game with up to 10 players per room
- 💬 Live Chat: Real-time chat functionality with Redis support
- 🔐 Google OAuth Authentication: Secure user authentication via Google
- 🏠 Room Management: Create and join game rooms
- ⏱️ Timer System: Configurable time limits for turns (5-20 seconds)
- 🏆 Scoring System: Lives and points tracking
- 🔄 WebSocket Communication: Real-time bidirectional communication
- 📦 Dockerized: Easy deployment with Docker Compose
- Backend: Go (Gin framework)
- Database: PostgreSQL with GORM
- Cache: Redis
- WebSockets: Gorilla WebSocket
- Authentication: Google OAuth 2.0
- Containerization: Docker & Docker Compose
Playzio/
├── api/                    # API controllers and routes
│   ├── controller/         # HTTP and WebSocket controllers
│   ├── middleware/         # Authentication middleware
│   └── routes/            # Route definitions
├── bootstrap/             # Application initialization
│   ├── database/          # Database configuration
│   ├── redis/             # Redis configuration
│   └── util/              # Utility functions
├── cmd/                   # Application entry point
├── domain/                # Domain models and DTOs
│   ├── dto/               # Data Transfer Objects
│   └── model/             # Database models
├── repository/            # Data access layer
├── usecase/               # Business logic layer
├── websocket/             # WebSocket handlers and game logic
└── docker-compose.yaml    # Docker services configuration
- Go 1.24.2 or higher
- PostgreSQL 15+
- Redis 7.2+
- Docker & Docker Compose (optional)
- Google OAuth 2.0 credentials
git clone https://github.com/lakshya1goel/Playzio.git
cd PlayzioCreate a .env file in the root directory with the following variables:
# Database Configuration
DB_HOST=your_db_host
DB_PORT=your_db_port
DB_USER=your_db_user
DB_PASSWORD=your_db_password
DB_NAME=your_db_name
# Redis Configuration
REDIS_HOST=your_redis_host
REDIS_PORT=your_redis_port
REDIS_PASSWORD=your_redis_password
REDIS_DB=your_redis_db_number
# Google OAuth Configuration
GOOGLE_CLIENT_ID=your_google_client_id
GOOGLE_CLIENT_SECRET=your_google_client_secret
GOOGLE_REDIRECT_URI=your_google_redirect_uri# Database Configuration
DB_HOST=localhost
DB_PORT=5432
DB_USER=postgres
DB_PASSWORD=postgres
DB_NAME=playzio
# Redis Configuration
REDIS_HOST=localhost
REDIS_PORT=6379
REDIS_PASSWORD=
REDIS_DB=0
# Google OAuth Configuration
GOOGLE_CLIENT_ID=your_actual_google_client_id
GOOGLE_CLIENT_SECRET=your_actual_google_client_secret
GOOGLE_REDIRECT_URI=http://localhost:8000/auth/google/callbackFor detailed Google OAuth setup instructions, follow this guide: Google OAuth Implementation using React Native and Golang
# Start PostgreSQL and Redis services
docker-compose up -d
# Install Go dependencies
go mod tidy
# Run the application
go run cmd/main.go- Room Creation: Any authenticated user can create a game room
- Joining: Players can join rooms with available slots (max 10 players)
- Game Start: Game begins with a 2-minute countdown when the first player joins
- Turns: Players take turns providing answers within the time limit (5-20 seconds)
- Lives: Each player starts with 3 lives
- Scoring: Points are awarded for correct answers
- Game End: Game ends when only one player remains or all players are eliminated
The project follows a clean architecture pattern:
- API Layer: HTTP handlers and WebSocket controllers
- Use Case Layer: Business logic implementation
- Repository Layer: Data access abstraction
- Domain Layer: Core business entities and models
- Define models in domain/model/
- Create DTOs in domain/dto/
- Implement repository interfaces in repository/
- Add business logic in usecase/
- Create controllers in api/controller/
- Define routes in api/routes/
- 
Production Environment: - Update .envwith production values
- Use a production-ready PostgreSQL instance
- Configure Redis for production
- Set up proper Google OAuth redirect URIs
 
- Update 
- 
Docker Deployment: # Build and run with Docker Compose docker-compose up --build -d
- Fork the repository
- Create a feature branch (git checkout -b feature/amazing-feature)
- Commit your changes (git commit -m 'Add some amazing feature')
- Push to the branch (git push origin feature/amazing-feature)
- Open a Pull Request
Lakshya Goel
- Email: [email protected]
- GitHub: @lakshya1goel
If you encounter any issues or have questions, please open an issue on GitHub.
Happy Gaming! 🎮