Practice assignment

Resilient HTTP client take-home assignment

A currency converter depends on a flaky third-party rates provider. It must stay useful when the provider is slow or down, and it must not invent a rate for an unknown currency. The Spring Boot task focuses on timeout, three attempts, and a last-good-rate fallback per pair. The TypeScript task also requires a circuit breaker, single-flight, and a max staleness.

The starter

GET /api/convert?from=EUR&to=USD&amount=10
 → {amount, rate, stale}

upstream GET {base}/rates/{from}/{to} → {"rate": 1.08}

Work in RatesClient.rate (Java) or in ratesClient, circuitBreaker and ratesService (TypeScript). Tests use a local fake upstream and, on the Node task, an injected clock.

Requirements

Grading rubric

AreaPoints
Correctness (provided tests)30
Retry / timeout policy correct, no retry on 4xx20
Fallback & error mapping (and circuit breaker on the Node task)15
Own tests (backoff, fake upstream, no sleeps)15
Observability: logs or metrics on retries5–10
NOTES.md: jitter, Retry-After, shared breaker state, libraries10–15

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

What reviewers look for

Common mistakes

How to run it

Java: mvn verify. Node.js: npm ci and npm test (the fake upstream binds to 127.0.0.1, no internet needed).

Paste a job ad that mentions retries, resilience or third-party APIs, and generate a practice task.

Generate one from a job ad

Related practice tasks

Frequently asked questions

Do I have to use Resilience4j?
No. A clear, tested hand-rolled policy is enough for the timebox. Saying in NOTES.md when you would switch to a library is part of a senior submission.
Is a circuit breaker required on the Java task?
It is not in the Java brief. Adding a simple one can help if the tests still pass; on the TypeScript task it is required.
Why not retry every failure?
A 4xx will fail the same way on the next attempt. Retrying it hides bugs (a 404 becomes 'unavailable') and can amplify load.

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.