# tarun-1009/codebase-cipher architecture

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

- Interactive diagram: https://gitdiagram.com/tarun-1009/codebase-cipher
- Repository: https://github.com/tarun-1009/codebase-cipher

## Overview

Codebase Cipher accepts a GitHub repository and branch, analyzes its structure and code relationships, and presents interactive results for exploration and export. The documented analysis stages include language detection, function and endpoint extraction, dependency construction, and traceability; the backend also offers AI summaries at file, folder, and repository levels, with persistent summary runs. The README describes broader parser and GitHub capabilities; several internal links below reflect those documented responsibilities, while unsampled implementation details are not expanded.

Main entry points: [`frontend/src/pages/analyze.jsx`](https://github.com/tarun-1009/codebase-cipher/blob/main/frontend/src/pages/analyze.jsx) (Analyze Page), [`backend/src/utils/buildDependencyTree.js`](https://github.com/tarun-1009/codebase-cipher/blob/main/backend/src/utils/buildDependencyTree.js) (Dependency Builder), [`backend/server.js`](https://github.com/tarun-1009/codebase-cipher/blob/main/backend/server.js) (Backend API), [`backend/src/services/bottomUpSummary.js`](https://github.com/tarun-1009/codebase-cipher/blob/main/backend/src/services/bottomUpSummary.js) (Summary Runs)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_client["Repository Analysis UI"]
  node_analyze_page["Analyze Page<br/>[analyze.jsx]"]
end

subgraph group_analysis["Code Analysis"]
  node_backend_api["Backend API<br/>[server.js]"]
  node_tree_builder["Dependency Builder"]
  node_language_detect["Language Detection"]
  node_import_detect["Import Detection<br/>[importDetector.js]"]
  node_function_parse["Function Parsing<br/>[functionParser.js]"]
  node_endpoint_parse["Endpoint Parsing<br/>[endpointParser.js]"]
  node_trace_engine["Traceability Engine"]
end

subgraph group_summaries["AI Summaries"]
  node_summary_service["Summary Service<br/>[summarise.js]"]
  node_bottom_up["Summary Runs<br/>[bottomUpSummary.js]"]
  node_summary_db[("PostgreSQL<br/>[schema.prisma]")]
end

subgraph group_results["Analysis Results"]
  node_tree_view["Repository Tree<br/>[Tree.jsx]"]
  node_dependency_view["Dependency Graph"]
  node_trace_view["Traceability Graph"]
  node_api_catalog["API Catalog<br/>[ApiCatalog.jsx]"]
  node_file_explorer["File Explorer<br/>[FileExplorer.jsx]"]
  node_summary_view["Summary View<br/>[Summary.jsx]"]
  node_pdf_report["PDF Report"]
end

node_developer(("Developer"))
node_github(("GitHub"))
node_groq(("Groq API"))

node_developer -->|"submits repository"| node_analyze_page
node_analyze_page -->|"requests analysis"| node_backend_api
node_backend_api -->|"builds analysis"| node_tree_builder
node_tree_builder -->|"fetches repository"| node_github
node_tree_builder -->|"detects languages"| node_language_detect
node_tree_builder -->|"detects imports"| node_import_detect
node_tree_builder -->|"extracts functions"| node_function_parse
node_tree_builder -->|"extracts endpoints"| node_endpoint_parse
node_tree_builder -->|"builds traceability"| node_trace_engine
node_backend_api -->|"generates summaries"| node_summary_service
node_backend_api -->|"builds summary runs"| node_bottom_up
node_bottom_up -->|"generates levels"| node_summary_service
node_summary_service -->|"requests summaries"| node_groq
node_bottom_up -->|"persists summaries"| node_summary_db
node_bottom_up -->|"loads summary runs"| node_summary_db
node_analyze_page -->|"renders tree"| node_tree_view
node_analyze_page -->|"renders dependencies"| node_dependency_view
node_analyze_page -->|"renders traceability"| node_trace_view
node_analyze_page -->|"renders endpoints"| node_api_catalog
node_analyze_page -->|"renders files"| node_file_explorer
node_analyze_page -->|"shows summaries"| node_summary_view
node_analyze_page -->|"exports report"| node_pdf_report
node_summary_view -->|"requests summaries"| node_backend_api

click node_analyze_page "https://github.com/tarun-1009/codebase-cipher/blob/main/frontend/src/pages/analyze.jsx"
click node_backend_api "https://github.com/tarun-1009/codebase-cipher/blob/main/backend/server.js"
click node_tree_builder "https://github.com/tarun-1009/codebase-cipher/blob/main/backend/src/utils/buildDependencyTree.js"
click node_language_detect "https://github.com/tarun-1009/codebase-cipher/blob/main/backend/src/parsers/languageDetector.js"
click node_import_detect "https://github.com/tarun-1009/codebase-cipher/blob/main/backend/src/parsers/importDetector.js"
click node_function_parse "https://github.com/tarun-1009/codebase-cipher/blob/main/backend/src/parsers/functionParser.js"
click node_endpoint_parse "https://github.com/tarun-1009/codebase-cipher/blob/main/backend/src/parsers/endpointParser.js"
click node_trace_engine "https://github.com/tarun-1009/codebase-cipher/blob/main/backend/src/engines/traceabilityEngine.js"
click node_summary_service "https://github.com/tarun-1009/codebase-cipher/blob/main/backend/src/services/summarise.js"
click node_bottom_up "https://github.com/tarun-1009/codebase-cipher/blob/main/backend/src/services/bottomUpSummary.js"
click node_summary_db "https://github.com/tarun-1009/codebase-cipher/blob/main/backend/prisma/schema.prisma"
click node_tree_view "https://github.com/tarun-1009/codebase-cipher/blob/main/frontend/src/components/Canvas/Tree.jsx"
click node_dependency_view "https://github.com/tarun-1009/codebase-cipher/blob/main/frontend/src/components/Canvas/DependencyGraph.jsx"
click node_trace_view "https://github.com/tarun-1009/codebase-cipher/blob/main/frontend/src/components/Canvas/TraceabilityGraph.jsx"
click node_api_catalog "https://github.com/tarun-1009/codebase-cipher/blob/main/frontend/src/components/ApiCatalog/ApiCatalog.jsx"
click node_file_explorer "https://github.com/tarun-1009/codebase-cipher/blob/main/frontend/src/components/Sidebar/FileExplorer.jsx"
click node_summary_view "https://github.com/tarun-1009/codebase-cipher/blob/main/frontend/src/components/Summary/Summary.jsx"
click node_pdf_report "https://github.com/tarun-1009/codebase-cipher/blob/main/frontend/src/utils/generatePdfReport.js"

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_analyze_page toneBlue
class node_backend_api,node_tree_builder,node_language_detect,node_import_detect,node_function_parse,node_endpoint_parse,node_trace_engine toneAmber
class node_summary_service,node_bottom_up,node_summary_db,node_groq toneMint
class node_tree_view,node_dependency_view,node_trace_view,node_api_catalog,node_file_explorer,node_summary_view,node_pdf_report toneRose
class node_developer,node_github toneIndigo
```

## Components

### Repository Analysis UI

- [Analyze Page](https://github.com/tarun-1009/codebase-cipher/blob/main/frontend/src/pages/analyze.jsx): `frontend/src/pages/analyze.jsx`

### Code Analysis

- [Backend API](https://github.com/tarun-1009/codebase-cipher/blob/main/backend/server.js): `backend/server.js`
- [Dependency Builder](https://github.com/tarun-1009/codebase-cipher/blob/main/backend/src/utils/buildDependencyTree.js): `backend/src/utils/buildDependencyTree.js`
- [Language Detection](https://github.com/tarun-1009/codebase-cipher/blob/main/backend/src/parsers/languageDetector.js): `backend/src/parsers/languageDetector.js`
- [Import Detection](https://github.com/tarun-1009/codebase-cipher/blob/main/backend/src/parsers/importDetector.js): `backend/src/parsers/importDetector.js`
- [Function Parsing](https://github.com/tarun-1009/codebase-cipher/blob/main/backend/src/parsers/functionParser.js): `backend/src/parsers/functionParser.js`
- [Endpoint Parsing](https://github.com/tarun-1009/codebase-cipher/blob/main/backend/src/parsers/endpointParser.js): `backend/src/parsers/endpointParser.js`
- [Traceability Engine](https://github.com/tarun-1009/codebase-cipher/blob/main/backend/src/engines/traceabilityEngine.js): `backend/src/engines/traceabilityEngine.js`

### AI Summaries

- [Summary Service](https://github.com/tarun-1009/codebase-cipher/blob/main/backend/src/services/summarise.js): `backend/src/services/summarise.js`
- [Summary Runs](https://github.com/tarun-1009/codebase-cipher/blob/main/backend/src/services/bottomUpSummary.js): `backend/src/services/bottomUpSummary.js`
- [PostgreSQL](https://github.com/tarun-1009/codebase-cipher/blob/main/backend/prisma/schema.prisma): `backend/prisma/schema.prisma`

### Analysis Results

- [Repository Tree](https://github.com/tarun-1009/codebase-cipher/blob/main/frontend/src/components/Canvas/Tree.jsx): `frontend/src/components/Canvas/Tree.jsx`
- [Dependency Graph](https://github.com/tarun-1009/codebase-cipher/blob/main/frontend/src/components/Canvas/DependencyGraph.jsx): `frontend/src/components/Canvas/DependencyGraph.jsx`
- [Traceability Graph](https://github.com/tarun-1009/codebase-cipher/blob/main/frontend/src/components/Canvas/TraceabilityGraph.jsx): `frontend/src/components/Canvas/TraceabilityGraph.jsx`
- [API Catalog](https://github.com/tarun-1009/codebase-cipher/blob/main/frontend/src/components/ApiCatalog/ApiCatalog.jsx): `frontend/src/components/ApiCatalog/ApiCatalog.jsx`
- [File Explorer](https://github.com/tarun-1009/codebase-cipher/blob/main/frontend/src/components/Sidebar/FileExplorer.jsx): `frontend/src/components/Sidebar/FileExplorer.jsx`
- [Summary View](https://github.com/tarun-1009/codebase-cipher/blob/main/frontend/src/components/Summary/Summary.jsx): `frontend/src/components/Summary/Summary.jsx`
- [PDF Report](https://github.com/tarun-1009/codebase-cipher/blob/main/frontend/src/utils/generatePdfReport.js): `frontend/src/utils/generatePdfReport.js`

### Other components

- **Developer**
- **GitHub**
- **Groq API**

## Connections

- Developer → Analyze Page: submits repository
- Analyze Page → Backend API: requests analysis
- Backend API → Dependency Builder: builds analysis
- Dependency Builder → GitHub: fetches repository
- Dependency Builder → Language Detection: detects languages
- Dependency Builder → Import Detection: detects imports
- Dependency Builder → Function Parsing: extracts functions
- Dependency Builder → Endpoint Parsing: extracts endpoints
- Dependency Builder → Traceability Engine: builds traceability
- Backend API → Summary Service: generates summaries
- Backend API → Summary Runs: builds summary runs
- Summary Runs → Summary Service: generates levels
- Summary Service → Groq API: requests summaries
- Summary Runs → PostgreSQL: persists summaries
- Summary Runs → PostgreSQL: loads summary runs
- Analyze Page → Repository Tree: renders tree
- Analyze Page → Dependency Graph: renders dependencies
- Analyze Page → Traceability Graph: renders traceability
- Analyze Page → API Catalog: renders endpoints
- Analyze Page → File Explorer: renders files
- Analyze Page → Summary View: shows summaries
- Analyze Page → PDF Report: exports report
- Summary View → Backend API: requests summaries
