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

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

  1. Design tables for orders, order items, customers and payments. Write them as migrations and load the CSVs.

  2. GET /orders?status=&customerId=&page=&size= with pagination and a stable sort. GET /orders/{id} with items and payments.

  3. POST /orders with validation (known customer, at least one item, positive prices) returning 201 and a Location header.

  4. Consistent error responses (a JSON body with a code and field errors) through a controller advice.

  5. 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.yaml and README.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

CriterionWeightWhat good looks like
Endpoints follow REST conventions with pagination, filtering and correct status codes25%
Schema, indexes and migrations are sensible for the queries the API runs25%
Tests cover success, validation errors and not-found cases30%
Clean layering (controller, service, repository) and a clear README20%