Skip to content

Repository files navigation

🚀 MICROSERVICES PLAYGROUND

Exposing what most backends try to hide — visually

Visualizing how distributed backend systems actually work — not just building them.

Node.jsExpressNext.jsRabbitMQDockerSocket.IOJWTTailwind CSS


💡 Why This Project Exists

Most applications hide backend complexity behind clean UIs. This project does the opposite.

The Microservices Playground exposes and animates real backend behavior — turning invisible service-to-service communication, event propagation, and distributed state changes into something you can actually see and interact with in real time.

It's not an e-commerce app. It's a developer-focused system visualization tool built on top of a real microservices stack. Every action you take in the UI triggers actual backend flows, and every step of those flows is streamed back to the visualizer live via WebSocket.


🧱 Architecture Overview

┌─────────────────────────────────────────────────────────────────────┐
│ CLIENT (Next.js) │
│ System Visualizer Interface │
└────────────────────────┬─────────────────────────┬─────────────────┘
│ HTTP │ WebSocket (live updates)
▼ ▼
┌──────────────────────────┐ ┌──────────────────────┐
│ API GATEWAY │ │ SOCKET SERVICE │
└───┬──────┬──────┬────┬───┘ │ (Event Stream Hub) │
│ │ │ │ └──────────┬───────────┘
▼ ▼ ▼ ▼ │ consumes
┌──────┐ ┌──────┐ ┌──────┐ ┌───────┐ │
│ Auth │ │Prod. │ │ Cart │ │Order │ │
│ Svc │ │ Svc │ │ Svc │ │ Svc │ │
└──┬───┘ └──────┘ └──┬───┘ └───┬──┘ │
│ │ │ │
│ publishes │ │ │
└────────────────►└────┬────┘ │
▼ │
┌───────────────────┐ │
│ RabbitMQ │─────┘
│ Message Broker │
└───────────────────┘
▲ ▲
Cart Svc │ │ Socket Svc
(independently│ │independently)
consumes) │ │ consumes)

Key Design Point

Every service publishes events to RabbitMQ at each meaningful step. The Socket Service independently consumes all of these events and forwards them to the frontend via WebSocket — giving the visualizer a live, parallel view of what's happening inside the system without interfering with the domain services at all.

🟢 SYNCHRONOUS ──── Client → API Gateway → Service
🟠 ASYNCHRONOUS ──── Service → RabbitMQ → Service (domain events)
🔵 REALTIME ──── RabbitMQ → Socket Service → Client (WebSocket)

🔹 Services

ServiceResponsibilityProtocol
Auth ServiceJWT-based login & signup, password hashingREST + AMQP
Product ServiceStateless product catalog readsREST
Cart ServiceUser cart state, independent event consumerREST + AMQP
Order ServiceOrder creation, domain event publisherREST + AMQP
Socket ServiceIndependently consumes all RabbitMQ events, streams to frontendAMQP + WebSocket

⚡ Core Flows

Each flow has two parallel tracks — the main flow (what the system does) and the real-time track (how the visualizer sees it live).


🔐 Login Flow

Main Flow

Client
└──► API Gateway
└──► Auth Service
├── User validation
├── Token issued
└── Session active

Real-time Track(runs in parallel)

Auth Service ──► RabbitMQ ──► Socket Service ──► WebSocket ──► UI Visualizer

📝 Sign-up Flow

Main Flow

Client
└──► API Gateway
└──► Auth Service
├── Password encrypted
├── User created
└── User ready for login

Real-time Track(runs in parallel)

Auth Service ──► RabbitMQ ──► Socket Service ──► WebSocket ──► UI Visualizer

🛒 Add to Cart Flow

Main Flow

Client
└──► API Gateway
└──► Cart Service
├── Item added to user
└── Cart updated

Real-time Track(runs in parallel)

Cart Service ──► RabbitMQ ──► Socket Service ──► WebSocket ──► UI Visualizer

📦 Place Order Flow

Main Flow

Client
└──► API Gateway
└──► Order Service
├── publishes order.placed event
│ └──► RabbitMQ
│ └──► Cart Service (independently consumes)
│ └── Cart cleared for user
└── Order placed for user

Real-time Track(runs in parallel)

Order Service ──► RabbitMQ ──► Socket Service ──► WebSocket ──► UI Visualizer
Cart Service ──► RabbitMQ ──► Socket Service ──► WebSocket ──► UI Visualizer

The Cart Service and Socket Service both independently consume from the same RabbitMQ event. The cart clears itself through the event — no direct call is made from Order Service to Cart Service. The UI visualizer sees both sides of this exchange in real time.


🎨 Frontend Philosophy

This is not a traditional UI. The frontend acts as a System Playground & Visualization Interface:

 User Action
│
▼
API Gateway ──► Services ──► RabbitMQ
│
Socket Service
│
WebSocket
│
UI Visualizer
(Flow Animations, Service Traces,
Real-time State Changes)

Every step you trigger in the UI is reflected back through actual backend events — not mocked, not polled. Designed like a developer tool, not an e-commerce app.


🔥 Feature Highlights

  • Microservices Backend — 5 independently-scoped Node.js/Express services
  • Event-Driven Architecture — RabbitMQ publish/consume with real domain events
  • Real-time Visualization — Socket Service streams live backend events to the UI via WebSocket
  • Parallel Event Track — Every flow has a live mirror in the visualizer without coupling to domain logic
  • Independent Consumers — Cart Service and Socket Service consume the same events without knowing about each other
  • JWT Authentication — Stateless sessions via signed cookies
  • Dockerized Infrastructure — Full stack spins up with a single command
  • Clean Separation of Concerns — Each service owns its domain, data, and events

🧰 Tech Stack

FrontendBackendInfrastructure
Next.jsNode.jsDocker
React 18Express.jsDocker Compose
Tailwind CSSRabbitMQJWT (stateless)
Socket.IO ClientSocket.IO Serverbcrypt
REST APIs

🐳 Running the Project

1. Clone the repository

git clone https://github.com/your-username/microservices-playground.git
cd microservices-playground

2. Configure environment variables

# Create a .env file at project root
PRODUCT_SERVICE_URL=http://localhost:3002
AUTH_SERVICE_URL=http://localhost:3001
CART_SERVICE_URL=http://localhost:3003
ORDER_SERVICE_URL=http://localhost:3004
SOCKET_SERVICE_URL=http://localhost:3005
RABBITMQ_URL=amqp://localhost

3. Start all services

docker-compose up --build

All services spin up together. The visualizer is available at http://localhost:3000.
The Socket Service connects automatically and begins streaming events to the UI.


🧠 Concepts Demonstrated

ConceptHow It's Shown
Microservices Design5 isolated services with independent concerns
Event-Driven SystemsRabbitMQ publish/consume across services
Real-time Event StreamingSocket Service bridges RabbitMQ → WebSocket → UI
Independent ConsumersCart Service and Socket Service both consume the same events without coupling
Stateless AuthJWT in cookies, no server-side sessions
Distributed StateCart cleared via event, not a direct API call
Backend VisualizationUI animates actual service-to-service flows live
Observer PatternSocket Service as a passive consumer — zero impact on domain services

🚀 Planned Improvements

  • Distributed tracing with Jaeger
  • Per-service Logs Panel in the visualizer
  • Service Health Dashboard
  • Failure simulation — retry logic, dead-letter queues
  • Replay mode — re-emit past event sequences for debugging

📸 Screenshots

Add your screenshots here


👨‍💻 Author

Eswar

Built to bridge the gap between system design theory and real implementation.

About

Interactive microservices playground to visualize API flows, event-driven architecture, and backend system behavior using Node.js, RabbitMQ, and Next.js.

Topics

Resources

Contributing

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages