Skip to content

Conversation

@ash-leigh
Copy link

Overview

This PR implements a production-ready Exchange Rate Provider for the Czech National Bank (CNB), following clean architecture principles and industry best practices for maintainability, reliability, and scalability. To test and run the solution please see instructions in README at route of projects repository

Key Design Decisions

  1. CNB Data Source
    While there is a couple of official data sources I used CNB's official REST API with Swagger documentation https://api.cnb.cz/cnbapi/swagger-ui.html#//exrates so that we could have confidence in the formal API contract
  2. Clean Architecture with CQRS Pattern
    Structured the solution into four distinct layers (Domain, Application, Infrastructure, API) with clear dependency flow and implemented CQRS for query handling.
  3. Factory Pattern for Multi-Currency Support
    Implemented ExchangeRateServiceFactory with service key routing for currency-specific providers.
  4. Polly for Resilience & Retry Logic
    Integrated Polly with exponential backoff, and timeout policies for HTTP calls to CNB API.
  5. Comprehensive Validation Strategy
    Implemented multi-layer validation
  6. Integration & Unit Test Coverage
  7. Docker & OpenAPI Documentation
    Dockerfile and Scalar UI for interactive API documentation.

Engineering Best Practices

  1. Centralised build and package management using Directory.Build.props and Directory.Packages.props
  2. Applied [ExcludeFromCodeCoverage] attribute to test project Program.cs files and other infrastructure code that doesn't require testing.
  3. Utilised copilot for boiler plate code and initial unit tests. Running Claude Sonnet 4.3, example prompt:
/tests #SomeClass provide lean unit tests using xUnit, FakeItEasy, Shouldly and FakeLogger

Backlog

Features that would be good to implement next

  1. Implement more intelligent caching strategy
    At the moment data from CNB is cached every hour but given the banks documentation provides the time its exchange rates as usually declared (14:30 weekdays, excluding holidays) there is opportunity to ensure the cache does not go stale.

  2. Return ValidFor for rates
    Returning the date at which the exchange rate is valid would be beneficial to consumers.

@wiz-trial-29da161873
Copy link

wiz-trial-29da161873 bot commented Dec 9, 2025

Wiz Scan Summary

Scanner Findings
Vulnerability Finding Vulnerabilities -
Data Finding Sensitive Data -
Secret Finding Secrets -
IaC Misconfiguration IaC Misconfigurations 1 High 3 Low
SAST Finding SAST Findings -
Total 1 High 3 Low

View scan details in Wiz

To detect these findings earlier in the dev lifecycle, try using Wiz Code VS Code Extension.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant