A complete competitive programming platform with Docker support, Judge0 API integration, and military-style ranking system. Perfect for coding competitions, practice, and learning.
- π Complete Authentication System - JWT-based secure login/registration
- π» Multi-Language Code Execution - C++, Python, Java, JavaScript support via Judge0 API
- π Military Ranking System - From Private Recruit to Legendary General
- π Contest Management - Create, manage, and participate in coding contests
- π Learning Resources - Structured learning paths and tutorials
- π¨βπΌ Admin Dashboard - Complete platform management
- π― Problem Categories - Algorithmic challenges with difficulty levels
- π Progress Tracking - Statistics, streaks, and performance analytics
- π Responsive Design - Works on desktop, tablet, and mobile
- π³ Docker Ready - One-command deployment
- Docker Desktop (Windows/Mac) or Docker Engine (Linux)
- Git (to clone the repository)
# 1. Clone the repository
git clone https://github.com/neyamulhasan/BrainJam.git
cd BrainJam
# 2. Quick setup (Windows)
quick-setup.bat
# 2. Quick setup (Linux/macOS)
chmod +x quick-setup.sh && ./quick-setup.sh# 1. Copy environment configuration
cp .env.shared .env
# 2. Start containers
docker-compose up -d
# 3. Initialize database
docker-compose exec app npm run init-db
# 4. Access application
# http://localhost:3000- Node.js v18 or higher
- MySQL 8.0 or XAMPP
- Git
-
Clone and Install
git clone https://github.com/neyamulhasan/BrainJam.git cd BrainJam npm install -
Database Setup
# Option A: Use existing MySQL # Make sure MySQL is running on port 3306 # Option B: Use XAMPP # Start Apache and MySQL services (port 4306)
-
Environment Configuration
cp .env.example .env # Edit .env with your database credentials -
Initialize Database
npm run init-db npm run init-learning
-
Start Application
# Development mode npm run dev # Production mode npm start # Production mode npm start
For Docker (Recommended):
- Uses
.env.shared(pre-configured with Judge0 API) - No setup required - everything works out of the box
For Local Development:
NODE_ENV=development
PORT=3000
# Database (supports auto-detection)
DB_HOST=localhost
DB_PORT=3306,4306
DB_USER=root
DB_PASSWORD=your-password
DB_NAME=brain_jam
# JWT Security
JWT_SECRET=your-secret-key
JWT_EXPIRE=24h
# Judge0 API (Optional for local dev)
JUDGE0_API_URL=https://judge0-ce.p.rapidapi.com
JUDGE0_API_KEY=your-rapidapi-keyBrainJam/
βββ Dockerfile # Production container
βββ docker-compose.yml # Complete setup (app + database)
βββ .dockerignore # Docker build exclusions
βββ .env.shared # Shared environment (with Judge0 API)
βββ .env.example # Template for local development
βββ quick-setup.sh/bat # One-command setup scripts
- App Container: Node.js application with health checks
- MySQL Container: Database with persistent storage and auto-initialization
- Networking: Internal Docker network for secure communication
- Volumes: Persistent data storage for database and uploads
# Start services
docker-compose up -d
# View logs
docker-compose logs -f app
# Stop services
docker-compose down
# Rebuild after changes
docker-compose up -d --build
# Access container shell
docker-compose exec app sh
# Database access
docker-compose exec mysql mysql -u brainjam_user -p brain_jam- π User System: Registration, login, profile management
- π» Code Execution: Multi-language support via Judge0 API
- π Problem Database: Algorithmic challenges with test cases
- π Contest System: Create and manage coding competitions
- π Learning Hub: Tutorials and educational resources
- π¨βπΌ Admin Panel: Complete platform management
| Rank | Rating | Badge | Requirements |
|---|---|---|---|
| ποΈ Private Recruit | 800-999 | Starter | Complete registration |
| β Cadet Coder | 1000-1199 | Learner | Solve 10+ problems |
| π― Code Corporal | 1200-1399 | Solver | Win 3+ contests |
| π‘οΈ Tech Lieutenant | 1400-1599 | Expert | 50+ problems solved |
| π Algorithm Captain | 1600-1899 | Master | Top 10% in contests |
| π Legendary General | 1900+ | Legend | Elite performance |
POST /api/auth/register # User registration
POST /api/auth/login # User authentication
GET /api/auth/profile # Get user profile (JWT required)GET /api/problems # List all problems
POST /api/problems/submit # Submit solution
GET /api/contests # List contests
POST /api/contests/create # Create contest (admin)GET /api/admin/users # Manage users
POST /api/admin/problems # Create problems
GET /api/admin/stats # Platform statisticsGET /health # Health check
GET /api/test-db # Database connection test- β bcrypt Hashing: 12 salt rounds for password security
- β JWT Tokens: Secure session management
- β Input Validation: Server-side validation with express-validator
- β SQL Injection Prevention: Parameterized queries only
- β XSS Protection: Input sanitization and escaping
- β Non-root User: Application runs as non-privileged user
- β Environment Isolation: Separate networks and containers
- β Secret Management: Environment variables for sensitive data
- β Health Monitoring: Automatic health checks and restart policies
- Registration: Create new account with validation
- Login: Authenticate with JWT token generation
- Problem Solving: Submit code and get execution results
- Contest Participation: Join and compete in contests
- Admin Functions: Manage users, problems, and contests
- Docker Deployment: One-command setup works
# Health check
curl http://localhost:3000/health
# Database test
curl http://localhost:3000/api/test-db
# Registration test
curl -X POST http://localhost:3000/api/auth/register \
-H "Content-Type: application/json" \
-d '{"username":"testuser","email":"test@example.com","password":"password123","confirmPassword":"password123"}'
# Login test
curl -X POST http://localhost:3000/api/auth/login \
-H "Content-Type: application/json" \
-d '{"identifier":"testuser","password":"password123"}'npm start # Start production server
npm run dev # Development server with auto-reload
npm run init-db # Initialize/reset database
npm run init-learning # Load learning resources
npm run update-db # Run database updates# Reset database (Docker)
docker-compose exec app npm run init-db
# Update database schema (Docker)
docker-compose exec app npm run update-db
# Access MySQL directly (Docker)
docker-compose exec mysql mysql -u brainjam_user -p brain_jam
# Backup database (Docker)
docker-compose exec mysql mysqldump -u brainjam_user -p brain_jam > backup.sql
# Restore database (Docker)
docker-compose exec -T mysql mysql -u brainjam_user -p brain_jam < backup.sql# One-command deployment
quick-setup.sh # Linux/macOS
quick-setup.bat # Windows- Railway: Connect GitHub repo for auto-deployment
- Heroku: Use Docker container deployment
- DigitalOcean Apps: Docker-based deployment
- AWS/GCP/Azure: Container instances or app services
# Clone repository
git clone https://github.com/neyamulhasan/BrainJam.git
cd BrainJam
# Setup with Docker
docker-compose up -d
# Or manual setup
npm install
npm run init-db
npm start- Fork the repository
- Create feature branch:
git checkout -b feature/new-feature - Make changes and test thoroughly
- Commit:
git commit -m "Add new feature" - Push:
git push origin feature/new-feature - Create Pull Request
- Easy Setup: Use
quick-setup.sh/batfor instant deployment - Shared Resources: Uses project owner's Judge0 API (no setup needed)
- Complete Platform: Get full competitive programming environment
- Zero Configuration: Everything works out of the box
- Issue Tracking: GitHub Issues
- Docker Problems: Check
docker-compose logs -f - Database Issues: Run
docker-compose exec app npm run init-db - Port Conflicts: Application auto-detects available ports
# Port already in use
netstat -tlnp | grep :3000 # Find process using port
sudo kill -9 <PID> # Kill the process
# Database connection failed
docker-compose restart mysql # Restart MySQL container
# Permission errors (Linux)
sudo chown -R $USER:$USER . # Fix file permissions
chmod +x quick-setup.sh # Make script executableThis project is open source and available under the MIT License.
# Quick start (anyone can run this!)
git clone https://github.com/neyamulhasan/BrainJam.git
cd BrainJam
quick-setup.bat # Windows
# or
./quick-setup.sh # Linux/macOS
# Access your platform at: http://localhost:3000Ready to compete? Start coding and climb the military ranks! π
- Should return
{"success":true,"message":"Database connected successfully"}
Port 3000 in use:
netstat -ano | findstr :3000
taskkill /F /PID <PID>Database connection failed:
- Ensure MySQL/XAMPP is running
- Check credentials in
.env - Run
npm run init-db
Registration/Login errors:
- Check browser console for JavaScript errors
- Verify database tables exist
- Check server logs for detailed errors
- β MySQL runs on port 4306 (auto-detected)
- β Usually no password required
- β Compatible with MariaDB
- Contest system with real-time competitions
- Code editor with syntax highlighting
- Judge0 integration for code execution
- Real-time leaderboards with Socket.io
- Friend system and challenges
- Problem difficulty progression
- Badge and achievement system
This project is licensed under the MIT License.
BrainJam Arena - Where Code Warriors Are Born! βοΈ
Built for Software Engineering Laboratory - 9th Trimester