A Spring Boot REST API that enables students to register and submit assignments, with support for access to view submissions.
- Backend: Java 21, Spring Boot
- Frontend: React with Vite
- Database: H2 Database with JPA & Hibernate
- Build Tool: Maven
- Java 21 or higher
- Node and npm
- Postman (for API testing)
-
Clone the repository
-
Server Setup:
# Start Spring Boot server mvn spring-boot:run
-
Client Setup:
# Navigate to frontend directory cd src/main/frontend # Install frontend dependencies npm install # Start Vite dev server npm run dev
The server will start on http://localhost:8080
The user interface will start on http://localhost:5173
Import Postman Collection:
- Open Postman
- Click Import -> File
- Select
postman/student-assignment-submission-postman-collection.json
- Collection includes all API endpoints for testing
- Student registration with unique email validation
- Assignment submission with automatic timestamp
- View all submitted assignments
- Basic validation and error handling
- Database persistence using JPA/Hibernate
POST /students
Content-Type: application/json
{
"name": "John Doe",
"email": "[email protected]"
}
GET /students/{id}
GET /students
POST /assignments
Content-Type: application/json
{
"title": "Java Basics",
"description": "My first assignment",
"studentId": 1
}
GET /assignments/{id}
GET /assignments
- id (Long, auto-generated)
- name (String, required)
- email (String, required, unique)
- id (Long, auto-generated)
- title (String, required)
- description (String)
- submittedBy (Student reference)
- submittedAt (LocalDateTime, auto-generated)
Import the provided Postman collection for API testing. The collection includes all endpoints with example requests and responses.
The API implements standard error handling for:
- Invalid input data
- Missing required fields
- Duplicate email registration
- Resource not found
- Server errors
- Uses Spring Boot's built-in validation
- Implements proper separation of concerns (Controller, Service, Repository layers)
- Follows RESTful API best practices
- Database schema auto-generated through JPA