Project · Beginner · about 16 hours
An orders REST API with Spring Boot and PostgreSQL
Load real e-commerce orders into PostgreSQL and serve them through a validated, paginated, tested Spring Boot API.
Skills:Java and Spring Boot, REST APIs and HTTP, SQL, Automated testing
Part of: Software Engineer (Backend)
Data and licences
- Olist Brazilian E-Commerce Public Dataset (Kaggle) ↗CC BY-NC-SA 4.0 (non-commercial use, share alike)
Brief
The Olist dataset contains about 100,000 real orders from a Brazilian marketplace between 2016 and 2018, with customers, items, payments and reviews in separate CSV files. Build the API a front end or a partner would use to read and create orders.
What to build
Design tables for orders, order items, customers and payments. Write them as migrations and load the CSVs.
GET /orders?status=&customerId=&page=&size=with pagination and a stable sort.GET /orders/{id}with items and payments.POST /orderswith validation (known customer, at least one item, positive prices) returning 201 and aLocationheader.Consistent error responses (a JSON body with a code and field errors) through a controller advice.
Tests at two levels: service logic with plain JUnit, endpoints with MockMvc or an integration test against PostgreSQL (for example with Testcontainers).
Deliverables
Repository with the Spring Boot project,
db/migration/, a loader, tests,openapi.yamlandREADME.md
How it is graded
Reviewers start the service from your README, call every endpoint with valid and invalid input, and read your tests. They check that list endpoints stay fast with indexes on the columns you filter by.
Stretch
Add ETag headers on GET /orders/{id} so clients can make conditional requests, with a test.
Deliverables
- A Spring Boot service with endpoints to list, fetch and create orders, with validation and correct status codes
- A database schema and migration scripts (Flyway or Liquibase) and a loader for the Olist CSV files
- Unit tests for the service layer and MockMvc or integration tests for every endpoint
- An OpenAPI description and a README with setup steps
How a reviewer grades it
| Criterion | Weight | What good looks like |
|---|---|---|
| Endpoints follow REST conventions with pagination, filtering and correct status codes | 25% | |
| Schema, indexes and migrations are sensible for the queries the API runs | 25% | |
| Tests cover success, validation errors and not-found cases | 30% | |
| Clean layering (controller, service, repository) and a clear README | 20% |