CodeMap Visualizer is a modern, interactive web application designed to render, analyze, and share structured code analysis data. It transforms complex JSON data representing code execution flows and architecture into beautiful, easy-to-understand visual guides.
Built with Angular (Zoneless, Signals), Tailwind CSS, and Mermaid.js.
- Interactive Architecture Diagrams: Automatically renders high-level architectural graphs using Mermaid.js.
- Step-by-Step Code Traces: Navigate through complex execution flows with detailed explanations and context.
- Rich Text Guides: Renders Markdown-based guides with syntax highlighting for better readability.
- Code Syntax Highlighting: accurate syntax highlighting for code snippets using Highlight.js.
- History Management: Automatically saves your recently viewed maps to local storage for quick access.
- Easy Import/Export:
- Paste JSON directly.
- Import
.jsonfiles or scan folders. - Download maps or copy them to the clipboard.
- Dark Mode UI: A polished, developer-friendly dark theme inspired by modern IDEs.
- Framework: Angular v18+ (Standalone Components, Signals, Zoneless Change Detection)
- Styling: Tailwind CSS
- Visualization: Mermaid.js
- Markdown Rendering: Marked.js
- Syntax Highlighting: Highlight.js
- Icons: Heroicons (SVG)
You can load a CodeMap in three ways:
- Paste JSON: Click "New Import" and paste your raw JSON string into the text area.
- Select File: Upload a valid
.jsonfile from your computer. - Select Folder: Select a folder containing a
.jsonfile to automatically find and load it.
Once loaded, the screen is split into two main areas:
- Sidebar (Left): Displays metadata about the generation (timestamp, mode) and a list of available Trace Flows. Click a trace to focus on it.
- Main View (Right):
- Architecture Diagram: A visual overview of the system components and their relationships.
- Trace Details: Scroll down to see specific flows. Each trace includes a "Trace Guide" (Markdown explanation), an ASCII flow diagram, and a sequence of "Code Locations" showing the actual source code with context.
- Click the History button in the top navigation bar to see previously loaded maps.
- Maps are stored locally in your browser.
- You can clear the history at any time.
To generate your own CodeMaps, your JSON data must follow this structure:
interface CodeMap {
schemaVersion: number; // e.g., 2
title: string; // Title of the visualization
description: string; // Brief summary
mermaidDiagram: string; // Mermaid graph definition (e.g., "graph TD; A-->B;")
metadata: {
mode: 'FAST' | 'SMART' | 'ENHANCED';
generationTimestamp: string; // ISO date string
originalPrompt?: string;
[key: string]: any;
};
traces: Trace[];
}
interface Trace {
id: string;
title: string; // Name of the specific flow
description: string; // Summary of what this trace does
traceGuide: string; // Markdown content explaining the flow
traceTextDiagram: string; // ASCII or simple text representation of the flow
locations: Location[]; // Ordered list of code snippets
}
interface Location {
id: string;
path: string; // File path (e.g., "src/app.component.ts")
lineNumber: number; // Line number of interest
lineContent: string; // Actual code content
title: string; // Short title for this step
description: string; // Explanation of what happens here
}This project is built as a Zoneless Angular Application.
src/main.ts: Application entry point (bootstrapsAppComponent).src/models/codemap.model.ts: TypeScript interfaces for the data domain.src/services/codemap-history.service.ts: Handles LocalStorage persistence.src/components/:codemap-viewer: The main layout component.trace-detail: Handles rendering individual traces, markdown, and code highlighting.
The project loads several heavy libraries via CDN in index.html to keep the bundle size small and leverage caching:
- Tailwind CSS (Script)
- Mermaid.js
- Marked
- Highlight.js
Generated by Google Gemini