Back to Projects

Fit Company Application

Microservices Architect2024 - 2025

An event-driven fitness and billing platform migrating from a legacy Flask monolith to distributed microservices. Orchestrates payment transactions and premium upgrades via RabbitMQ event streams.

System Architecture

backendFit Monolith / Core Svc (Flask)
backendBilling Svc (Flask)
backendCoach Svc (Flask)
backendStats Svc (Flask)
backendNotification Svc (Python)
queueRabbitMQ Message Broker

Data Flows & Communication

Billing Svc (Flask)RabbitMQ Message BrokerPublish: premium_plan_activated
RabbitMQ Message BrokerFit Monolith / Core Svc (Flask)Consume & upgrade user plan
RabbitMQ Message BrokerNotification Svc (Python)Consume & dispatch alerts
Fit Monolith / Core Svc (Flask)Coach Svc (Flask)HTTP GET /exercises
Fit Monolith / Core Svc (Flask)Stats Svc (Flask)HTTP POST /stats (analytics)

System Architecture & Communications Diagram

Admin DashboardClient ApplicationsAPI Gateway BoxAPI GatewayPort: 80 / 443Billing ServiceBilling ServicePort: 12111PostgreSQLbilling-dbMonolith Service (Fit)Fit ServicePort: 5000PostgreSQLfit-dbNotification ServiceNotification SvcPort: 5005Message BrokerRabbitMQPort: 5672Coach ServiceCoach Servicecoach-dbStats ServiceStats Servicestats-dbsubscription_activatedHTTPCreateWodMessagesubscription_notificationsCreateWodMessageCreatePerformedMessage

Interactive Scenario Simulator

Select a scenario to trigger and view simulated backend logs & database traces.

service-daemon.log
2026-06-12 10:10:01 - Billing Service: Received POST /billing/subscriptions for user: athlete@example.com (Plan: premium)
2026-06-12 10:10:01 - Billing Service: Created subscription ID: 22 with status: PENDING
2026-06-12 10:10:02 - Billing Service: Charging payment of $9.99 via card...
2026-06-12 10:10:02 - Billing Service: Payment completed (Txn: txn_7d82). Status updated to: ACTIVE
2026-06-12 10:10:03 - RabbitMQ: Publishing event 'premium_plan_activated' on queue 'billing_queue'
2026-06-12 10:10:03 - Fit Monolith: Queue Consumer received 'premium_plan_activated' for athlete@example.com
2026-06-12 10:10:04 - Fit Monolith: Updated user plan to 'premium' in monolith-db. Saga success.
2026-06-12 10:10:04 - Notification Service: Dispatched premium onboarding email.

DevOps

Strangler Fig, Flask

Strangler Fig Decoupling

Incrementally isolated monolithic fit domains into specialized coach, billing, and stats microservices while keeping the platform live.

RabbitMQ, Pika

Event-Driven Messaging

Configured RabbitMQ with durable queues and direct exchange patterns to guarantee reliable delivery of plan activation triggers.

PostgreSQL

Multi-Database Isolation

Migrated the single database model to four independent PostgreSQL databases to prevent direct database coupling between domains.

Run Infrastructure Locally

You can easily spin up the complete containerized stack in your local terminal.

git clone https://github.com/everleepham/fit-company.git
cd fit-company
docker-compose up -d

Engineering Challenges & Design Decisions

Monolith Migration Sync

Problem

Synchronizing subscription statuses back to the core monolith database asynchronously without creating circular HTTP dependencies.

Engineering Solution

Implemented an event consumer (BillQueueConsumer) in the monolith. When payment updates the subscription, the billing service publishes a plan-activated message, decoupling the services.

Key Achievements & Metrics

  • Monolith features successfully extracted into 4 containerized Flask microservices.
  • Created an asynchronous billing pipeline using RabbitMQ with reliable message delivery guarantees.
  • Successfully isolated databases by running 4 independent PostgreSQL instances on Docker Compose.