Turn Your Codebase into a Knowledge Graph with Graphify
Ever feel like you're drowning in a new codebase? You open a folder, see dozens of files and dependencies, and the mental map you need to build feels like a massive upfront tax. What if you could just ask questions about the structure instead of manually tracing it?
That's the idea behind Graphify. It's a tool that scans a directory of source code and automatically builds a queryable knowledge graph from it. Think of it as giving your codebase a brain you can talk to, revealing the hidden connections between files, functions, and data flow.
What It Does
In simple terms, you point Graphify at a folder—like a project root—and it gets to work. It parses the code (currently optimized for JavaScript/TypeScript), extracts the key entities (think functions, variables, classes), and identifies the relationships between them (like "calls", "imports", "exports"). It then constructs a graph from all these points and links, and spins up a local interface where you can explore it visually or query it using a search-like syntax.
Why It's Cool
The magic isn't just in visualization; it's in the query layer. Instead of using grep to find a function and then more grep to find its usages, you can ask the graph questions. For example, you could query for "all functions that call both validateUser and logTransaction" to understand a specific workflow. It surfaces architectural patterns and hidden dependencies instantly.
It's also locally run and language-aware. It doesn't just do text matching; it uses parsing to understand the actual structure of the code. This makes the resulting graph semantically meaningful. The potential use cases are broad: speeding up onboarding, performing impact analysis before a refactor, or just documenting the flow of a complex module.
How to Try It
Getting started is straightforward. The project is on GitHub, and you can clone it and run it with Node.js.
# Clone the repository
git clone https://github.com/safishamsi/graphify.git
cd graphify
# Install dependencies
npm install
# Run it against a target code directory
npm start -- /path/to/your/code
Once it processes the code, it will typically start a local server (check the repo's README for the latest specifics). You can then open your browser to http://localhost:3000 (or similar) to start exploring the interactive graph.
Final Thoughts
Graphify feels like a step towards a more intuitive way to interact with code. As developers, we naturally think in graphs—dependencies, data flow, execution paths—but our tools are often stuck in linear text. This tool bridges that gap. It won't replace your IDE, but as a companion for understanding and navigating complex relationships, it's a fascinating experiment. The next time you're handed a sprawling legacy folder, you might want to graph it first and ask questions later.
Found this interesting? Follow for more cool projects: @githubprojects
Repository: https://github.com/safishamsi/graphify