A real-time classroom engagement platform built with Spring Boot. Teachers create interactive sessions, students join with a 6-digit code and respond to questions in real-time.
- JWT Authentication — Secure token-based auth for teachers and students
- Session Management — Create sessions with unique 6-digit join codes; lifecycle: CREATED → ACTIVE → ENDED
- Question Types — MCQ (with validated options), Rating (1-5), and Open Text
- Role-Based Access — Teachers create content, students respond; enforced at both role and ownership level
- Answer Validation — MCQ bounds checking, rating range enforcement, text length limits
- Pagination & Filtering — Paginated endpoints with status/teacher/date filtering
- Swagger UI — Interactive API documentation with JWT support
- Java 21
- Spring Boot 3.4.x
- Spring Security + JWT (jjwt)
- Spring Data JPA + H2 (in-memory)
- Bean Validation (Jakarta)
- Lombok
- SpringDoc OpenAPI (Swagger UI)
- JUnit 5 + Mockito + AssertJ
git clone https://github.com/Raam751/VibeEdu.git
cd VibeEdu
./mvnw spring-boot:runThe app starts at http://localhost:8080
| Method | Endpoint | Description |
|---|---|---|
| POST | /api/auth/register |
Register (TEACHER or STUDENT) |
| POST | /api/auth/login |
Login, receive JWT token |
| Method | Endpoint | Access | Description |
|---|---|---|---|
| POST | /api/sessions |
Teacher | Create session |
| GET | /api/sessions |
Auth | List all (paginated) |
| GET | /api/sessions/{id} |
Auth | Get by ID |
| GET | /api/sessions/code/{code} |
Public | Join by code |
| GET | /api/sessions/filter |
Auth | Filter by status/teacher/date |
| PUT | /api/sessions/{id}/start |
Owner | Start session |
| PUT | /api/sessions/{id}/end |
Owner | End session |
| DELETE | /api/sessions/{id} |
Owner | Delete (cascades) |
| Method | Endpoint | Access | Description |
|---|---|---|---|
| POST | /api/questions |
Teacher | Create question |
| GET | /api/questions/{id} |
Auth | Get by ID |
| GET | /api/questions/session/{id} |
Auth | List by session |
| PUT | /api/questions/{id} |
Teacher | Update question |
| DELETE | /api/questions/{id} |
Teacher | Delete (cascades) |
| Method | Endpoint | Access | Description |
|---|---|---|---|
| POST | /api/responses |
Student | Submit response |
| GET | /api/responses/question/{id} |
Teacher | View responses |
| GET | /api/responses/question/{id}/paged |
Teacher | View (paginated) |
| PUT | /api/responses/{id} |
Owner | Update own response |
| Method | Endpoint | Access | Description |
|---|---|---|---|
| GET | /api/users |
Teacher | List all (paginated) |
| GET | /api/users/{id} |
Auth | Get by ID |
| GET | /api/users/students |
Teacher | List students |
| DELETE | /api/users/{id} |
Teacher | Delete student |
Visit http://localhost:8080/swagger-ui.html — click "Authorize" and paste your JWT token.
Database viewer at http://localhost:8080/h2
- JDBC URL:
jdbc:h2:mem:vibeedu - Username:
sa - Password: (empty)
src/main/java/com/vibeedu/vibeedu/
├── controller/ # REST endpoints with Swagger annotations
├── service/ # Business logic, validation, ownership checks
├── repository/ # Spring Data JPA with EntityGraph optimization
├── entity/ # JPA entities with cascade relationships
├── dto/
│ ├── req/ # Request DTOs with Bean Validation
│ └── res/ # Response DTOs with static factory methods
├── security/ # JWT filter, helper, UserDetailsService
├── config/ # Security (CORS, JWT filter chain), Swagger
└── exception/ # Custom exceptions + global handler
./mvnw clean test# 1. Register a teacher
curl -X POST http://localhost:8080/api/auth/register \
-H "Content-Type: application/json" \
-d '{"name":"Jane","email":"jane@test.com","password":"pass123","role":"TEACHER"}'
# 2. Create a session (use token from step 1)
curl -X POST http://localhost:8080/api/sessions \
-H "Authorization: Bearer <token>" \
-H "Content-Type: application/json" \
-d '{"title":"Intro to Java"}'
# 3. Add an MCQ question
curl -X POST http://localhost:8080/api/questions \
-H "Authorization: Bearer <token>" \
-H "Content-Type: application/json" \
-d '{"sessionId":1,"text":"What is 2+2?","type":"MCQ","options":["3","4","5","22"]}'
# 4. Start the session
curl -X PUT http://localhost:8080/api/sessions/1/start \
-H "Authorization: Bearer <token>"
# 5. Register a student, join, and respondBuilt for learning and interview showcase 📚