Back to projects

Case Study · Graph Systems

Holocron Timeline Engine

A graph-backed timeline system that models events and causal dependencies in Neo4j, then supports traversal-heavy reads, break simulation, and world-state reconstruction.

This project let me work on a class of system that standard CRUD apps rarely touch: graph traversal, mutation replay, and simulation logic over request-scoped subgraphs.

Core model

Events as nodes, causal links as edges, state change represented through mutation relationships

Simulation

What-if break propagation through downstream dependencies in topological order

Replay

Universe state rebuilt from baseline state plus ordered prior mutations

What I built

Built the full stack across a Next.js frontend, FastAPI backend, and Neo4j graph store, including traversal, validation, simulation, and replay logic.

FastAPIPythonNeo4jNext.jsTypeScriptDocker
The frontend is a thin client over REST endpoints that render timelines, graph views, and simulation states.
The FastAPI backend owns chronology normalization, traversal rules, break simulation, relationship validation, and world-state replay.
Neo4j is the source of truth; the backend stays stateless with respect to graph topology and performs request-scoped traversal and simulation work.

Results

Built a system that can answer dependency questions such as what must happen before an event and what breaks if one event is removed.
Separated stateless read paths from ingestion and backfill jobs, which kept request handling simpler while preserving graph integrity.
Used validation rules to reject invalid or contradictory relationships before they entered the graph.

Hard problems

Chronology normalization across BBY/ABY boundaries

The backend stores chronology as signed integers with an internal zero so filtering, sorting, interval math, and replay can all work on a continuous numeric axis.

Break simulation over downstream causal graphs

The simulation service computes a topological order over the downstream subgraph, then marks events as invalidated or unresolved based on surviving dependencies.

State reconstruction without snapshotting every node

Instead of storing full snapshots on graph nodes, the system replays curated state mutations in chronology order and uses checkpoints to reduce repeated replay cost.

Reliability and verification

Relationship writes validate endpoint existence, chronology rules, cycle constraints, and duplicate edges before persisting changes.
Universe-state reads use checkpoints plus a database-derived version token to avoid stale reuse after graph writes.
The project includes unit tests around the simulation path and CLI workflows for transform, ingest, audit, and mutation backfill.

Tradeoffs and lessons

Neo4j made traversal-heavy reads natural, but deep graph queries and large payloads remain the main performance bottlenecks.
Checkpointed in-process state is a simpler middle ground than pushing the system toward shared cache infrastructure too early.
The frontend intentionally stays thin; most complexity is concentrated in the backend engine and repository layers.