This CRAZY Graphify Code Graph Traced My API Request... Until the Database

The video demonstrates how Graphify creates a knowledge graph from code, documentation, and SQL files to help trace API request flows in unfamiliar codebases, successfully mapping many parts but falling short in fully capturing database write operations. While Graphify offers valuable high-level insights and visualization tools for navigating complex projects, it cannot replace manual source code reading, especially for verifying critical details like database interactions.

The video explores the use of Graphify, a tool designed to map and trace API requests through unfamiliar codebases by creating a knowledge graph from the project’s code, documentation, and SQL files. The presenter tests Graphify on Umami, an open-source analytics app, to investigate why a page view isn’t being saved. Graphify generates thousands of nodes and edges representing code elements and their relationships, distinguishing between extracted edges (directly read from source) and inferred edges (deduced by the tool). This static analysis provides a high-level map of the code, helping developers quickly orient themselves in a new project.

Graphify successfully traces many parts of the API request flow, such as the post handler, session parsing, and event saving functions. However, it falls short in fully capturing database write operations, particularly missing connections between SQL nodes and the rest of the code, including the Prisma schema. The presenter highlights that while the graph offers valuable leads, it cannot replace reading the actual source code to confirm critical details like database writes. This limitation underscores the difference between static analysis and dynamic runtime behavior.

The video also compares two approaches to tracing the code: one starting from raw file reads and another beginning with the graph. Both methods identify key database tables and Kafka topics but fail to find the code that reads from Kafka. The graph-based approach makes fewer tool calls but does not significantly reduce the amount of data sent to the model, indicating limited efficiency gains. Additionally, the presenter experiments with incorporating documentation into the graph, showing that markdown links and function names can be converted into graph references without invoking the model.

Graphify’s visualization capabilities are demonstrated through a new canvas renderer that can display thousands of nodes grouped into communities, providing an overview of the project structure. While the grouped view offers a high-level summary, detailed exploration requires zooming in and searching for specific functions or database tables. The presenter notes that even with these visual tools, some gaps remain, such as missing functions that write to certain tables, reinforcing the need for manual code inspection alongside graph exploration.

In conclusion, the presenter finds Graphify useful for quickly getting oriented in a large, unfamiliar codebase and for identifying potential paths and relationships within the code. However, the tool should be seen as a complement rather than a replacement for reading the source code, especially when verifying critical operations like database writes. The video encourages developers to use Graphify to find neighborhoods of interest in the code and then dive into the source to confirm and understand the details, making it a valuable aid in navigating complex projects.

Useful Links