RepoFlow is a developer-intelligence tool designed to demystify complex codebases. It statically parses local repositories, extracts file-import relationships, calculates complexity metrics, and visualizes them on an infinite, interactive 2D canvas. It also integrates with Google Gemini AI to provide instant, plain-English explanations of any file, with local caching to keep API usage cost-free.
- Infinite Workspace: Pan, zoom, and physically drag files and folders around.
- Directory Nesting (Sub-flows): Folders render as container frames containing their respective files to preserve physical codebase hierarchy.
- Custom Code Cards: Custom node cards styled per programming language (Python, JavaScript, TypeScript, C/C++, HTML, CSS) with built-in Lines of Code (LoC) size indicators.
- Animated Edges: Import lines show direction (arrows) with neon flowing particles showing dependency direction.
- Hover Highlighting: Hovering over a file card highlights its entire import path (all dependencies and files importing it) while fading out everything else.
- Lines of Code (LoC) Tracker: Calculates total lines, empty lines, and comment lines.
- Complexity Heuristic: Scans code files for branching structures (
if,for,while,catch) to estimate cyclomatic complexity. - Function Counts: Counts defined functions per file dynamically.
- Hotspot Detector: The bottom stats bar flags files exceeding 200 lines of code or having high complexity, helping you spot refactoring candidates.
- Interactive Explanations: Click a file, open the sidebar, and watch Gemini generate a 3-sentence summary of what the code does, typed out with a typewriter animation.
- SQLite Cache Database: Calculates the MD5 hash of the file content. If it matches a cached record, the summary is fetched from
cache.dbinstantly with zero API costs.
- Auto-Image Saving: Click "Export Image" to download a PNG of the canvas in the browser and automatically write a copy (
repo-flow-graph.png) directly inside the codebase folder you scanned!
| Layer | Technology | Key Libraries |
|---|---|---|
| Frontend | React + Vite + TypeScript | @xyflow/react (React Flow), @dagrejs/dagre, lucide-react, html-to-image |
| Backend | Python 3.10+ + FastAPI | uvicorn, pydantic, google-genai SDK, python-dotenv |
| Database | SQLite | Python Standard sqlite3 driver |
| Styling | Vanilla CSS | Custom dark glassmorphism styling system |
repository-visualizer/
├── README.md # Project Documentation
├── backend/ # Python FastAPI Backend
│ ├── app/
│ │ ├── main.py # FastAPI server endpoints
│ │ ├── parser.py # Traversal & static import parser
│ │ ├── database.py # SQLite database configuration
│ │ └── ai_service.py # Gemini SDK & caching logic
│ ├── .env.template # Template for environment variables
│ ├── .env # local secrets (API Key)
│ ├── inspect_db.py # Utility script to view SQLite cache
│ ├── requirements.txt # Python backend packages
│ └── run.py # Server startup script
└── frontend/ # React Frontend (Vite)
├── package.json # Node dependencies
├── vite.config.ts # Vite config
├── index.html
└── src/
├── main.tsx
├── App.tsx # Dashboard UI and React Flow canvas
├── index.css # Styling system & Glassmorphic variables
├── components/
│ ├── CustomNode.tsx # Files and folders node renders
│ ├── Sidebar.tsx # Slide drawer, code preview, AI panel
│ └── DashboardStats.tsx # Repository summary panels
└── utils/
└── layout.ts # Dagre auto-layout logic
To run the project locally, open two terminal windows in VS Code:
- Navigate to the backend directory:
cd backend - Create and activate a Python virtual environment:
python -m venv .venv Windows PowerShell: .venv\Scripts\activate Mac/Linux: source .venv/bin/activate
- Install dependencies:
pip install -r requirements.txt
- Configure your API key:
- Create an
.envfile and enter your key from Google AI Studio:GEMINI_API_KEY=your_gemini_api_key_here
- Create an
- Start the FastAPI server:
The backend will run on
python run.py
http://127.0.0.1:8000(Docs available at/docs).
- Open a second terminal window and navigate to the frontend:
cd frontend - Install npm packages:
npm install
- Start the Vite development server:
npm run dev
- Open your browser and navigate to:
http://localhost:5173/
- Paste the absolute path of a local project directory into the top search input bar (e.g.
C:/Users/chaks/Desktop/repository-visualizer/backend). - Click Scan Repository to fetch the graph structure.
- Click Horizontal Layout or Vertical Layout in the header to tidy up the canvas.
- Hover over node files to highlight import paths.
- Click a node to view its lines of code, code preview, and get a Gemini AI summary.
- Click Export Image to download a PNG layout of your codebase mapping.