2026 · Code comprehension tool
CodeAtlas
Paste C source code, get an interactive Mermaid flowchart for every function, rendered on a Figma-like canvas with zoom, pan, and SVG or PNG export.
Why I built this
Reading unfamiliar C is slow, and most diagram tools either need a heavy IDE or hand-drawing. I wanted to paste a file and immediately see the control flow per function. Building both an AST engine and an LLM engine forced a clean separation: the deterministic path proves correctness and runs without a model, while the LLM path adds richer narration when a backend is available.
Architecture
Two diagram engines
- AST mode · ast-grep parses C and emits Mermaid directly, deterministic, no model needed
- LLM mode · each function sent through LiteLLM with few-shot prompts for richer diagrams
- Provider agnostic · Ollama, GitHub Models, OpenAI, or Anthropic, switched by config
- Persistence · aiosqlite stores parsed functions and generated diagrams
Frontend canvas
React 19 and TypeScript with Tailwind and Mermaid 11, built with Vite and served by Nginx, which also proxies the API and the WebSocket back to the FastAPI backend. The canvas supports zoom, pan, and SVG or PNG export per function.
Tech stack
Technologies used
core
infra
tools
Key highlights
Proof points
- 01
Two interchangeable diagram engines from one backend: a deterministic ast-grep AST path that needs no model, and an LLM path for richer diagrams.
- 02
LLM calls go through LiteLLM, so the same code runs against local Ollama, GitHub Models, OpenAI, or Anthropic, selected by configuration.
- 03
React 19 and TypeScript canvas renders Mermaid per function with zoom, pan, and SVG or PNG export.
- 04
Ships as a four-service Docker Compose stack and defaults to local Ollama, so it runs free and offline out of the box.
Focus areas
Explore the work