Open
Conversation
added 3 commits
January 25, 2026 12:06
- Added live One-Frame HTTP interpreter - Integrated in-memory rate cache with TTL to bypass provider limits - Wired service, program, and HTTP routes end-to-end - Added proper error handling for invalid pairs and upstream failures - Configured application for external One-Frame provider
- Added tests for cached rate reuse - Verified cache TTL expiration behavior - Covered error propagation from One-Frame provider
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This PR implements a production-ready local Forex rates proxy backed by the One-Frame service.
The solution is designed to meet the functional and non-functional requirements of the assignment, including scalability, freshness guarantees, and resilience against third-party limitations.
What’s included
Live One-Frame integration
Implemented a real HTTP interpreter to fetch exchange rates from the One-Frame API
Added robust JSON parsing and error handling for malformed or empty responses
Caching layer with TTL
Introduced an in-memory rate cache with configurable TTL
Ensures rates are no older than the configured threshold
Allows the service to scale beyond One-Frame’s 1,000 requests/day limit
Service & program wiring
Integrated cache and One-Frame interpreter into the rates service
Preserved separation of concerns using algebras and interpreters
Updated HTTP routes to return descriptive, user-friendly errors
Unit tests
Added focused unit tests covering:
Cached rate reuse
Cache TTL expiration
Error propagation from the upstream provider
Tests isolate external dependencies and validate business behavior
Design considerations
External API calls are isolated behind an algebra to simplify testing and future extensions
Cache-first strategy minimizes reliance on the third-party provider
Tests focus on high-risk, high-value behavior rather than framework internals
Code follows a production mindset with readability, safety, and maintainability in mind
Start One-Frame locally
docker run -p 8080:8080 paidyinc/one-frame
Run the application
sbt run
Example request
curl "http://localhost:8081/rates?from=USD&to=JPY"