How vasu-devs/mapmyrepo works
Project type and purpose
• MapMyRepo is a client-side, single-page React application (built with Vite and TypeScript) whose purpose is to ingest a local filesystem or GitHub repository, parse its structure, and render it as an interactive, AI-enhanced, force-directed node graph using D3.js.
• It has no bespoke backend; all interactions happen in the browser via two external services: the GitHub REST API and Google Gemini AI.
File structure
• Top-level files:
• index.html, index.tsx, App.tsx: React entry point and main layout
• vite.config.ts, tsconfig.json: build/tooling configuration
• package.json: dependencies (React, D3, Tailwind, Google Gemini)
• Directories:
• components/: UI modules (FileUploader, RepoVisualizer, Sidebar, SearchBar)
• services/: business-logic modules handling external calls (fileService, geminiService)
• public/: static assets (favicon, etc.)
• scripts/: local test scripts (used during development)
• There is no “backend” folder; the browser app directly calls external APIs.
README for additional insights
• Confirms tech stack: React 19, TypeScript, Vite, D3.js, Tailwind CSS, Google Gemini AI, Marked.js.
• Describes core features: interactive graph, AI-powered summaries & Q&A, local/GitHub import.
• Mentions environment variables (VITE_GEMINI_API_KEY, optional VITE_GITHUB_TOKEN) injected at build time.
a. Main components
• User’s Browser (host of the SPA)
• UI Layer (React components)
– FileUploader
– RepoVisualizer (D3 force-directed graph)
– Sidebar (AI chat & metadata panel)
• Service Layer
– fileService.ts ( local FileReader + GitHub REST API )
– geminiService.ts ( Google Gemini AI REST API )
• External Services
– GitHub API (for repository fetch)
– Google Gemini AI (for summaries and Q&A)
b. Relationships & interactions
1. User → FileUploader: drags/drops or submits GitHub URL
2. FileUploader → fileService
– If local: FileReader parses folder tree
– If GitHub: fetch tree, filter artifacts
3. fileService → returns tree data to React state
4. RepoVisualizer consumes tree data → D3 renders nodes/links
5. User selects a node → Sidebar triggers geminiService
6. geminiService sends file/folder content to Google Gemini → returns summary/Q&A
7. Sidebar displays AI response
c. Architectural patterns & design principles
– Single responsibility: UI vs. data-fetch services are in separate folders
– Unidirectional data flow: React state → props → child components
– Modular “services” for external-API abstraction
– Static hosting for client-only SPA (Vite build → dist)
d. Relevant technologies
– React + TSX components (blue rectangles)
– D3.js force-directed graph (green module)
– Tailwind CSS styling
– Vite as build/development server
– External REST calls: fetch/XHR to GitHub & Gemini