Skip to content

eswar06/microservices-playground

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

9 Commits
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

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.js Express Next.js RabbitMQ Docker Socket.IO JWT Tailwind 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

Service Responsibility Protocol
Auth Service JWT-based login & signup, password hashing REST + AMQP
Product Service Stateless product catalog reads REST
Cart Service User cart state, independent event consumer REST + AMQP
Order Service Order creation, domain event publisher REST + AMQP
Socket Service Independently consumes all RabbitMQ events, streams to frontend AMQP + 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

Frontend Backend Infrastructure
Next.js Node.js Docker
React 18 Express.js Docker Compose
Tailwind CSS RabbitMQ JWT (stateless)
Socket.IO Client Socket.IO Server bcrypt
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

Concept How It's Shown
Microservices Design 5 isolated services with independent concerns
Event-Driven Systems RabbitMQ publish/consume across services
Real-time Event Streaming Socket Service bridges RabbitMQ β†’ WebSocket β†’ UI
Independent Consumers Cart Service and Socket Service both consume the same events without coupling
Stateless Auth JWT in cookies, no server-side sessions
Distributed State Cart cleared via event, not a direct API call
Backend Visualization UI animates actual service-to-service flows live
Observer Pattern Socket 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.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors