? AI-powered code visualizer ?
Visit the Live Demo on GitHub Pages
Transform any codebase into a stunning, interactive visual mind map. CodeVista parses your project's AST (Abstract Syntax Tree), extracts dependencies, and renders them as a real-time force-directed graph using D3.js.
Integrated with an AI layer to provide intelligent code pattern analysis on top of the graph! ??
CodeVista is designed to help developers comprehend large codebases rapidly by rendering their Abstract Syntax Trees (ASTs) and dependency graphs interactively. Below is the detailed documentation of how the platform operates under the hood, how to deploy it, and how to utilize it effectively.
The core of CodeVista operates in three distinct phases:
-
AST Parsing & Traversal: The codebase is recursively traversed using glob patterns. Files are read and passed to
@babel/parserwhich parses modern JavaScript, TypeScript, and JSX/TSX into an Abstract Syntax Tree. -
Graph Construction: From the ASTs, the
Graph Builderextracts ES6import/exportstatements, CommonJSrequirecalls, and dynamic imports. Files and modules become nodes, and their dependency relationships become edges. -
Interactive Visualization: The structured node-edge data is passed to a high-performance D3.js force-directed simulation. This simulation maps the data into a 2D physical space, applying gravitational and repulsive forces to automatically organize the code structure logically.
flowchart TD
A[Your Codebase] --> B(AST Parser & File Walker)
B -->|babel parser| C{Graph Builder}
C -->|Nodes & Edges| D[D3.js Force Graph]
D -->|Request| E[AI Service API]
E -->|Insights| D
D --> F((Interactive Visual))
style A fill:#f9f,stroke:#333,stroke-width:2px
style D fill:#bbf,stroke:#f66,stroke-width:2px,color:#fff
style F fill:#9f9,stroke:#333,stroke-width:4px
- ?? Force-directed graph - Interactive D3.js visualization of codebase structure
- ??? Zoom & pan - Smooth navigation through large code graphs
- ?? Node selection - Click to inspect any file or module
- ??? Smart icons - Visual indicators for file types (components, utils, hooks, etc.)
- ?? File system walker - Glob pattern support for any project structure
- ?? AI analysis - OpenRouter integration for intelligent code insights
- ?? Export as SVG - Save your interactive architecture diagrams directly to your disk
- ?? Real-time updates - State management with Zustand
- ?? Beautiful UI - Modern React with TypeScript type safety
- ?? Docker support - Ready-to-deploy container image
| Layer | Technology |
|---|---|
| Frontend | React 18, TypeScript 5 |
| Visualization | D3.js (force simulation) |
| Build | Vite 5 |
| State | Zustand |
| AI | OpenRouter API |
| Styling | CSS Modules |
| Container | Docker + Nginx |
# Clone and install
git clone https://github.com/Luv-Goel/CodeVista.git
cd CodeVista
npm install
# Start development server
npm run dev
# Build for production
npm run buildThe Docker image serves the production build via Nginx with Gzip compression, Security headers (CSP, XSS protection), SPA routing support, and Static asset caching.
# Build the image
docker build -t codevista .
# Run the container
docker run -d -p 8080:80 --name codevista-app codevista- Push the repo to GitHub
- Import to Vercel
- Set build command:
npm run build - Set output directory:
dist
- Connect your GitHub repo to Netlify
- Build command:
npm run build - Publish directory:
dist - Add redirect rule:
/* /index.html 200(for SPA routing)
Any static file host works with the dist/ folder:
npm run build
# Deploy the dist/ folder to your host of choiceCodeVista/
|-- src/
| |-- components/ # React components
| | |-- CodeVisualizer/
| | |-- ControlPanel/
| | |-- NodeInspector/
| | |-- VisualizationCanvas/
| |-- services/ # Business logic
| | |-- astParser.ts # @babel/parser wrapper
| | |-- fileWalker.ts # File system traversal
| | |-- aiService.ts # OpenRouter API client
| |-- stores/ # Zustand state stores
| |-- types/ # TypeScript type definitions
| |-- __tests__/ # Component tests
| |-- App.tsx # Main application
| |-- App.css # Application styles
| |-- index.css # Global styles
| |-- main.tsx # Entry point
|-- public/
|-- dist/ # Production build output
|-- Dockerfile # Multi-stage Docker build
|-- nginx.conf # Nginx configuration for Docker
|-- index.html
|-- package.json
|-- tsconfig.json
|-- vite.config.ts
|-- jest.config.js
- Start the app -
npm run devopens the visualizer - Point to a codebase - Enter a local path or GitHub URL
- Explore the graph - Pan, zoom, click nodes to inspect
- AI insights - Let AI analyze code patterns and dependencies
- Export Diagrams - Download SVG graphs from the control panel for architectural planning
- Architecture - Detailed architecture overview
- Screenshots - UI screenshots
- Contributing - How to contribute
- Changelog - Release history
- Security - Security policy
MIT - see LICENSE.
