Skip to content

1tsadityaraj/System-Design-Visualizer

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

14 Commits
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

πŸ—οΈ System Design Visualizer

A SaaS-grade system architecture design tool with AI-powered Intelligence, Chaos Engineering, DevSecOps Audit, and Cloud Economics

Built with React Β· Zustand Β· React Flow Β· Node.js Β· Express Β· MongoDB Β· Socket.io

MIT License Node.js React MongoDB Version

πŸ‘‹ For Technical Recruiters & Engineering Managers: This is a complex engineering platform that goes far beyond standard CRUD applications. It demonstrates a deep understanding of Distributed Systems, Site Reliability Engineering (SRE), DevSecOps, and Cloud Economics. If you're looking for a candidate who understands how to design, scale, secure, and fund production-grade infrastructureβ€”this project proves exactly that.


πŸš€ Live Deployments


🎬 Demo β€” Building the "Golden Path" Architecture

Architecture Linter Demo

Watch the static analysis linter clear out in real-time as the production-grade architecture is built β€” then explore Chaos, Security, and Cost modules below.


πŸ“Έ Screenshots

Canvas + Architecture Linter
πŸ›‘οΈ Security Posture Audit
πŸ’€ Chaos Engineering β€” Node Killed
πŸ’° Live Bill + Cost Breakdown
πŸ“¦ Enterprise Export (K8s + Terraform)
Inspector + Capacity Estimator

✨ What Makes This Different (Why It Matters)

This isn't just a drag-and-drop diagramming tool. It's a five-layer engineering platform that proves understanding of distributed systems, SRE, DevSecOps, Cloud Economics, and production-grade infrastructure:

Engineering Layer What It Does The Signal It Sends To Hiring Managers
πŸ” Architecture Linter Real-time static analysis β€” flags anti-patterns (SPOF, missing LB, orphaned nodes) "I validate topology against distributed systems best practices in O(n+e) time."
πŸ’€ Chaos Engineering Kill nodes, propagate failures, re-route traffic through replicas "I understand that systems fail β€” and I design for failover and high availability."
πŸ’° Cloud Economics Live monthly cost estimate with per-component AWS pricing breakdown "I can think about the bottom line β€” a 'cool' architecture is useless if it bankrupts the company."
πŸ›‘οΈ Security Posture DevSecOps audit β€” scores architecture against 5 vulnerability rules "I have a Security-First mindset. I flag Direct DB Exposure as a critical risk."
πŸ“¦ Enterprise Exports Generates K8s manifests (Deployment, Service, Ingress, HPA) + Terraform HCL with variables "I am production-ready. I understand container orchestration, IaC, and scaling."

πŸ”₯ v2.0 β€” The "Grand Architect" Expansion

1. πŸ’€ Chaos Engineering Simulator (SRE Focus)

Most student projects assume everything works perfectly. This one proves you understand that systems fail.

How it works:

  • Toggle Chaos Mode via the skull button in the toolbar
  • Click any node to "kill" it β€” visually turns red with a skull overlay and "KILLED" status
  • Graph Propagation (BFS): If a replica exists (same subtype), traffic automatically re-routes through green dashed edges
  • No replica? All downstream nodes turn yellow (DEGRADED), clients turn red (DOWN)
  • Dead edges render as red dashed lines with reduced opacity
  • Exit chaos mode β†’ all nodes instantly restore to healthy

The SRE Signal: Demonstrating graph propagation shows you understand Load Balancing Algorithms, High Availability (HA), and Failover Patterns β€” the same patterns used by PagerDuty's service dependency graphs.


2. πŸ’° Cloud Economics Engine (Financial Intelligence)

Engineers who understand money are rare. This feature proves you can think about the bottom line.

The Cost Formula:

$$Total\ Cost = \sum_{i=1}^{n} (Instance_{i} \times Rate_{i} \times 730h) + \sum_{e \in edges} (CrossRegionGB \times $0.02) + ManagedServices$$

What it calculates:

Component Pricing
EC2 instances Mock AWS rates: t3.micro ($0.0104/hr) β†’ r5.xlarge ($0.252/hr)
Managed services Fixed monthly: RDS ($25), ElastiCache ($15), SQS ($1), etc.
Cross-region penalty $0.02/GB + latency penalty when nodes span regions
Lambda $0.20 per million invocations

The floating Live Bill widget updates instantly as you add/remove/modify nodes, showing monthly total, annual projection, and hourly rate.


3. πŸ›‘οΈ Security Posture Overlay (DevSecOps)

Your "Security Score" and critical rules are exactly what senior engineers look for in code reviews.

Security Rules Engine:

Rule Severity Trigger Why It Matters
Direct DB Exposure πŸ”΄ CRITICAL Client β†’ Database without backend Violates network isolation; exposes data layer
No API Gateway/WAF 🟠 HIGH Client β†’ Server without Gateway No rate limiting, no request validation
No Authentication 🟠 HIGH Servers + Clients but no Gateway All endpoints publicly accessible
No Encryption (TLS) 🟑 MEDIUM Server β†’ DB without TLS indicators Data in transit is vulnerable to MITM attacks
Single Region 🟑 MEDIUM All nodes in one region No disaster recovery; single point of failure

Features:

  • Security Score (0–100) with color-coded progress bar
  • Severity grid showing CRIT/HIGH/MED/LOW counts at a glance
  • Edge highlighting: Critical = pulsing red with glow, High = orange, Medium = yellow
  • Node badges showing vulnerability count per component

4. πŸ“¦ Enterprise-Scale Exports (Production Ready)

Generating a .zip with deployment.yaml, service.yaml, and hpa.yaml is the ultimate "I'm ready for production" signal.

Export Type What's Generated Recruiter Value
Kubernetes (.zip) deployment.yaml, service.yaml, ingress.yaml, hpa.yaml per component + namespace.yaml + all-in-one.yaml + README.md Extreme β€” Container orchestration & scaling
Terraform (HCL) Clean HCL with variable blocks, sensitive flags for passwords, S3 backend, ACM cert refs, and proper resource tagging Extreme β€” Infrastructure as Code
Docker Compose Multi-service YAML with networks, volumes, and dependency resolution Standard β€” Local dev environments

K8s specifics:

  • Servers β†’ Deployment with HPA (auto-scale 2–10 replicas at 70% CPU)
  • Databases β†’ StatefulSet with volumeClaimTemplates and secretKeyRef for credentials
  • Gateways β†’ Ingress with TLS termination and cert-manager annotations
  • Health probes: livenessProbe + readinessProbe on every container

Terraform specifics:

  • db_password marked as sensitive = true (won't echo in terraform plan)
  • S3 backend for remote state management
  • Variables for instance_type, region, acm_certificate_arn, subnet IDs

5. 🌐 Multi-Region Visualization

  • Nodes display region badges (US-E, US-W, EU, APAC)
  • Cross-region edges render as dashed, pulsing purple lines
  • Cost engine applies data transfer penalties between regions
  • Inspector allows configuring region and instance size per node

🧠 The Intelligence Layer (v1.0)

AI Suggestion Engine

"How does the AI know to suggest Redis or a Load Balancer?"

The engine scans the nodes[] and edges[] arrays for missing architectural patterns:

Current Diagram Has... But Is Missing... Engine Suggests... Engineering Reason
API Server + SQL DB Redis Cache "Add Redis Cache" Reduces DB read latency by ~90% via read-through caching
API Server(s) Load Balancer "Add ALB/NLB" Prevents SPOF; enables horizontal scaling
Static Assets / S3 CDN "Add CloudFront" Reduces global latency from ~300ms to <20ms
API Server(s) API Gateway "Add API Gateway" Centralizes rate limiting, JWT validation, API versioning
Server + Database Message Queue "Add SQS/RabbitMQ" Enables async processing, decouples services

Natural Language β†’ Diagram

User Input: "Build me a WhatsApp clone"
     ↓
Intent Extraction: [chat, websocket, real-time, message]
     ↓
Graph Generation: WebSocket Server β†’ Redis Pub/Sub β†’ Message Queue β†’ NoSQL DB
     ↓
Canvas Population: setNodes + setEdges via Zustand store
User Says... Generated Architecture
"Chat app like WhatsApp" WebSocket Server β†’ Redis Pub/Sub β†’ Message Queue β†’ NoSQL DB
"Video streaming platform" CDN β†’ LB β†’ Gateway β†’ Content Services β†’ S3 Storage
"Online store with payments" CDN β†’ LB β†’ Gateway β†’ Product/Order/Payment Services β†’ SQL DBs
"Social media like Instagram" CDN β†’ LB β†’ Feed + Media Services β†’ Redis β†’ S3 + SQL DBs

Architecture Linter (Static Analysis)

Real-time validation engine that acts as a "Reliability Engineer" β€” verifies architectural topology in $O(n + e)$ time using DFS reachability checks:

Rule ID Severity Trigger Warning
LNT-001 πŸ”΄ Critical Frontend β†’ Database (direct) "Security Risk: Direct database exposure."
LNT-002 🟑 Warning High Traffic β†’ No Cache "Performance Bottleneck: Add Redis."
LNT-003 πŸ”΄ Critical Multi-Server β†’ No LB "SPOF: Load Balancer required."
LNT-004 ℹ️ Info Static Assets β†’ No CDN "Latency Issue: Consider CloudFront."

Capacity Estimator

$$Total\ Monthly\ Cost = \sum (Instances \times Unit\ Price) + (Storage_{GB} \times $0.023) + (Bandwidth_{GB} \times $0.09)$$

The estimator dynamically scales recommendations from t3.micro β†’ c5.xlarge based on user count inputs (1K β†’ 10M users).


πŸ› οΈ IaC Node Mapping

Visual Node Docker Image Terraform Resource K8s Kind
SQL DB postgres:15-alpine aws_db_instance (RDS) StatefulSet
NoSQL DB mongo:7 aws_docdb_cluster StatefulSet
Cache redis:7-alpine aws_elasticache_cluster Deployment
Load Balancer nginx:alpine aws_lb (ALB) Service (LoadBalancer)
API Server node:18-alpine aws_instance (EC2) Deployment + HPA
API Gateway kong:latest aws_api_gateway_rest_api Deployment + Ingress
S3 Storage minio/minio:latest aws_s3_bucket + versioning + SSE β€”
CDN nginx:alpine aws_cloudfront_distribution β€”
Lambda aws-lambda-nodejs:18 aws_lambda_function Deployment
Message Queue rabbitmq:3-management aws_sqs_queue Deployment

πŸ“‚ Project Structure

sys-design-visualizer/
β”‚
β”œβ”€β”€ frontend/                             # React + Vite + Tailwind CSS
β”‚   └── src/
β”‚       β”œβ”€β”€ store/
β”‚       β”‚   └── useDiagramStore.js        ← Zustand (Undo/Redo + Linter + Chaos + Security + Cost)
β”‚       β”œβ”€β”€ components/
β”‚       β”‚   β”œβ”€β”€ customNodes/
β”‚       β”‚   β”‚   └── SystemNode.jsx        ← React.memo, Chaos/Security Visuals, Region Badges
β”‚       β”‚   β”œβ”€β”€ overlays/
β”‚       β”‚   β”‚   β”œβ”€β”€ LiveBill.jsx          ← Floating Cloud Economics Widget
β”‚       β”‚   β”‚   β”œβ”€β”€ SecurityPanel.jsx     ← Security Audit Panel (Score + Findings)
β”‚       β”‚   β”‚   └── Legend.jsx            ← Professional Tabbed Legend
β”‚       β”‚   β”œβ”€β”€ icons/
β”‚       β”‚   β”‚   └── ServiceIcons.jsx      ← 11 Unique SVG Icons
β”‚       β”‚   β”œβ”€β”€ Header.jsx               ← Toolbar + Chaos/Security Toggles + K8s Export
β”‚       β”‚   β”œβ”€β”€ Sidebar.jsx              ← DnD Component Library + Search
β”‚       β”‚   β”œβ”€β”€ FlowCanvas.jsx           ← Canvas + Cross-Region Edges + Mode Overlays
β”‚       β”‚   β”œβ”€β”€ Inspector.jsx            ← Properties + Capacity + Security Tab
β”‚       β”‚   β”œβ”€β”€ LinterPanel.jsx          ← Real-time Warning Overlay
β”‚       β”‚   β”œβ”€β”€ SnapshotPanel.jsx        ← Version Management (V1, V2...)
β”‚       β”‚   └── AiSuggestModal.jsx       ← AI Suggestions + Templates + NLP
β”‚       └── utils/
β”‚           β”œβ”€β”€ iacGenerator.js           ← Docker + Terraform + K8s Manifest Generator
β”‚           └── capacityEstimator.js      ← Infrastructure Sizing Algorithm
β”‚
β”œβ”€β”€ backend/                              # Node.js + Express + MongoDB
β”‚   β”œβ”€β”€ index.js                          ← Server + Socket.io Room Handler
β”‚   β”œβ”€β”€ models/
β”‚   β”‚   β”œβ”€β”€ Diagram.js                    ← Directed Graph Schema (nodes + edges)
β”‚   β”‚   └── User.js                       ← Auth Model (bcrypt hashing)
β”‚   β”œβ”€β”€ controllers/
β”‚   β”‚   β”œβ”€β”€ diagramController.js          ← CRUD + Graph Serialization
β”‚   β”‚   β”œβ”€β”€ authController.js             ← JWT Register/Login
β”‚   β”‚   └── aiController.js              ← Suggestion Engine + NLP Endpoint
β”‚   β”œβ”€β”€ middleware/
β”‚   β”‚   └── auth.js                       ← JWT Verification Middleware
β”‚   β”œβ”€β”€ routes/
β”‚   β”‚   β”œβ”€β”€ diagramRoutes.js              ← REST: POST/GET /api/diagrams
β”‚   β”‚   β”œβ”€β”€ authRoutes.js                 ← POST /api/auth/register|login
β”‚   β”‚   └── aiRoutes.js                   ← POST /api/ai/suggest|nlp
β”‚   └── utils/
β”‚       └── serializer.js                 ← React Flow JSON ↔ Hierarchical Tree
β”‚
└── docs/
    └── screenshots/                       ← Application Screenshots

πŸš€ Quick Start

Prerequisites

  • Node.js 18+
  • MongoDB (local or Atlas)

Installation

# Clone the repository
git clone https://github.com/1tsadityaraj/System-Design-Visualizer.git
cd System-Design-Visualizer

# Install frontend dependencies
cd frontend && npm install

# Install backend dependencies
cd ../backend && npm install

Running

# Terminal 1 β€” Backend (Port 5005)
cd backend
echo "MONGODB_URI=mongodb://localhost:27017/system-design-visualizer" > .env
node index.js

# Terminal 2 β€” Frontend (Port 5173)
cd frontend
npm run dev

Open http://localhost:5173 in your browser.


πŸ”Œ API Reference

Authentication

Method Endpoint Body Response
POST /api/auth/register { email, password, name } { token, user }
POST /api/auth/login { email, password } { token, user }

Diagrams

Method Endpoint Auth Description
POST /api/diagrams Bearer Token Save new diagram version
GET /api/diagrams/:id Optional Retrieve specific diagram
GET /api/diagrams/templates None Pre-built architecture templates

AI Intelligence

Method Endpoint Body Response
POST /api/ai/suggest { nodes: [...] } { suggestions: [...] }
POST /api/ai/nlp { description: "..." } { diagram: { nodes, edges } }

Socket.io Events

Event Direction Payload Purpose
join-room Client β†’ Server { diagramId, user } Join collaboration room
cursor-move Bidirectional { x, y } Live cursor positions
node-move Bidirectional { nodeId, position } Real-time node dragging
graph-change Bidirectional { nodes, edges } Structural changes
room-users Server β†’ Client [ { name, color } ] Online users list

⚑ Performance Optimizations

Technique Implementation Impact
React.memo on nodes SystemNode.jsx wraps the entire component 60fps with 100+ nodes
Selective linter runs Only re-runs on structural changes (add/remove), not position moves No lag during drag
Zustand selectors Components subscribe to specific slices, not the whole store Minimal re-renders
Snap-to-Grid 20px grid reduces position change events Smoother dragging
History cap Max 40 undo states, FIFO eviction Bounded memory usage
Edge memoization useMemo for styled edges with security/cross-region overlays Prevents re-computation

πŸ—οΈ Technical Stack & Skills Demonstrated

Layer Technology Highlight Engineering Justification
Frontend UI React 18, Vite, Tailwind CSS v4 Build highly interactive, responsive, and performant visualizations.
State Mgt Zustand, React Flow Manages complex graph data structures, undo/redo stacks, and real-time canvas updates.
Backend API Node.js, Express.js Lightweight, highly scalable REST API implementation.
Database MongoDB, Mongoose Schema-flexible data modeling for deeply nested directed graph architecture states.
Auth & Sec JWT, bcrypt Stateless, secure authentication and password hashing.
Real-time Socket.io Bi-directional WebSockets for live cursor movements and multi-user collaboration.
DevOps / IaC Terraform, Kubernetes, Docker Custom generators that transpile visual graphs into production-ready manifests.
Algorithms BFS / DFS Real-time static analysis and chaos degradation propagation across directed acyclic graphs.

πŸ“„ License

MIT Β© Aditya Raj

About

πŸ—οΈ Enterprise-grade System Design Visualizer: AI-powered Architecture Linting, Chaos Engineering Simulations, DevSecOps Audits, and automated IaC (Terraform/K8s) generation.

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors