CodeMap Visualizer is a developer tool designed to transform static source code into interactive, explorable mind maps. By leveraging Abstract Syntax Tree (AST) parsing, it visualizes the relationships between classes, functions, and methods across multiple programming languages (Python, MATLAB, C++).
- Node.js (v18+)
- Python (v3.8+)
- npm or yarn
-
Clone the Repository
git clone https://github.com/your-username/codemap-visualizer.git cd codemap-visualizer -
Backend Setup (FastAPI)
Option A: Using pip (traditional)
cd backend python -m venv venv source venv/bin/activate # Windows: venv\Scripts\activate pip install -r requirements.txt uvicorn main:app --reload
Option B: Using uv (recommended, faster)
cd backend uv venv source .venv/bin/activate # Windows: .venv\Scripts\activate uv pip install -r requirements.txt uvicorn main:app --reload
The API will be available at
http://localhost:8000. -
Frontend Setup (Next.js) Open a new terminal window:
cd frontend npm install npm run devThe application will be accessible at
http://localhost:3000.
CodeMap Visualizer operates on a decoupled client-server architecture designed for extensibility and performance.
The backend serves as the parsing engine and file system interface.
- AST Parsing: Utilizes language-specific libraries (
astfor Python, custom parsing for C++/MATLAB) to extract structural metadata (functions, classes, arguments) without executing code. - API Layer: Exposes endpoints for file scanning (
/scan-file,/scan-folder) and data persistence. - Storage: Metadata and comments are persisted in a non-intrusive
.visualizerdirectory within your project'sassets/folder ({project_root}/assets/.visualizer/). Files are named using a collision-resistant strategy based on relative paths.
The frontend handles visualization, state management, and user interaction.
- Graph Rendering: Powered by React Flow for performant interactive node-based UIs and Dagre for deterministic, hierarchical graph layout algorithms.
- State Management: React State and Effect hooks manage the graph data, user preferences (theme, spacing), and file system traversal.
- Design System: Built with Tailwind CSS for a responsive, dark-mode-first aesthetic.
- Multi-Language AST Support: Accurate parsing for Python, MATLAB, and C++.
- Interactive Visualization:
- Dynamic Layout: Adjustable node spacing and auto-layout.
- Zoom & Pan: Infinite canvas navigation.
- Mini-Map: High-level structural overview.
- Annotation System:
- Rich Comments: Add context-aware notes to any code node.
- Tagging: Categorize nodes (e.g., TODO, BUG, REVIEW).
- Centralized Storage: Annotations persist across sessions.
- Developer Tools:
- Search: Fuzzy search for function/class names with keyboard navigation.
- Bookmarks & Recents: Quick navigation to frequently accessed files.
- Export: Save visualizations as high-resolution images or PDFs.
CodeMap Visualizer is built for power users who demand precision and control.
- Zero-Hallucination Parsing: Unlike LLM-based or regex tools, CodeMap uses language-native AST parsers. This guarantees that every class, function, and argument shown in the graph exists exactly as written in your source code.
- Intelligent Caching: The application utilizes a smart caching layer (
.visualizer) that persists your comments and layout metadata. Annotations survive git checkouts and branch switches, making it a robust companion for long-term projects. - Deterministic Layout Engine: Powered by Dagre, the graph layout is mathematically calculated to minimize edge crossing and maximize readability. It's not just a random scattering of nodes; it's a structural blueprint of your logic.
- Privacy-First Architecture: Your code never leaves your machine. All scanning, parsing, and visualization happens locally on your device, ensuring 100% data privacy for proprietary codebases.
- Launch the App: Ensure both backend and frontend servers are running.
- Select a Project: Use the sidebar folder picker to open a local directory.
- Visualize Code: Click on any file in the file tree to generate its graph.
- Annotate: Right-click nodes to add comments or tags.
- Configure: Use the Sidebar settings to adjust layout density, font size, or clear application cache.
You can push comments directly to Linear from the CodeMap Visualizer.
Setup:
-
Select a Project Folder: Open the app and select your project's root folder.
-
Locate Configuration File: The app will automatically create a configuration file at
assets/.visualizer/.envwithin your project.- Note: You may need to enable "Show Hidden Files" to see the
.visualizerfolder.
- Note: You may need to enable "Show Hidden Files" to see the
-
Configure Credentials: Open
assets/.visualizer/.envand fill in the following:LINEAR_API_KEY=lin_api_key_... LINEAR_TEAM_ID= LINEAR_PROJECT_ID=
How to find your credentials:
-
LINEAR_API_KEY (Required):
- Go to Linear.
- Click on your profile picture (top left) → Settings (or Account).
- Select API from the sidebar.
- Under Personal API keys (sometimes labeled "Member API keys"), click Create key.
- Name it "CodeMapVisualizer" and copy the key (starts with
lin_).
-
LINEAR_TEAM_ID (Optional):
- Navigate to the specific Team in Linear.
- Press
Cmd/Ctrl + K-> Search for "Copy Team ID". - If left blank, the app defaults to your first available team.
-
LINEAR_PROJECT_ID (Optional):
- Navigate to the specific Project in Linear.
- Press
Cmd/Ctrl + K-> Search for "Copy Project ID". - If set, new issues will be automatically assigned to this project.