Autonomous gRPC Microservice for Exchange Rate Management
Standalone Go microservice that autonomously collects, stores, and serves live and historical currency exchange rates to applications within the Expense Tracker ecosystem via gRPC. Addresses multi-currency visibility requirements and establishes the first inter-service communication pattern in the evolving microservice architecture.
rate_decimal returns the stored NUMERIC(20,10) digit for digit; no float between provider JSON and database
v0.2.0 (2026-10-05): core implementation (Stages 1–6) plus the package for Crypto Account Service.
The service polls three external providers (fawazahmed0, ExchangeRate-API, Frankfurter) with a primary and a backup
per pair, stores rates in PostgreSQL, serves them via gRPC, and exposes health endpoints — all components verified manually.
Five fiat pairs, each served only in its stored direction: RSD→EUR, RSD→USD, EUR→USD, GBP→USD, CHF→USD.
Every rate comes as rate (double) and as the exact decimal string rate_decimal;
pairs and providers reload from the database without a restart.
Consumers: Expense Tracker and Crypto Account Service.
gRPC methods GetRate, GetRates, ListSupportedPairs tested with grpcurl.
CRS has run locally only. Next: E2E testing and Docker deployment (planned).
currency-rate-service — standalone microservice repository with independent deployment lifecycle.
/cmd/server — service entrypoint: config loading, DB connection, component wiring, graceful shutdown.
/internal/adapter — RateProvider interface, generic JSON adapter (URL templates + JSONPath), adapter registry.
/internal/polling — scheduler with per-pair goroutines, failover logic, config reload loop, pgx type converters.
/internal/grpc — gRPC server handlers + protoc-generated pb files (GetRate, GetRates, ListSupportedPairs).
/internal/health — HTTP health handler: /healthz (liveness) and /readyz (readiness + JSON status).
/internal/repository — sqlc-generated type-safe queries for all 5 tables.
/migrations — 6 golang-migrate migrations with seed data (pairs, providers, assignments, rates, health; 006 adds GBP→USD and CHF→USD).
/proto — protobuf definition for CurrencyRateService.
/Documentation — BRD, BRD Amendment 1 and SRS.