Educational coding platform for learning programming through interactive tasks and challenges
KODIN Platform is a comprehensive web-based educational system designed for teaching and learning programming. The platform supports multiple programming languages (Python, Java, C/C++), features automated code evaluation using Docker containers, classroom management, gamification through badges and leaderboards, and real-time collaboration tools.
- Features
- Technology Stack
- Prerequisites
- Getting Started
- Environment Configuration
- Project Structure
- API Documentation
- 📝 Interactive Coding Tasks - Solve programming challenges in Python, Java, and C/C++
- 🏆 Gamification - Earn badges, XP points, and compete on leaderboards
- 👥 Social Learning - Friend lists, forums, and collaborative features
- 📊 Progress Tracking - Monitor your learning journey with detailed statistics
- 🔔 Notifications - Stay updated on new tasks, achievements, and classroom activities
- 📚 Integrated Documentation - Access language guides and tutorials within the platform
- 🏫 Classroom Management - Create and manage multiple classes
- ✏️ Task Creation - Design custom programming tasks with automated tests
- 📈 Student Analytics - Track student progress and performance
- ✅ Automated Grading - Code submissions are automatically evaluated in isolated Docker containers
- 🔐 SSO Integration - Keycloak-based single sign-on support
- 🐳 Containerized Code Execution - Secure, isolated environment for running student code
- 🔄 Real-time Feedback - Instant test results and code validation
- 🎨 Responsive Design - Works seamlessly on desktop, tablet, and mobile devices
- 🔒 Secure Authentication - JWT-based authentication with email verification
- Framework: React 18 with TypeScript
- Styling: CSS Modules
- State Management: React Context API + Hooks (
useState,useEffect,useContext) - Routing: React Router v6
- Build Tool: Vite
- HTTP Client: Fetch API
- Code Editor: Syntax highlighting with PrismJS
- Runtime: Node.js
- Framework: Express.js
- Authentication: JSON Web Tokens (JWT), Keycloak SSO
- Email Service: Mailtrap
- File Uploads: Multer
- Container Management: Dockerode
- Security: bcrypt, CORS middleware
- Database: PostgreSQL 15+
- Connection: node-postgres (pg)
- Schema: Relational database with users, tasks, solutions, classrooms, badges, etc.
- Containerization: Docker & Docker Compose
- Code Execution: Isolated Docker containers for Python, Java, and C/C++
- Development: Nodemon for hot-reloading
- Process Management: Concurrently for running multiple services
Before you begin, ensure you have the following installed:
- Docker Desktop (version 20.10 or higher) - Download Docker
- Docker Compose (usually included with Docker Desktop)
- Node.js (version 16 or higher) - Only needed for local development
- Git - For cloning the repository
Docker Compose handles all services, dependencies, and networking automatically. This is the easiest way to get the platform running.
git clone <repository-url>
cd tukewarsCreate a .env file in the project root with the following configuration:
# Database Configuration
POSTGRES_USER=postgres
POSTGRES_PASSWORD=bemi1
POSTGRES_DB=TukeWars
POSTGRES_HOST=pg_data
POSTGRES_PORT=5432
# JWT Configuration
JWT_SECRET=your_super_secret_jwt_key_change_this_in_production
# Email Configuration (Mailtrap)
MAILTRAP_TOKEN=your_mailtrap_api_token
# Application URLs
FRONTEND_URL=http://localhost:3000
BACKEND_URL=http://localhost:5000
# Keycloak SSO (Optional)
KEYCLOAK_URL=your_keycloak_url
KEYCLOAK_REALM=your_realm
KEYCLOAK_CLIENT_ID=your_client_id
KEYCLOAK_CLIENT_SECRET=your_client_secretMake sure Docker Desktop is running on your system.
# Build and start all containers in detached mode
docker-compose up -d
# Build task runner images (Python, Java, C)
docker-compose --profile build-only up --buildThis will start:
- PostgreSQL Database on port
5432 - Backend API on port
5000 - Frontend on port
3000 - Task Runner Images for code execution (Python, Java, C)
- Frontend: http://localhost:3000
- Backend API: http://localhost:5000
- Database: localhost:5432 (use your PostgreSQL client)
# View all logs
docker-compose logs -f
# View specific service logs
docker-compose logs -f backend
docker-compose logs -f frontend
docker-compose logs -f pg_data# Stop all containers
docker-compose down
# Stop and remove volumes (⚠️ this will delete database data)
docker-compose down -vIf you prefer to run services individually without Docker:
git clone <repository-url>
cd tukewars
# Install backend dependencies
npm install
# Install frontend dependencies
cd Frontend
npm install
cd ..Install PostgreSQL and create a database, then run the initialization script:
psql -U postgres -d TukeWars -f db/dbCreate.sqlCreate a .env file in the project root (see Docker section for required variables).
npm run start:backendBackend will be available at http://localhost:5000
npm run start:frontendFrontend will be available at http://localhost:3000
npm starttukewars/
├── docker-compose.yml # Docker orchestration configuration
├── DockerFile.Backend # Backend container definition
├── package.json # Root package.json for backend
├── README.md # This file
│
├── Backend/ # Express.js REST API
│ ├── index.js # Application entry point
│ ├── controllers/ # Request handlers
│ │ ├── auth.controller.js # Authentication & registration
│ │ ├── badge.controller.js # Badge management
│ │ ├── bugReport.controller.js # Bug reporting
│ │ ├── classroom.controller.js # Classroom operations
│ │ ├── friendlist.controller.js # Friend management
│ │ ├── leaderboard.controller.js # Rankings & statistics
│ │ ├── notification.controller.js # User notifications
│ │ ├── solution.controller.js # Code submission & evaluation
│ │ ├── task.controller.js # Task CRUD operations
│ │ └── sso.controller.js # Single sign-on
│ ├── routes/ # API endpoint definitions
│ ├── middleware/ # Authentication & authorization
│ ├── db/ # Database connection
│ ├── mailSender/ # Email service integration
│ ├── utils/ # Helper functions
│ └── dockerFiles/ # Code execution containers
│ ├── solutionPython/ # Python task runner
│ ├── solution/ # Java task runner
│ └── solutionC/ # C/C++ task runner
│
├── Frontend/ # React TypeScript application
│ ├── DockerFile.Frontend # Frontend container definition
│ ├── package.json # Frontend dependencies
│ ├── tsconfig.json # TypeScript configuration
│ ├── public/ # Static assets
│ │ ├── index.html
│ │ └── manifest.json
│ └── src/
│ ├── App.tsx # Root component
│ ├── index.tsx # Application entry
│ ├── components/ # Reusable UI components
│ │ ├── header/
│ │ ├── footer/
│ │ ├── calendar/
│ │ ├── createTask/
│ │ ├── friendlist/
│ │ ├── forum/
│ │ └── ...
│ ├── pages/ # Page components (routes)
│ ├── context/ # React Context providers
│ ├── styles/ # Global styles
│ └── assets/ # Images, icons, fonts
│
├── db/ # Database files
│ ├── dbCreate.sql # Database schema & initial data
│ └── DockerFile.Database # PostgreSQL container
│
└── uploads/ # User-uploaded files
├── badges/ # Badge images
└── docs/ # Documentation files
├── Authoring Guidelines.md
├── Badges.md
├── Class Management.md
├── Creating Tasks.md
├── Java.md
├── Python.md
└── C.md
The application requires several environment variables. Create a .env file in the project root:
# Database
POSTGRES_USER=postgres
POSTGRES_PASSWORD=your_password
POSTGRES_DB=TukeWars
POSTGRES_HOST=pg_data
POSTGRES_PORT=5432
# JWT Authentication
JWT_SECRET=your_secret_key_minimum_32_characters_long
# Email Service (Mailtrap for development)
MAILTRAP_TOKEN=your_mailtrap_token
# Application
FRONTEND_URL=http://localhost:3000
BACKEND_URL=http://localhost:5000
NODE_ENV=development
# Keycloak SSO (Optional)
KEYCLOAK_URL=https://your-keycloak-server.com
KEYCLOAK_REALM=your-realm
KEYCLOAK_CLIENT_ID=kodin-app
KEYCLOAK_CLIENT_SECRET=your-client-secretThe backend exposes a RESTful API on port 5000. Main endpoints:
POST /api/auth/register- User registrationPOST /api/auth/login- User loginPOST /api/auth/logout- User logoutPOST /api/auth/verify-email- Email verificationGET /api/auth/check- Check authentication status
GET /api/tasks- Get all tasksGET /api/tasks/:id- Get task by IDPOST /api/tasks- Create new task (teacher only)PUT /api/tasks/:id- Update task (teacher only)DELETE /api/tasks/:id- Delete task (teacher only)
POST /api/solutions/submit- Submit code solutionGET /api/solutions/user/:userId- Get user's solutionsGET /api/solutions/task/:taskId- Get solutions for a task
GET /api/classrooms- Get all classroomsPOST /api/classrooms- Create classroom (teacher only)POST /api/classrooms/:id/join- Join classroomGET /api/classrooms/:id/students- Get classroom students
GET /api/leaderboard/global- Global rankingsGET /api/leaderboard/classroom/:id- Classroom rankings
GET /api/users/profile- Get user profilePUT /api/users/profile- Update profileGET /api/users/stats- Get user statistics
For complete API documentation, see the individual controller files in Backend/controllers/.
Problem: docker-compose up fails with port conflicts
# Solution: Stop services using those ports or change ports in docker-compose.yml
docker-compose down
# Check what's using the port
netstat -ano | findstr :5000Problem: Database connection refused
# Solution: Wait for database to be healthy
docker-compose logs pg_data
# Restart services
docker-compose restart backendProblem: Changes not reflecting
# Solution: Rebuild containers
docker-compose up --buildProblem: MODULE_NOT_FOUND errors
# Solution: Reinstall dependencies
npm install
cd Frontend && npm installProblem: Database schema errors
# Solution: Reset database
docker-compose down -v
docker-compose up -d pg_data
# Wait for database to initialize
docker-compose up -dAutomated testing is currently in development. For manual testing:
- Code Execution: Submit Python/Java/C solutions through the UI
- Authentication: Test registration, login, email verification
- Classroom Management: Create classes, add students, assign tasks
- Leaderboard: Verify XP calculations and rankings
cd Frontend
npm run buildProduction files will be in Frontend/build/
The backend runs with Node.js. For production deployment:
# Use PM2 or similar process manager
npm install -g pm2
pm2 start Backend/index.js --name kodin-backenddocker-compose -f docker-compose.prod.yml up -dFor more detailed information:
- Badge System
- Class Management Guide
- Creating Tasks
- Java Development
- Python Development
- C/C++ Development
- Frontend Architecture
- Code Verification
docker-compose up