# rahulv-17/repolens-ai architecture

> Architecture diagram of the GitHub repository rahulv-17/repolens-ai, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-09-25). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/rahulv-17/repolens-ai
- Repository: https://github.com/rahulv-17/repolens-ai

## Overview

RepoLens AI imports GitHub repositories, analyzes their files and dependencies, persists repository insights, then presents them in a protected dashboard for exploration and repository-aware chat. The sampled controller shows the analysis orchestration and chat context flow; the README documents additional overview, health, and important-file capabilities. Authentication includes password, Google, profile, and email-reset flows. Some feature implementations were not sampled, so those are represented only at supported enclosing paths, and uncertain links are omitted.

Main entry points: [`backend/src/controllers/repoController.ts`](https://github.com/rahulv-17/repolens-ai/blob/main/backend/src/controllers/repoController.ts) (Repository controller), [`frontend/src/App.tsx`](https://github.com/rahulv-17/repolens-ai/blob/main/frontend/src/App.tsx) (App routing), [`frontend/src/pages/RepoAnalysis.tsx`](https://github.com/rahulv-17/repolens-ai/blob/main/frontend/src/pages/RepoAnalysis.tsx) (Analysis workspace), [`backend/src/routes/repoRoutes.ts`](https://github.com/rahulv-17/repolens-ai/blob/main/backend/src/routes/repoRoutes.ts) (Repository routes)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_experience["Developer experience"]
  node_app["App routing<br/>[App.tsx]"]
  node_dashboard["Dashboard<br/>[Dashboard.tsx]"]
  node_repoanalysis["Analysis workspace<br/>[RepoAnalysis.tsx]"]
  node_explorer["File explorer<br/>[FileExplorer.tsx]"]
  node_depview["Dependency graph"]
  node_search["Global search"]
  node_chatui["Repository chat UI<br/>[AiChat.tsx]"]
  node_authui["Auth pages"]
end

subgraph group_identity["Identity and access"]
  node_authroutes["Auth routes<br/>[authRoutes.ts]"]
  node_authcontroller["Auth controller<br/>[authController.ts]"]
  node_authguard["Auth middleware<br/>[authMiddleware.ts]"]
end

subgraph group_analysis["Repository analysis"]
  node_repoapi["Repository routes<br/>[repoRoutes.ts]"]
  node_repocontroller["Repository controller<br/>[repoController.ts]"]
  node_clone["Repository cloning<br/>[cloneService.ts]"]
  node_scanner["File scanning<br/>[scannerService.ts]"]
  node_parser["AST parsing<br/>[astParser.ts]"]
  node_graphgen["Graph generation<br/>[graphGenerator.ts]"]
end

subgraph group_insights["AI and exploration"]
  node_context["Context retrieval"]
  node_gemini["Gemini service<br/>[geminiService.ts]"]
end

subgraph group_data["Persistence and integrations"]
  node_server["API server<br/>[server.ts]"]
  node_users[("User records<br/>[User.ts]")]
  node_repositories[("Repository records<br/>[Repository.ts]")]
  node_chatrecords[("Chat history<br/>[ChatHistory.ts]")]
end

node_developer(("Developer"))
node_github(("GitHub repository"))
node_google(("Google identity"))
node_email(("Email service"))
node_geminiapi(("Gemini API"))

node_developer -->|"uses"| node_app
node_app -->|"routes to"| node_authui
node_app -->|"routes to"| node_dashboard
node_app -->|"routes to"| node_repoanalysis
node_dashboard -->|"requests repositories"| node_repoapi
node_repoanalysis -->|"requests analysis"| node_repoapi
node_repoanalysis -->|"presents files"| node_explorer
node_repoanalysis -->|"presents graph"| node_depview
node_repoanalysis -->|"presents chat"| node_chatui
node_app -->|"opens search"| node_search
node_authui -->|"submits credentials"| node_authroutes
node_server -->|"mounts routes"| node_authroutes
node_server -->|"mounts routes"| node_repoapi
node_authroutes -->|"dispatches"| node_authcontroller
node_repoapi -->|"protects routes"| node_authguard
node_repoapi -->|"dispatches"| node_repocontroller
node_authcontroller -->|"reads and writes"| node_users
node_authcontroller -.->|"sends reset email"| node_email
node_google -.->|"provides identity"| node_authcontroller
node_repocontroller -->|"clones repository"| node_clone
node_github -->|"provides source"| node_clone
node_repocontroller -->|"scans directory"| node_scanner
node_repocontroller -->|"parses files"| node_parser
node_repocontroller -->|"generates graph"| node_graphgen
node_repocontroller -->|"creates and queries"| node_repositories
node_repocontroller -->|"stores and reads chat"| node_chatrecords
node_repocontroller -->|"selects relevant context"| node_context
node_repocontroller -->|"requests streamed answer"| node_gemini
node_gemini -->|"calls model"| node_geminiapi

click node_app "https://github.com/rahulv-17/repolens-ai/blob/main/frontend/src/App.tsx"
click node_dashboard "https://github.com/rahulv-17/repolens-ai/blob/main/frontend/src/pages/Dashboard.tsx"
click node_repoanalysis "https://github.com/rahulv-17/repolens-ai/blob/main/frontend/src/pages/RepoAnalysis.tsx"
click node_explorer "https://github.com/rahulv-17/repolens-ai/blob/main/frontend/src/components/FileExplorer.tsx"
click node_depview "https://github.com/rahulv-17/repolens-ai/blob/main/frontend/src/components/DependencyGraph.tsx"
click node_search "https://github.com/rahulv-17/repolens-ai/blob/main/frontend/src/components/GlobalSearchModal.tsx"
click node_chatui "https://github.com/rahulv-17/repolens-ai/blob/main/frontend/src/components/AiChat.tsx"
click node_authui "https://github.com/rahulv-17/repolens-ai/tree/main/frontend/src/pages"
click node_authroutes "https://github.com/rahulv-17/repolens-ai/blob/main/backend/src/routes/authRoutes.ts"
click node_authcontroller "https://github.com/rahulv-17/repolens-ai/blob/main/backend/src/controllers/authController.ts"
click node_authguard "https://github.com/rahulv-17/repolens-ai/blob/main/backend/src/middleware/authMiddleware.ts"
click node_repoapi "https://github.com/rahulv-17/repolens-ai/blob/main/backend/src/routes/repoRoutes.ts"
click node_repocontroller "https://github.com/rahulv-17/repolens-ai/blob/main/backend/src/controllers/repoController.ts"
click node_clone "https://github.com/rahulv-17/repolens-ai/blob/main/backend/src/services/cloneService.ts"
click node_scanner "https://github.com/rahulv-17/repolens-ai/blob/main/backend/src/services/scannerService.ts"
click node_parser "https://github.com/rahulv-17/repolens-ai/blob/main/backend/src/parsers/astParser.ts"
click node_graphgen "https://github.com/rahulv-17/repolens-ai/blob/main/backend/src/graph/graphGenerator.ts"
click node_context "https://github.com/rahulv-17/repolens-ai/blob/main/backend/src/ai/contextRetriever.ts"
click node_gemini "https://github.com/rahulv-17/repolens-ai/blob/main/backend/src/ai/geminiService.ts"
click node_server "https://github.com/rahulv-17/repolens-ai/blob/main/backend/src/server.ts"
click node_users "https://github.com/rahulv-17/repolens-ai/blob/main/backend/src/models/User.ts"
click node_repositories "https://github.com/rahulv-17/repolens-ai/blob/main/backend/src/models/Repository.ts"
click node_chatrecords "https://github.com/rahulv-17/repolens-ai/blob/main/backend/src/models/ChatHistory.ts"

classDef toneNeutral fill:#f8fafc,stroke:#334155,stroke-width:1.5px,color:#0f172a
classDef toneBlue fill:#dbeafe,stroke:#2563eb,stroke-width:1.5px,color:#172554
classDef toneAmber fill:#fef3c7,stroke:#d97706,stroke-width:1.5px,color:#78350f
classDef toneMint fill:#dcfce7,stroke:#16a34a,stroke-width:1.5px,color:#14532d
classDef toneRose fill:#ffe4e6,stroke:#e11d48,stroke-width:1.5px,color:#881337
classDef toneIndigo fill:#e0e7ff,stroke:#4f46e5,stroke-width:1.5px,color:#312e81
classDef toneTeal fill:#ccfbf1,stroke:#0f766e,stroke-width:1.5px,color:#134e4a
class node_app,node_dashboard,node_repoanalysis,node_explorer,node_depview,node_search,node_chatui,node_authui toneBlue
class node_authroutes,node_authcontroller,node_authguard toneAmber
class node_repoapi,node_repocontroller,node_clone,node_scanner,node_parser,node_graphgen,node_geminiapi toneMint
class node_context,node_gemini toneRose
class node_server,node_users,node_repositories,node_chatrecords,node_developer,node_github,node_google,node_email toneIndigo
```

## Components

### Developer experience

- [App routing](https://github.com/rahulv-17/repolens-ai/blob/main/frontend/src/App.tsx): `frontend/src/App.tsx`
- [Dashboard](https://github.com/rahulv-17/repolens-ai/blob/main/frontend/src/pages/Dashboard.tsx): `frontend/src/pages/Dashboard.tsx`
- [Analysis workspace](https://github.com/rahulv-17/repolens-ai/blob/main/frontend/src/pages/RepoAnalysis.tsx): `frontend/src/pages/RepoAnalysis.tsx`
- [File explorer](https://github.com/rahulv-17/repolens-ai/blob/main/frontend/src/components/FileExplorer.tsx): `frontend/src/components/FileExplorer.tsx`
- [Dependency graph](https://github.com/rahulv-17/repolens-ai/blob/main/frontend/src/components/DependencyGraph.tsx): `frontend/src/components/DependencyGraph.tsx`
- [Global search](https://github.com/rahulv-17/repolens-ai/blob/main/frontend/src/components/GlobalSearchModal.tsx): `frontend/src/components/GlobalSearchModal.tsx`
- [Repository chat UI](https://github.com/rahulv-17/repolens-ai/blob/main/frontend/src/components/AiChat.tsx): `frontend/src/components/AiChat.tsx`
- [Auth pages](https://github.com/rahulv-17/repolens-ai/tree/main/frontend/src/pages): `frontend/src/pages`

### Identity and access

- [Auth routes](https://github.com/rahulv-17/repolens-ai/blob/main/backend/src/routes/authRoutes.ts): `backend/src/routes/authRoutes.ts`
- [Auth controller](https://github.com/rahulv-17/repolens-ai/blob/main/backend/src/controllers/authController.ts): `backend/src/controllers/authController.ts`
- [Auth middleware](https://github.com/rahulv-17/repolens-ai/blob/main/backend/src/middleware/authMiddleware.ts): `backend/src/middleware/authMiddleware.ts`

### Repository analysis

- [Repository routes](https://github.com/rahulv-17/repolens-ai/blob/main/backend/src/routes/repoRoutes.ts): `backend/src/routes/repoRoutes.ts`
- [Repository controller](https://github.com/rahulv-17/repolens-ai/blob/main/backend/src/controllers/repoController.ts): `backend/src/controllers/repoController.ts`
- [Repository cloning](https://github.com/rahulv-17/repolens-ai/blob/main/backend/src/services/cloneService.ts): `backend/src/services/cloneService.ts`
- [File scanning](https://github.com/rahulv-17/repolens-ai/blob/main/backend/src/services/scannerService.ts): `backend/src/services/scannerService.ts`
- [AST parsing](https://github.com/rahulv-17/repolens-ai/blob/main/backend/src/parsers/astParser.ts): `backend/src/parsers/astParser.ts`
- [Graph generation](https://github.com/rahulv-17/repolens-ai/blob/main/backend/src/graph/graphGenerator.ts): `backend/src/graph/graphGenerator.ts`

### AI and exploration

- [Context retrieval](https://github.com/rahulv-17/repolens-ai/blob/main/backend/src/ai/contextRetriever.ts): `backend/src/ai/contextRetriever.ts`
- [Gemini service](https://github.com/rahulv-17/repolens-ai/blob/main/backend/src/ai/geminiService.ts): `backend/src/ai/geminiService.ts`

### Persistence and integrations

- [API server](https://github.com/rahulv-17/repolens-ai/blob/main/backend/src/server.ts): `backend/src/server.ts`
- [User records](https://github.com/rahulv-17/repolens-ai/blob/main/backend/src/models/User.ts): `backend/src/models/User.ts`
- [Repository records](https://github.com/rahulv-17/repolens-ai/blob/main/backend/src/models/Repository.ts): `backend/src/models/Repository.ts`
- [Chat history](https://github.com/rahulv-17/repolens-ai/blob/main/backend/src/models/ChatHistory.ts): `backend/src/models/ChatHistory.ts`

### Other components

- **Developer**
- **GitHub repository**
- **Google identity**
- **Email service**
- **Gemini API**

## Connections

- Developer → App routing: uses
- App routing → Auth pages: routes to
- App routing → Dashboard: routes to
- App routing → Analysis workspace: routes to
- Dashboard → Repository routes: requests repositories
- Analysis workspace → Repository routes: requests analysis
- Analysis workspace → File explorer: presents files
- Analysis workspace → Dependency graph: presents graph
- Analysis workspace → Repository chat UI: presents chat
- App routing → Global search: opens search
- Auth pages → Auth routes: submits credentials
- API server → Auth routes: mounts routes
- API server → Repository routes: mounts routes
- Auth routes → Auth controller: dispatches
- Repository routes → Auth middleware: protects routes
- Repository routes → Repository controller: dispatches
- Auth controller → User records: reads and writes
- Auth controller → Email service: sends reset email
- Google identity → Auth controller: provides identity
- Repository controller → Repository cloning: clones repository
- GitHub repository → Repository cloning: provides source
- Repository controller → File scanning: scans directory
- Repository controller → AST parsing: parses files
- Repository controller → Graph generation: generates graph
- Repository controller → Repository records: creates and queries
- Repository controller → Chat history: stores and reads chat
- Repository controller → Context retrieval: selects relevant context
- Repository controller → Gemini service: requests streamed answer
- Gemini service → Gemini API: calls model
