Codebase Cartographer is an AI-powered developer tool that instantly visualizes the structure of your project. It turns spaghetti code into an interactive map, explaining every function and warning you about critical dependencies using Google Gemini AI.
project_demo.mp4
The Problem
- Onboarding is painful: Jumping into a new codebase takes days of reading widely scattered files.
- Spaghetti Code is invisible: It’s hard to see how a change in utils.js breaks payment.py until it’s too late.
- Documentation rots: READMEs are rarely updated, but the code never lies.
The Solution Codebase Cartographer acts as an autonomous senior engineer. It:
- Scans your local folder (Python, JS, TS, Java).
- Maps the functions and their relationships.
- Explains what every function does using AI.
- Warns you about critical risks ("If you touch this, billing breaks").
- ⚡ Polyglot Support: Works with Python, JavaScript, TypeScript, and Java out of the box.
- 🤖 AI-Powered: Uses Google Gemini 2.5 Flash to summarize code logic in plain English.
- 🛡️ Risk Analysis: Automatically flags "Critical" functions (e.g., payment processing, auth).
- 🔌 Zero-Config CLI: No databases, no Docker. Just pip install and run.
- 🕸️ Interactive Graph: Built with React Flow to visualize complex dependencies easily.
Prerequisites
- Python 3.8+
- A Google Gemini API Key (Free Tier is fine)
- Clone the repo
git clone https://github.com/yourusername/codebase-cartographer.git
cd codebase-cartographer
- Install Dependencies
pip install -e .
- Setup API Key
Create a
.envfile in thebackendfolder:
# backend/.env
GEMINI_API_KEY="AIzaSyYourKeyHere..."
You can run the tool on the current folder, or point it at any other project on your computer.
Scan the current folder
python backend/cli.py .
Scan another project
python backend/cli.py "C:/Users/Dev/Projects/MyOtherApp"
The tool will automatically:
- Launch a local server.
- Open your browser to http://localhost:8000.
- Start analyzing files and rendering the map.
This is a Hybrid App that packages a modern React frontend inside a Python CLI.
- Frontend: React, React Flow, Dagre (Auto-layout).
- Backend: FastAPI, Uvicorn.
- AI Engine: Google Gemini 2.5 Flash (via google-generativeai).
- Parser: Custom "Unbreakable" Regex-based parser (No heavy dependencies like Tree-sitter).
Directory Structure
/backend
├── cli.py # Entry point (Typer CLI + FastAPI)
├── mapper.py # Core Logic (Regex Parsing + Gemini AI)
└── /dist # Compiled React Frontend (Static files)
/frontend
├── src/ # React Source Code
└── package.json
- Fork the repo.
- cd
frontendandnpm install. - Run
npm run devfor frontend development. - Run
python backend/cli.pyfor backend testing. - Submit a PR!
MIT