Practice assignment

Backend take-home assignment example (Spring Boot)

A small webshop needs a backend service to accept and track orders. You get a Spring Boot 3 / Java 21 starter, a fixed HTTP contract under /api/orders, and tests that stay red until the service, validation and error mapping are in place.

The starter

Requirements

  1. POST /api/orders with {customerEmail, lines:[{sku, quantity, unitPrice}]} — validate the body, lower-case the email, set status NEW, compute total as the sum of quantity × unitPrice rounded HALF_UP to 2 decimals once, return 201 and a Location.
  2. GET /api/orders/{id} — 200 or 404 ORDER_NOT_FOUND.
  3. GET /api/orders?status=PAID — optional filter.
  4. PATCH /api/orders/{id}/status — only NEW→PAID|CANCELLED and PAID→SHIPPED|CANCELLED; anything else is 409 INVALID_STATUS_TRANSITION.

Every error body is JSON {code, message}. Unreadable JSON is the same 400 VALIDATION_FAILED as a field error.

Grading rubric

AreaPoints
Correctness (provided tests)30
Validation & error contract15
Domain logic: state machine, BigDecimal money15
Own tests15
Structure: DTO vs entity, @Transactional10
API design: 201 + Location, status codes5
NOTES.md trade-offs (pagination, idempotency, locking)10

Levels: junior ≥ 60, mid ≥ 75, senior ≥ 85 (and a strong NOTES.md).

What reviewers look for

Common mistakes

How to run it

Run mvn verify. The provided tests fail on the starter and must pass on your solution. Add your own tests; they are part of the grade.

The free no-account sample is a Spring Boot CSV import in the same style. Or paste a job ad and generate an orders-style task.

Download the Spring Boot sample ZIP Generate one from a job ad

Related practice tasks

Frequently asked questions

What does a Spring Boot take-home usually look like?
A small but complete service: a documented HTTP contract, an in-memory or containerised database, provided tests that fail on the starter, and a NOTES.md for trade-offs you did not have time to build.
How is this different from a LeetCode-style coding test?
You are graded on validation, error codes, money or state rules, and the shape of the code, not on an algorithm puzzle. The provided tests are the specification.
Can I download this starter?
This page describes the orders-API template. The free no-account ZIP on the site is a securities CSV-import task in the same style. You can also generate an assignment from a job posting.

Practice only. This is an original HireCheck practice assignment, not a real employer's take-home, and it is not affiliated with any company mentioned as a role example.