Overview
Krait analyzes each API endpoint by generating a call graph that shows a hierarchical representation of your codebase. The call graph provides function invocation relationships for the endpoint, depicting cross-file interactions.How it works
Krait builds the call graph through the following process:- Identifies the endpoint’s controller and traces its execution path
- Creates structured nodes representing key elements such as routes, controllers, functions, middleware, and HTTP status codes
- Defines parent-child relationships between these nodes to reflect how each component is invoked
- Stores the full structure in a Memgraph database for querying and visualization
Node relationships
Krait performs a breadth-first search (BFS) starting from the controller function, using LSP and Tree-Sitter to map out the relationships between nodes:Route → Controller
Connected by
ROUTED_BY relationshipRoute → Middleware
Connected by
HAS_MIDDLEWARE relationshipController → Functions
Connected by
CALLS relationshipFunctions → Status Codes
Connected by
EMITS relationshipVisualization
The call graph provides a complete picture of how data and logic flow through your application, enabling precise security analysis and dependency tracking.
The call graph is generated automatically as soon as your code repository is integrated, with no additional manual steps required.