A real-time collaborative coding platform built with Spring Boot and MySQL.
- User Authentication: Secure login/register for students, mentors, and administrators
- Real-time Collaboration: Multiple users can edit code simultaneously using WebSocket
- Problem Bank: Coding problems categorized by difficulty and topic
- Code Evaluation: Automatic code compilation and testing
- Leaderboard: Performance tracking and rankings
- Responsive Design: Works on desktop and mobile devices
- Backend: Java 17, Spring Boot 3.2, Spring Security, Spring Data JPA
- Database: MySQL 8.0
- Frontend: HTML5, CSS3, JavaScript, Thymeleaf
- Real-time: WebSocket with STOMP protocol
- Code Editor: CodeMirror integration
- Java 17 or higher
- Maven 3.6+
- MySQL 8.0+
- Git
git clone <repository-url>
cd java_project3- Install MySQL and start the service
- Create a database (optional - application will create it automatically):
CREATE DATABASE livecoding_arena;- Update database credentials in
src/main/resources/application.yml:
spring:
datasource:
url: jdbc:mysql://localhost:3306/livecoding_arena?createDatabaseIfNotExist=true
username: root
password: your_password# Build the project
mvn clean install
# Run the application
mvn spring-boot:run- Open your browser and go to:
http://localhost:8080 - Register a new account or use the sample data
The application initializes with sample problems. You can register new users with different roles:
- Student: Can solve problems and view leaderboard
- Mentor: Can solve problems and access mentor features
- Admin: Full access to all features
POST /api/auth/register- User registrationPOST /api/auth/login- User login
GET /api/problems- Get all problemsGET /api/problems/{id}- Get specific problemGET /api/problems/category/{category}- Filter by categoryGET /api/problems/difficulty/{difficulty}- Filter by difficulty
POST /api/submissions/submit- Submit code for evaluation
GET /api/leaderboard- Get user rankings
/ws- WebSocket connection endpoint/app/code.update- Send code updates/topic/code- Subscribe to code changes/app/cursor.update- Send cursor position/topic/cursor- Subscribe to cursor updates
src/
├── main/
│ ├── java/com/livecoding/arena/
│ │ ├── config/ # Configuration classes
│ │ ├── controller/ # REST controllers
│ │ ├── dto/ # Data Transfer Objects
│ │ ├── entity/ # JPA entities
│ │ ├── repository/ # Data repositories
│ │ ├── service/ # Business logic
│ │ ├── websocket/ # WebSocket handlers
│ │ └── LiveCodingArenaApplication.java
│ └── resources/
│ ├── static/ # CSS, JS, images
│ ├── templates/ # Thymeleaf templates
│ └── application.yml # Configuration
└── test/ # Test classes
- Register/Login: Create an account or login with existing credentials
- Browse Problems: View available coding problems with filters
- Code Editor: Select a problem and start coding
- Real-time Collaboration: Share session with others for collaborative coding
- Submit Solutions: Test and submit your code for evaluation
- View Leaderboard: Check your ranking and progress
Problems are initialized in ProblemService.initializeSampleProblems(). To add more:
createProblem(
"Problem Title",
"Problem description...",
Problem.Difficulty.MEDIUM,
"Category",
"Test input",
"Expected output"
);The CodeEvaluationService currently uses simplified evaluation. For production:
- Implement Docker containers for secure code execution
- Add support for multiple programming languages
- Integrate with online judges or testing frameworks
- Passwords are encrypted using BCrypt
- JWT tokens can be implemented for stateless authentication
- Input validation is applied to prevent SQL injection
- For production, implement proper code sandboxing
- Fork the repository
- Create a feature branch
- Make your changes
- Add tests if applicable
- Submit a pull request
This project is licensed under the MIT License.