Currency Rate Ingestion & Analytics Service

Production-grade financial API with idempotency, scheduling, and observability - built in a take-home assignment.

NestJSTypeScriptPostgreSQLDockerREST APICron JobsAPI Security

A complete REST API for fetching, storing, and analyzing foreign exchange rates using NestJS and PostgreSQL.

The Challenge

Build a reliable, secure, and scalable currency rate service in a constrained timebox - handling flaky third-party APIs, duplicate prevention, and background processing without over-engineering.

Key Decisions & Tradeoffs

  • Idempotency via fetchedAtMinute: prevented duplicate records within the same minute using a derived integer column and composite DB constraint.
  • Unified ingestion path: reused the same logic for manual (POST) and scheduled (cron) data pulls, ensuring consistency and reducing bugs.
  • SQLite-first prototyping: validated core logic (deduplication, queries) with SQLite before migrating to PostgreSQL, reducing early infrastructure risk.
  • Minimalist security: implemented static API key auth via a custom guard - sufficient for internal services without OAuth complexity.

Outcome

Delivered a fully compliant solution with health checks, structured logging, Docker support, and production-ready error handling - all within assignment constraints, demonstrating the ability to ship resilient financial APIs under pressure.