Grafyx

High-performance CLI-driven code knowledge graph tool for visualizing codebase relationships with D3.js.

Rust D3.js License
Stars Repo Size Forks Issues Website

GitHub: 0xarchit/grafyx
Live Demo: https://grafyx.0xarchit.is-a.dev

Overview

Grafyx is a high-performance, CLI-driven code knowledge graph tool designed to map and visualize the complex relationships within modern codebases. By parsing directory structures and service interactions, Grafyx generates an interactive 2D/3D force-directed graph that helps developers understand dependency chains, structural bottlenecks, and project architecture at a glance.

Developed with Rust for safety and speed, and D3.js for fluid frontend interactions, Grafyx bridges the gap between static analysis and intuitive visual exploration.

Visual Demo

Grafyx Graph Visualization
Grafyx Graph Visualization

Architecture

Grafyx follows a decoupled architecture, ensuring high-speed processing and a responsive user experience.

System Flow Diagram

graph TD
    subgraph "CLI Layer"
        A[Rust CLI Parser]
    end
    
    subgraph "Graph Engine"
        B[Node/Edge IR]
        C[Dependency Resolver]
    end
    
    subgraph "Storage"
        D[(SQLite)]
        E[(JSON)]
    end
    
    subgraph "Frontend"
        F[D3.js Visualization]
        G[Physics Engine]
        H[Interactive UI]
    end
    
    A --> B
    B --> C
    C --> D
    C --> E
    D --> F
    E --> F
    F --> G
    G --> H

Features

Feature Description Status
Recursive Scanning Scans entire projects to map file/directory hierarchies ✔ Active
Hot Physics Real-time adjustable simulation forces with sub-millisecond response ✔ Active
Static Binaries Universal Linux binaries (MUSL) optimized for Arch and Ubuntu ✔ Active
Self-Managing Integrated install and upgrade commands for zero-friction setup ✔ Active
Apple Silicon Native Native performance for M1/M2/M3 architecture via ARM64 targets ✔ Active
Dual Storage Outputs both human-readable JSON and performance-optimized SQLite ✔ Active

Live Physics Engine

Grafyx features a "Hot Update" physics engine inspired by tools like Obsidian. Adjusting sliders instantly ripples through the graph without requiring a full re-render, keeping the simulation fluid and "liquid."

Force Parameters

  • Repulsion: Determines how much nodes push away from each other
  • Link Distance: Controls the target length for edges
  • Gravity (Center Force): Pulls all nodes toward the center point
  • Damping: Adjusts the decay rate of movement for stability

Getting Started

Installation

Linux (AMD64):

macOS (Apple Silicon):

macOS (Intel):

Windows (PowerShell):

Build from Source

git clone https://github.com/0xarchit/grafyx.git
cd grafyx/tool
cargo build --release

Quick Start

If this is your first time using Grafyx, run the command below from your project root.

Scan Command

grafyx --dirs <directories space separated> --output ./<output folder>

Example:

grafyx --dirs tool web --output ./output-test

After scan completes:

  • Open ./<output folder>/index.html in your browser
  • Use grafyx.json for readable data export
  • Use grafyx.db for fast programmatic queries

Usage

Commands

Command Alias Description
grafyx --dirs <directories...> --output ./<output-folder> - Scan directories and generate graph
grafyx install i Install binary permanently to system PATH
grafyx upgrade u Automatically update to latest version
grafyx uninstall - Cleanly removes Grafyx from your system
grafyx --version - Display current version

Scan Flags

Flag Description
--dirs One or more directories to scan, space separated
--output Output folder for grafyx.json, grafyx.db, and index.html
--format Output type: json, sqlite, or both (default)
--ignore Optional ignore patterns to exclude files/directories

Configuration

Settings are persisted in the browser's localStorage under grafyx-settings. This allows you to maintain your custom visual configuration across different scans of the same project.

  • Theme: Fixed dark mode for maximum contrast
  • Node Colors: Scaled based on connectivity or type (Service/Import vs. Structural)
  • Link Colors:
    • Vibrant Green: Service dependencies/imports
    • White: Structural hierarchy

Attribution

Grafyx is created and maintained by 0xArchit.

If you build on top of this project, please provide proper attribution. Any derivative works must retain the original copyright notice in the license.