A comprehensive platform for hosting algorithmic challenges and buildathon competitions, inspired by the OASIS from Ready Player One.
- Team Registration & Authentication: Google OAuth2.0 + traditional email/password
- Progressive Challenge System: Unlock challenges by completing previous ones
- Advanced Code Editor: Monaco Editor with multi-language support
- Real-time Code Execution: Judge0 API integration for instant feedback
- Flag Submission System: Submit flags to unlock buildathon challenges
- Buildathon Submissions: GitHub repository submission system
- Live Leaderboard: Real-time ranking updates via WebSocket
- Responsive Design: Mobile-friendly interface
- Admin Dashboard: Real-time statistics and monitoring
- Challenge Management: Create, edit, and manage challenges
- Team Management: View team details and manage accounts
- Submission Monitoring: Track all submissions with detailed views
- Real-time Updates: WebSocket-powered live data
- Node.js with Express.js
- MySQL database with Sequelize ORM
- JWT authentication + Passport.js for OAuth
- Socket.IO for real-time updates
- Judge0 API for code execution
- bcryptjs for password hashing
- React with Vite
- Tailwind CSS for styling
- Monaco Editor for code editing
- Socket.IO Client for real-time features
- React Router for navigation
- Axios for API calls
- Node.js (v16 or higher)
- MySQL database
- Judge0 API access (or local Judge0 instance)
git clone https://github.com/Kasun333/-Oasis-Protocol.git
cd oasis-protocolcd backend
npm installCreate .env file in the backend directory:
# Database Configuration
DB_HOST=your_mysql_host
DB_PORT=3306
DB_NAME=oasis_protocol
DB_USER=your_mysql_username
DB_PASSWORD=your_mysql_password
# JWT Configuration
JWT_SECRET=your_super_secret_jwt_key_here
JWT_EXPIRES_IN=7d
# Google OAuth Configuration
GOOGLE_CLIENT_ID=your_google_client_id
GOOGLE_CLIENT_SECRET=your_google_client_secret
GOOGLE_CALLBACK_URL=http://localhost:5000/api/auth/google/callback
# Judge0 Configuration
JUDGE0_API_URL=https://judge0-ce.p.rapidapi.com
JUDGE0_API_KEY=your_judge0_api_key
# Server Configuration
PORT=5000
NODE_ENV=development
FRONTEND_URL=http://localhost:5173# Initialize database with sample data
node scripts/init-db.jsnpm run devcd ../frontend
npm installCreate .env file in the frontend directory:
# API Configuration
VITE_API_URL=http://localhost:5000/api
VITE_SOCKET_URL=http://localhost:5000
# Google OAuth Configuration
VITE_GOOGLE_CLIENT_ID=your_google_client_idnpm run dev- Create a MySQL database named
oasis_protocol - Update database credentials in backend
.envfile - Run the initialization script to create tables and sample data
- Sign up for Judge0 API at RapidAPI
- Get your API key and update
JUDGE0_API_KEYin backend.env - Alternatively, set up a local Judge0 instance
- Go to Google Cloud Console
- Create a new project or select existing one
- Enable Google+ API
- Create OAuth 2.0 credentials
- Add authorized redirect URIs:
http://localhost:5000/api/auth/google/callback(development)https://yourdomain.com/api/auth/google/callback(production)
- Update Google credentials in both backend and frontend
.envfiles
oasis-protocol/
โโโ backend/
โ โโโ config/
โ โ โโโ database.js # Database configuration
โ โ โโโ passport.js # Passport authentication setup
โ โโโ controllers/
โ โ โโโ adminController.js # Admin operations
โ โ โโโ authController.js # Authentication logic
โ โ โโโ challengeController.js # Challenge operations
โ โโโ middleware/
โ โ โโโ auth.js # Authentication middleware
โ โ โโโ validation.js # Request validation
โ โโโ models/
โ โ โโโ Admin.js # Admin model
โ โ โโโ Challenge.js # Challenge model
โ โ โโโ Submission.js # Submission model
โ โ โโโ User.js # User model
โ โ โโโ index.js # Model associations
โ โโโ routes/
โ โ โโโ admin.js # Admin routes
โ โ โโโ auth.js # Authentication routes
โ โ โโโ challenges.js # Challenge routes
โ โ โโโ leaderboard.js # Leaderboard routes
โ โโโ scripts/
โ โ โโโ init-db.js # Database initialization
โ โโโ utils/
โ โ โโโ judge0.js # Judge0 API integration
โ โ โโโ jwt.js # JWT utilities
โ โโโ .env # Environment variables
โ โโโ package.json
โ โโโ server.js # Main server file
โโโ frontend/
โ โโโ src/
โ โ โโโ components/ # Reusable components
โ โ โโโ contexts/ # React contexts
โ โ โโโ pages/ # Page components
โ โ โ โโโ admin/ # Admin pages
โ โ โ โโโ ... # User pages
โ โ โโโ services/ # API services
โ โ โโโ App.jsx # Main app component
โ โ โโโ main.jsx # Entry point
โ โโโ .env # Environment variables
โ โโโ package.json
โ โโโ vite.config.js # Vite configuration
โโโ README.md
- Username:
admin - Password:
admin123
- Teams can register using email/password or Google OAuth
- Each team gets a unique team name and email
- Teams start at Challenge 1 and progress sequentially
- Algorithmic Phase: Solve coding problems using the built-in editor
- Flag Submission: Submit the correct flag to unlock buildathon
- Buildathon Phase: Submit GitHub repository with project solution
- Progression: Complete both phases to advance to next challenge
- Dashboard: Monitor real-time statistics
- Challenge Management: Create/edit challenges with algorithmic and buildathon components
- Team Management: View team details and manage accounts
- Submission Monitoring: Track all submissions with execution details
- JWT-based authentication with secure token handling
- Password hashing using bcryptjs
- Input validation and sanitization
- CORS configuration for cross-origin requests
- Environment-based configuration management
- SQL injection prevention through Sequelize ORM
- Connect your GitHub repository to Railway
- Set environment variables in Railway dashboard
- Deploy the backend service
- Update FRONTEND_URL to your frontend domain
- Build the frontend:
npm run build - Deploy the
distfolder to Netlify - Update VITE_API_URL to your backend domain
- Configure redirects for SPA routing
- Use Railway PostgreSQL, PlanetScale, or any MySQL hosting service
- Update database credentials in environment variables
- Run initialization script on production database
cd backend
npm testcd frontend
npm test- Team registration and login
- Google OAuth authentication
- Admin login and dashboard
- Challenge creation and editing
- Code execution with Judge0
- Flag submission system
- Buildathon GitHub submission
- Real-time leaderboard updates
- Responsive design on mobile
- Fork the repository
- Create a feature branch:
git checkout -b feature-name - Commit changes:
git commit -am 'Add feature' - Push to branch:
git push origin feature-name - Submit a pull request
POST /api/auth/register- Team registrationPOST /api/auth/login- Team loginGET /api/auth/google- Google OAuth loginPOST /api/auth/admin/login- Admin login
GET /api/challenges- Get available challengesGET /api/challenges/:id- Get specific challengePOST /api/challenges/:id/submit-code- Submit code for executionPOST /api/challenges/:id/submit-flag- Submit flagPOST /api/challenges/:id/submit-buildathon- Submit buildathon solution
GET /api/admin/dashboard- Dashboard statisticsGET /api/admin/challenges- Manage challengesGET /api/admin/teams- Manage teamsGET /api/admin/submissions- View submissions
GET /api/leaderboard- Public leaderboard
-
Database Connection Error
- Check MySQL service is running
- Verify database credentials in
.env - Ensure database exists
-
Judge0 API Error
- Verify API key is correct
- Check API quota limits
- Ensure internet connectivity
-
Google OAuth Error
- Check client ID and secret
- Verify redirect URIs in Google Console
- Ensure OAuth consent screen is configured
-
WebSocket Connection Issues
- Check CORS configuration
- Verify Socket.IO client/server versions match
- Check firewall settings
This project is licensed under the MIT License - see the LICENSE file for details.
- Inspired by "Ready Player One" by Ernest Cline
- Judge0 API for code execution
- Monaco Editor for code editing experience
- Socket.IO for real-time features
- Tailwind CSS for beautiful UI components
For support and questions:
- Create an issue in the GitHub repository
- Contact the development team
- Check the troubleshooting section above
Ready Player One? Welcome to the OASIS Protocol! ๐ฎโจ