Skip to content

vasu-devs/MapMyRepo

Repository files navigation

πŸ—ΊοΈ MapMyRepo

Transform Your Codebase into an Interactive Knowledge Graph

React TypeScript Vite D3.js Google Gemini

License PRs Welcome

MapMyRepo is a powerful AI-powered visualization tool that transforms any GitHub repository or local codebase into an interactive, navigable node graph. Perfect for understanding complex architectures, onboarding new developers, or exploring unfamiliar codebases.

Features β€’ Demo β€’ Installation β€’ Usage β€’ Tech Stack


✨ Features

🎨 Interactive Graph Visualization

  • Force-Directed Layout: Files and folders represented as interconnected nodes using D3.js
  • Smooth Navigation: Zoom, pan, and drag nodes to explore your codebase intuitively
  • Visual Hierarchy: Distinct icons and colors for folders, files, and different file types
  • Node Expansion: Double-click folders to expand/collapse their contents dynamically

πŸ€– AI-Powered Intelligence (Google Gemini)

  • Smart Summaries: Automatically generates architectural overviews for folders and files
  • Code Analysis: Explains the purpose, exports, and key functionality of individual files
  • Contextual Q&A: Ask questions about your codebase and get intelligent, context-aware answers
  • Real-time Insights: Chat interface integrated directly into the node selection panel

πŸ“₯ Flexible Import Options

  • Local Upload: Drag and drop folders directly from your file system
  • GitHub Integration: Paste any public GitHub repository URL to visualize instantly
  • Smart Parsing: Automatically filters out node_modules, .git, and other build artifacts

πŸŒ— Modern UI/UX

  • Dark/Light Mode: Fully themed interface that adapts to your preference
  • Glassmorphism Design: Sleek, modern sidebar with backdrop blur effects
  • Responsive Layout: Works seamlessly on desktop and tablet devices
  • Animated Backgrounds: Dynamic particle effects and grid animations

🎬 Demo

Visualize in MapMyRepo

Try visualizing any public repository:

https://github.com/facebook/react
https://github.com/microsoft/vscode
https://github.com/vercel/next.js

πŸš€ Installation

Prerequisites

Before you begin, ensure you have the following installed:

Step 1: Clone the Repository

git clone https://github.com/vasu-devs/MapMyRepo.git
cd MapMyRepo

Step 2: Install Dependencies

Using npm:

npm install

Or using yarn:

yarn install

Step 3: Configure Environment Variables

Create a .env.local file in the root directory:

# For Windows
copy .env.example .env.local

# For macOS/Linux
cp .env.example .env.local

Then add your API keys to .env.local:

# Google Gemini AI API Key (Required)
VITE_GEMINI_API_KEY=your_gemini_api_key_here

# GitHub Personal Access Token (Optional - for private repos and higher rate limits)
VITE_GITHUB_TOKEN=your_github_token_here

πŸ”‘ Getting Your API Keys:

Step 4: Run the Development Server

npm run dev

The application will start at http://localhost:5173 (Vite's default port).

Step 5: Build for Production (Optional)

npm run build

The optimized build will be created in the dist folder.

To preview the production build locally:

npm run preview

πŸ“– Usage Guide

1️⃣ Visualize a Repository

Option A: Upload a Local Folder

  1. Click the upload zone or drag and drop a folder from your file system
  2. MapMyRepo will parse the directory structure (excludes node_modules, .git, etc.)
  3. The graph will render automatically

Option B: Load from GitHub

  1. Paste a full GitHub repository URL into the input field:
    https://github.com/username/repository
    
  2. Press Enter or click the arrow button
  3. The repository will be fetched and visualized

2️⃣ Navigate the Graph

Action Effect
Scroll Zoom in/out
Click + Drag Pan across the canvas
Click Node Select node and open sidebar
Double-Click Folder Expand/collapse folder contents
Hover Node Highlight connected nodes

3️⃣ Explore with AI

Once you select a node:

  • Details Tab: View file/folder metadata and AI-generated architectural summary
  • Discussion Tab: Ask questions like:
    • "What does this file do?"
    • "Where is authentication handled?"
    • "Explain the routing structure"
    • "What are the main exports of this module?"

4️⃣ Switch Themes

Click the theme toggle button (β˜€οΈ/πŸŒ™) in the top-right corner to switch between light and dark modes.


πŸ› οΈ Tech Stack

Technology Purpose
React 19 UI framework with modern hooks
TypeScript Type-safe JavaScript
Vite Lightning-fast build tool
D3.js Force-directed graph visualization
Tailwind CSS Utility-first styling
Google Gemini AI Code analysis and Q&A
Marked Markdown rendering for AI responses
JetBrains Mono Developer-friendly monospace font

πŸ“‚ Project Structure

MapMyRepo/
β”œβ”€β”€ components/
β”‚   β”œβ”€β”€ FileUploader.tsx       # Landing page & upload logic
β”‚   β”œβ”€β”€ RepoVisualizer.tsx     # D3.js graph visualization
β”‚   β”œβ”€β”€ Sidebar.tsx            # Node details & AI chat panel
β”‚   └── SearchBar.tsx          # (Future) Search functionality
β”œβ”€β”€ services/
β”‚   β”œβ”€β”€ fileService.ts         # File parsing & GitHub API integration
β”‚   └── geminiService.ts       # Google Gemini AI integration
β”œβ”€β”€ public/
β”‚   β”œβ”€β”€ favicon.svg            # App favicon
β”‚   └── ...
β”œβ”€β”€ App.tsx                    # Main application layout
β”œβ”€β”€ index.tsx                  # React entry point
β”œβ”€β”€ types.ts                   # TypeScript type definitions
β”œβ”€β”€ vite.config.ts             # Vite configuration
β”œβ”€β”€ tsconfig.json              # TypeScript configuration
└── package.json               # Project dependencies

πŸ”§ Configuration

Vite Configuration

The project uses Vite with React plugin. Key configurations in vite.config.ts:

import { defineConfig } from 'vite'
import react from '@vitejs/plugin-react'

export default defineConfig({
  plugins: [react()],
  server: {
    port: 5173,
  },
  build: {
    outDir: 'dist',
  },
})

GitHub API Configuration

For private repositories or to avoid rate limits, configure a GitHub Personal Access Token:

  1. Generate a token at github.com/settings/tokens
  2. Select repo scope for private repositories
  3. Add to .env.local: VITE_GITHUB_TOKEN=your_token_here

🀝 Contributing

Contributions are welcome! Here's how you can help:

How to Contribute

  1. Fork the repository
  2. Clone your fork:
    git clone https://github.com/YOUR_USERNAME/MapMyRepo.git
  3. Create a branch:
    git checkout -b feature/amazing-feature
  4. Make your changes and commit:
    git commit -m "Add amazing feature"
  5. Push to your fork:
    git push origin feature/amazing-feature
  6. Open a Pull Request

Development Guidelines

  • Follow the existing code style (TypeScript, React Hooks)
  • Add TypeScript types for all new code
  • Test your changes thoroughly
  • Update documentation as needed

πŸ“ License

This project is licensed under the MIT License - see the LICENSE file for details.


πŸ™ Acknowledgments

  • Google Gemini AI for powerful code analysis capabilities
  • D3.js community for excellent graph visualization tools
  • React and Vite teams for modern web development tools

πŸ‘€ Author

Vasudev Siddharth


πŸ› Troubleshooting

Graph doesn't render
  • Ensure your repository has valid file structure
  • Check browser console for errors
  • Try clearing browser cache and reloading
AI features not working
  • Verify VITE_GEMINI_API_KEY is correctly set in .env.local
  • Check that the API key is valid at Google AI Studio
  • Ensure you have an active internet connection
GitHub repository fetch fails
  • Ensure the repository URL is correct and public
  • For private repos, add VITE_GITHUB_TOKEN to .env.local
  • Check if you've hit GitHub API rate limits (60 requests/hour without token)
Application won't start
  • Delete node_modules and reinstall: rm -rf node_modules && npm install
  • Ensure you're using Node.js v18 or higher: node --version
  • Check for port conflicts on 5173

πŸ“Š Roadmap

  • Add search functionality to find specific files/folders
  • Export graph as image (PNG/SVG)
  • Support for private GitHub repositories
  • Dependency graph visualization for imports/exports
  • Code metrics and statistics dashboard
  • Multi-repository comparison view
  • VSCode extension integration

πŸ’– Support

If you find MapMyRepo useful, please consider:

  • ⭐ Starring this repository
  • 🐦 Sharing on Twitter/X
  • πŸ› Reporting bugs and issues
  • πŸ’‘ Suggesting new features

⬆ Back to Top

Made with ❀️ and β˜• by Vasu-Devs

About

Turn any GitHub profile or repo into an AI-powered Code Universe . Languages become planets, repos become moons, and your code forms an interactive knowledge graph. Built with React, D3.js, and Gemini.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors