A comprehensive LeetCode-style coding platform built with microservices architecture, enabling users to solve coding challenges, compile code in multiple languages, and participate in competitive programming. The platform features real-time code execution, problem management, user authentication, and live coding challenges.
zenx is the overall project name, while xcode refers to the backend microservices collectively.
Live Platform: zenxbattle.space
Frontend Repository: zenxfrontend
Each service in the xcode platform is designed to be independently deployable and maintainable. For detailed setup instructions, deployment procedures, and configuration options, please refer to the individual service repositories listed below.
- Auth & User Service - Core authentication and user management
- Problem Service - Problem repository and management
- Code Engine - Code compilation and execution
- Challenge WebSocket Manager - Real-time challenge features
- API Gateway - Central routing and request handling
This repository includes a Docker configuration for API Gateway deployment:
# Build the API Gateway image
docker build -t api-gateway .
# Run the API Gateway container
docker run -p 8080:8080 --env-file .env api-gatewayThe API Gateway serves as the entry point for client requests and routes them to appropriate microservices.
| Service | Repository | Description | Self-Host Documentation | Environment Example |
|---|---|---|---|---|
| API Gateway | xcodeApiGateway | Central routing and request handling gateway | Setup Guide | .env.example |
| Code Engine | xcodeEngine | Core code execution and compilation service | Setup Guide | .env.example |
| Problem Service | xcodeProblemService | Manages coding problems and challenges | Setup Guide | .env.example |
| Auth & User Service | xcodeAuthUserAdminService | Authentication, user management, and admin operations | Setup Guide | .env.example |
| Challenge WebSocket Manager | ChallengeWssManagerService | Real-time challenge management and WebSocket connections | Setup Guide | .env.example |
The services communicate with each other through:
- gRPC for high-performance service-to-service communication using shared proto definitions
- NATS messaging for asynchronous communication
- REST APIs for synchronous operations
- WebSocket connections for real-time features
All services use gRPC for efficient, type-safe inter-service communication. The platform leverages a centralized proto definition repository:
- Proto Repository: GlobalProtoXcode
- Generated Stubs: Available as Go module via
go get github.com/lijuuu/GlobalProtoXcode - Service Contracts: Shared proto definitions ensure consistent APIs across all microservices
- Type Safety: Strongly typed service interfaces with automatic code generation
- Problem Solving: Browse and solve coding problems across multiple difficulty levels
- Multi-Language Support: Code compilation and execution for Go, Python, and JavaScript
- Real-time Challenges: Live coding competitions with WebSocket-based real-time updates
- User Management: Comprehensive authentication and user profile system
- Leaderboards: High-performance Redis-based leaderboards using RedisBoard for real-time ranking and competitive tracking
- Code Editor: In-browser code editor with syntax highlighting
- Test Cases: Automated testing with predefined test cases
- Admin Panel: Manage problems, challenges, and user accounts
- Dockerized: Easy deployment and scaling with Docker
Each service exposes its own API endpoints:
- Auth Service: User authentication and management
- Problem Service: CRUD operations for coding problems
- Code Engine: Code compilation and execution
- Challenge Manager: Real-time challenge coordination
For detailed API documentation, refer to individual service repositories.
- Backend: Go (Gin framework)
- Caching: Ristretto (Token Invalidation)
- Authentication: JWT
- Logging: Zap with BetterStack integration
- Containerization: Docker
- Microservices Architecture: Scalable and maintainable service separation
- Real-time Communication: WebSocket support for live challenges
- Code Execution: Secure sandboxed code compilation and execution
- Distributed Messaging: NATS-based inter-service communication
- Comprehensive Logging: Structured logging with external monitoring
- JWT Authentication: Secure token-based authentication
- Fork the relevant repository
- Create a feature branch (
git checkout -b feature/new-feature) - Commit your changes (
git commit -m 'Add some new feature') - Push to the branch (
git push origin feature/new-feature) - Open a Pull Request
This project is licensed under the MIT License - see the LICENSE file for details.
- Code Engine Service
- Problem Management Service
- Authentication & User Service
- Challenge WebSocket Manager
For support and questions:
- Create an issue in the relevant repository
- Contact the development team
Note: This README provides an overview of the entire ZenX platform. For service-specific setup instructions and deployment procedures, please refer to individual repository documentation linked above.