Neo4j (Graph Database)
maang.io System Design Series
Neo4j stores data as a property graph β nodes and relationships as first-class citizens. Its key trick is index-free adjacency: relationships are direct pointers, so traversing them is O(1) per hop instead of a JOIN. That makes deep, connected queries (recommendations, fraud rings, social graphs) fast where relational databases choke, all expressed in the Cypher query language.
This deep dive comes in three parts:
- Foundations & Core Concepts β the property-graph model, index-free adjacency, and Cypher.
- Internals β the record store, linked-list traversal, and where graphs win, with worked numbers.
- Interview β Staff/Principal Q&A: graph-vs-relational and modeling connected data.
Neo4j (Graph Database) β Part 3: System Design & Interview Mastery
maang.io System Design Series
What is this?
You now know Neo4j from the Cypher pattern down to the 34-byte relationship record. This chapter is where that pays off in the room. An interviewer doesn't want you to recite "Neo4j uses index-free adjacency" β they want to watch you reach for a graph at the right moment, model the traversal correctly, and defend the trade-offs when they push on scale and consistency. That's the senior signal.
Two parts: first where Neo4j fits in real designs (with diagrams and a query-first model), then a mock interview β for each question, what they're really asking, a model answer, and the senior line that says you've done this for real.
The one-line idea: interviewers use graph databases to test whether you can recognize a connections-shaped problem, model it so the hot query is a cheap traversal, and then live honestly with the costs β no free horizontal sharding, single-leader writes, and the supernode trap.
Sign in to continue reading
The rest of this lesson is available with a free account. Signing in with Google or Microsoft is free.
Sign in to read the full lesson