Case Study 03 / Event-Driven Backend

Market Data Service

A production-style ingestion microservice showing how quote polling, event streaming, caching, persistence, derived analytics, and delivery controls fit into one testable system.

40%Higher processing scalability in the final design
25%Lower average API response time
CIAutomated route tests and Docker validation through GitHub Actions

01 / Problem

A quote script is not the same thing as a market data service.

The implementation expands a polling assessment into a backend architecture that can ingest external prices, distribute events, retain raw and processed records, serve low-latency reads, and remain reproducible for reviewers.

System goal

Separate ingestion, event processing, storage, caching, and API delivery so each concern can be tested and changed without collapsing into one long-running script.

My ownership

I designed the backend architecture and implemented the FastAPI routes, Kafka workflows, Redis cache, PostgreSQL persistence, container setup, rate limits, tests, and CI validation.

02 / Architecture

Streaming and request paths have different responsibilities.

Quote ingestion publishes market events for asynchronous processing, while Redis supports low-latency latest-price reads and PostgreSQL preserves raw and derived records for analytics.

FinnhubExternal quote source polled on a controlled ingestion schedule
FastAPIPolling controls, latest prices, moving averages, and rate-limited endpoints
KafkaMarket events decoupled from downstream processing and consumers
Redis + PostgreSQLFast current reads with durable raw and processed history
PythonFastAPIKafkaRedisPostgreSQLDocker ComposePytestSlowAPIGitHub Actions

03 / Delivery

Reproducibility and failure handling are part of the demo.

The repository is structured so a reviewer can start the complete dependency stack, exercise synchronous and asynchronous paths, and validate behavior without rebuilding infrastructure manually.

Operational controls

  • Docker Compose starts application and data dependencies consistently.
  • SlowAPI limits protect public endpoints from uncontrolled request volume.
  • Caching reduces repeated database and upstream work on hot reads.

Validation

  • Pytest covers synchronous and asynchronous routes.
  • GitHub Actions runs automated tests and build validation.
  • Raw and processed persistence keeps derived analytics traceable to source events.

04 / Result

A coherent backend system rather than a collection of infrastructure names.

The final design ties event streaming, cache strategy, persistence, API behavior, containers, and tests to a clear ingestion workflow, with measured improvements in processing scalability and response time.

Return to selected work

Explore all projects

Back to Portfolio