Skip to main content
All projects
Personal projectResilience · Distributed simulation

Surgyah

A visual lab for building an infrastructure, triggering failures, and understanding how they propagate through a deterministic simulation engine.

Preview of Surgyah
Scope
An open-source personal project designed as an architecture and technical-learning demonstration. The public demo runs in the browser, while the repository provides a complete distributed mode through Docker.
My role and contribution
Product design, architecture, and full-stack developmentI designed the guided journey, infrastructure canvas, simulation engine, diagnostics, and run comparison, along with the optional distributed architecture and its documentation.
Main stack
Next.jsTypeScriptReact FlowPostgreSQLRedisBunDocker

Case study

From context to design decisions

01

Context

Failures in a distributed architecture are difficult to explain with a static diagram: local saturation can fill a queue, slow a dependency, and then degrade the entire user journey. Surgyah turns those invisible relationships into an interactive, progressive experience.

02

Challenge and constraints

Model capacity, queues, dependencies, and incidents faithfully enough to produce useful outcomes while keeping every consequence understandable to someone discovering resilience.

03

Approach

I isolated a pure TypeScript engine that compiles the graph and computes each state without relying on system time or an external service. Three guided missions apply a traffic spike, an API outage, and a PostgreSQL failure; the interface displays their propagation, metrics, and causal chain live.

04

Decisions and tradeoffs

The public demo runs the engine in the browser to remain immediate, free, and self-contained, but it does not persist runs. The same engine can also run in a Docker architecture where Next.js records runs, Redis Streams feeds a Bun worker, and SSE streams results.

05

Observable outcome

The live version lets users edit an infrastructure, run 18 deterministic steps, track CPU, queues, latency, and success rate, and compare two runs before and after an improvement. The repository also documents and tests the distributed PostgreSQL, Redis, and worker journey.

Key points

What the project demonstrates

Simulation

A deterministic engine

Each tick starts from the same state and events to produce a reproducible result that can be tested without an external API or AI.

Learning

From failure to impact

The graph, metrics, and causal chain connect a technical incident to its concrete consequences for the user.

Architecture

Two modes, one engine

The self-contained demo shares its computation core with a distributed journey combining PostgreSQL, Redis Streams, a Bun worker, and SSE.

Critical perspective

Limitations and next steps

Current limitation

The browser demo does not retain canvas positions or history after closing. In distributed mode, recovery after a worker crash and pause or stop commands are not yet part of the MVP.

Next step

Persist the canvas layout and comparison history, then add interrupted-run recovery and checkpoints to distributed mode.