CodeGraph/docs
Section 1.1

What is CodeGraph?

A high-performance, deterministic static analysis platform that converts JavaScript and TypeScript repositories into queryable, typed entity-relationship graphs.

The Problem: Codebase Invisibility

Modern JavaScript and TypeScript applications grow quickly into interconnected webs of files, classes, functions, interfaces, and external npm packages. When engineers make changes or refactor code, they frequently encounter questions that standard language servers and text search cannot answer authoritatively:

  • Upstream blast radius: "If I change the signature of this utility function, which 14 files and 32 callers will be broken across the monorepo?"
  • Downstream closure: "What is the exact transitive dependency closure needed to run this module in isolation?"
  • Architectural cycles: "Where are the circular imports creating subtle runtime initialization bugs or bundling bloat?"
  • Structural hotspots: "Which classes act as bottleneck 'God objects' with excessive incoming and outgoing coupling?"

What CodeGraph Is

CodeGraph is a structural fact graph generator and analytics engine. It scans your repository on disk, compiles modern JS/TS files into Abstract Syntax Trees (ASTs), extracts typed declarations, resolves import and call bindings, and builds an in-memory indexed directed graph.

DimensionHow CodeGraph Treats It
InputA directory path to any JavaScript or TypeScript codebase.
OutputA canonical 5-map in-memory Graph containing typed nodes and directed edges.
DeterminismGiven the exact same repository files, the pipeline produces identical node IDs, edge IDs, and metrics.
Execution Mode100% static analysis — no code is ever executed or evaluated at runtime.
PersistenceSerializes into compact JSON node/edge lists that reconstruct the 5-index graph instantly.

What CodeGraph Is Not

To maintain strict architectural boundaries and precision, CodeGraph establishes clear limits:

  • Not a dynamic runtime profiler: CodeGraph does not execute your code or observe CPU/memory usage.
  • Not an LLM-based hallucination engine: Graph edges are mathematically proven from AST bindings, not guessed by AI models.
  • Not a generic text searcher: Queries follow semantic graph paths, not raw string matches.
Canonical Architecture Transformation
The entire transformation flows strictly in one direction:
Raw Repository → Discovery Walker → AST Generation → Metadata & Symbols → Relationship Linking → Canonical Graph → Analytics Engine → Health Index