CAS-735 MICROSERVICES ARCHITECTURE

Not Just a Podcast App.
A Distributed System.

A showcase of Hexagonal Architecture and Event-Driven Design. Orchestrating 5 decoupled microservices via RabbitMQ to deliver high-fidelity audio processing and real-time WebRTC streams.

cluster-status.log
✓ service-discovery[OK]
service-1: user-serviceActive
service-2: recording-serviceProcessing
> tail -f /var/log/rabbitmq
[AMQP] Published: domain.events.session.created
[AMQP] Consumed: media.processing.requests
[WORKER] FFMPEG stitching chunks...

The Architecture

01 / Bounded Contexts

User Service

Handling Identity & Access Management. Issues JWTs for stateless authentication across the cluster.

Node.jsPostgres

Recording Service

High-throughput ingestion service. Streams chunks directly to S3/MinIO to ensure zero data loss.

FastAPIWebRTC

02 / Async Communication

AMQP PROTOCOL

RabbitMQ Event Bus

Decouples services using Topic Exchanges.
`domain.events.#` handles fan-out.

session.created
SessionNotification
5ms
chunk.uploaded
RecordingWorker
12ms
processing.done
WorkerClient
45ms

03 / Real-time Edge

Notification Service

Dedicated WebSocket server consuming AMQP events and pushing updates to connected clients.

Socket.ioRedis Adapter

Media Worker

Offloads heavy FFmpeg processing from the API layer. Stitches chunks and masters audio.

PythonFFmpeg

Design Choice:
Why Hexagonal?

In CAS-735, we learned that mixing business logic with infrastructure concerns leads to unmaintainable monoliths.

We implemented Ports & Adapters to ensure our Domain Core remains pure. Our "Inbound Ports" (REST Controllers) and "Outbound Adapters" (Postgres Repositories, RabbitMQ Publishers) are pluggable. This allowed us to swap LocalStorage for S3 without touching a single line of business logic.

Testable Domain
Zero Lock-in
// Hexagonal Directory Structure
src/
domain/ # Pure Business Logic
User.ts
Events.ts
application/ # Use Cases
RegisterUser.ts
adapters/ # Infrastructure
PostgresRepo.ts
RabbitMQPublisher.ts