# priyansh-tyagi/codemap architecture

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

- Interactive diagram: https://gitdiagram.com/priyansh-tyagi/codemap
- Repository: https://github.com/priyansh-tyagi/codemap

## Overview

CodeMap turns a local directory or public GitHub snapshot into a persisted dependency model, then serves graph, risk, cycle, and impact data to an interactive browser UI. The documented JS/TS and Python parsing/resolution pipelines merge into one graph; analysis and storage follow. The README documents CLI/CI checks, but those are delivery integrations rather than the central interactive product workflow. Some API, analysis, and home-page wiring is inferred only where the README or sampled callers document it; unsampled implementation details are not expanded.

Main entry points: [`backend/app/graph/builder.py`](https://github.com/priyansh-tyagi/codemap/blob/main/backend/app/graph/builder.py) (Dependency builder), [`frontend/src/pages/ProjectPage.jsx`](https://github.com/priyansh-tyagi/codemap/blob/main/frontend/src/pages/ProjectPage.jsx) (Project workspace), [`backend/app/api/projects.py`](https://github.com/priyansh-tyagi/codemap/blob/main/backend/app/api/projects.py) (Project API), [`frontend/src/services/api.js`](https://github.com/priyansh-tyagi/codemap/blob/main/frontend/src/services/api.js) (API client)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_entry["Inputs and API"]
  node_home["Analysis input<br/>[HomePage.jsx]"]
  node_api_app["FastAPI app<br/>[main.py]"]
  node_projects_api["Project API<br/>[projects.py]"]
  node_files_api["File API<br/>[files.py]"]
  node_graph_api["Graph API<br/>[graph.py]"]
end

subgraph group_analysis["Repository analysis"]
  node_github_fetch["GitHub snapshot<br/>[github_fetcher.py]"]
  node_scanner["Repository scanner<br/>[scanner.py]"]
  node_builder["Dependency builder<br/>[builder.py]"]
  node_js_bridge["JS parser bridge<br/>[parser_bridge.py]"]
  node_babel_parser["Babel parser<br/>[parse.js]"]
  node_js_classifier["Import classifier<br/>[classifier.py]"]
  node_js_resolver["JS resolver<br/>[resolver.py]"]
  node_python_parser["Python parser<br/>[python_parser.py]"]
  node_python_resolver["Python resolver<br/>[python_resolver.py]"]
  node_architecture["Architecture classifier<br/>[architecture.py]"]
end

subgraph group_insights["Graph insights"]
  node_graph_analysis["Analysis coordinator<br/>[analysis.py]"]
  node_cycles["Cycle detection<br/>[cycles.py]"]
  node_impact["Change impact<br/>[impact.py]"]
  node_metrics["Graph metrics<br/>[metrics.py]"]
  node_risk["Risk scoring<br/>[risk.py]"]
end

subgraph group_persistence["Project persistence"]
  node_store[("Project store<br/>[store.py]")]
end

subgraph group_interface["Interactive interface"]
  node_api_client["API client<br/>[api.js]"]
  node_project_page["Project workspace<br/>[ProjectPage.jsx]"]
  node_graph_view["Dependency graph<br/>[GraphView.jsx]"]
  node_filters["Graph filters<br/>[FilterPanel.jsx]"]
  node_file_tree["File tree<br/>[FileTree.jsx]"]
  node_details["File details<br/>[DetailsPanel.jsx]"]
  node_imports["Import details<br/>[ImportsPanel.jsx]"]
  node_impact_panel["Impact panel<br/>[ImpactPanel.jsx]"]
end

node_user(("Repository user"))
node_local_repo["Local repository"]
node_github["GitHub"]

node_user -->|"submits source"| node_home
node_local_repo -->|"provides path"| node_home
node_home -->|"requests analysis"| node_api_client
node_api_client -->|"REST request"| node_projects_api
node_api_app -->|"mounts router"| node_projects_api
node_api_app -->|"mounts router"| node_files_api
node_api_app -->|"mounts router"| node_graph_api
node_projects_api -.->|"fetches snapshot"| node_github_fetch
node_github_fetch -.->|"downloads archive"| node_github
node_projects_api -->|"builds graph"| node_builder
node_builder -->|"scans files"| node_scanner
node_builder -->|"parses JS/TS"| node_js_bridge
node_js_bridge -->|"runs subprocess"| node_babel_parser
node_builder -->|"parses Python"| node_python_parser
node_builder -->|"classifies imports"| node_js_classifier
node_builder -->|"resolves imports"| node_js_resolver
node_builder -->|"resolves imports"| node_python_resolver
node_builder -->|"classifies files"| node_architecture
node_projects_api -->|"saves project"| node_store
node_store -->|"analyzes graph"| node_graph_analysis
node_graph_analysis -->|"detects cycles"| node_cycles
node_graph_analysis -->|"computes impact"| node_impact
node_graph_analysis -->|"computes metrics"| node_metrics
node_graph_analysis -->|"scores risk"| node_risk
node_api_client -->|"loads project"| node_project_page
node_project_page -->|"requests graph"| node_api_client
node_api_client -->|"fetches project data"| node_projects_api
node_api_client -->|"requests insights"| node_graph_api
node_files_api -->|"reads project"| node_store
node_graph_api -->|"reads analysis"| node_store
node_projects_api -->|"reads project"| node_store
node_project_page -->|"renders graph"| node_graph_view
node_project_page -->|"sets filters"| node_filters
node_project_page -->|"shows files"| node_file_tree
node_project_page -->|"shows selection"| node_details
node_project_page -->|"shows dependencies"| node_imports
node_project_page -->|"shows impact"| node_impact_panel
node_filters -->|"narrows display"| node_graph_view

click node_home "https://github.com/priyansh-tyagi/codemap/blob/main/frontend/src/pages/HomePage.jsx"
click node_api_client "https://github.com/priyansh-tyagi/codemap/blob/main/frontend/src/services/api.js"
click node_api_app "https://github.com/priyansh-tyagi/codemap/blob/main/backend/app/main.py"
click node_projects_api "https://github.com/priyansh-tyagi/codemap/blob/main/backend/app/api/projects.py"
click node_files_api "https://github.com/priyansh-tyagi/codemap/blob/main/backend/app/api/files.py"
click node_graph_api "https://github.com/priyansh-tyagi/codemap/blob/main/backend/app/api/graph.py"
click node_github_fetch "https://github.com/priyansh-tyagi/codemap/blob/main/backend/app/analyzer/github_fetcher.py"
click node_scanner "https://github.com/priyansh-tyagi/codemap/blob/main/backend/app/analyzer/scanner.py"
click node_builder "https://github.com/priyansh-tyagi/codemap/blob/main/backend/app/graph/builder.py"
click node_js_bridge "https://github.com/priyansh-tyagi/codemap/blob/main/backend/app/analyzer/parser_bridge.py"
click node_babel_parser "https://github.com/priyansh-tyagi/codemap/blob/main/backend/parser/parse.js"
click node_js_classifier "https://github.com/priyansh-tyagi/codemap/blob/main/backend/app/analyzer/classifier.py"
click node_js_resolver "https://github.com/priyansh-tyagi/codemap/blob/main/backend/app/analyzer/resolver.py"
click node_python_parser "https://github.com/priyansh-tyagi/codemap/blob/main/backend/app/analyzer/python_parser.py"
click node_python_resolver "https://github.com/priyansh-tyagi/codemap/blob/main/backend/app/analyzer/python_resolver.py"
click node_architecture "https://github.com/priyansh-tyagi/codemap/blob/main/backend/app/analyzer/architecture.py"
click node_graph_analysis "https://github.com/priyansh-tyagi/codemap/blob/main/backend/app/graph/analysis.py"
click node_cycles "https://github.com/priyansh-tyagi/codemap/blob/main/backend/app/graph/cycles.py"
click node_impact "https://github.com/priyansh-tyagi/codemap/blob/main/backend/app/graph/impact.py"
click node_metrics "https://github.com/priyansh-tyagi/codemap/blob/main/backend/app/graph/metrics.py"
click node_risk "https://github.com/priyansh-tyagi/codemap/blob/main/backend/app/graph/risk.py"
click node_store "https://github.com/priyansh-tyagi/codemap/blob/main/backend/app/services/store.py"
click node_project_page "https://github.com/priyansh-tyagi/codemap/blob/main/frontend/src/pages/ProjectPage.jsx"
click node_graph_view "https://github.com/priyansh-tyagi/codemap/blob/main/frontend/src/components/GraphView.jsx"
click node_filters "https://github.com/priyansh-tyagi/codemap/blob/main/frontend/src/components/FilterPanel.jsx"
click node_file_tree "https://github.com/priyansh-tyagi/codemap/blob/main/frontend/src/components/FileTree.jsx"
click node_details "https://github.com/priyansh-tyagi/codemap/blob/main/frontend/src/components/DetailsPanel.jsx"
click node_imports "https://github.com/priyansh-tyagi/codemap/blob/main/frontend/src/components/ImportsPanel.jsx"
click node_impact_panel "https://github.com/priyansh-tyagi/codemap/blob/main/frontend/src/components/ImpactPanel.jsx"

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_home,node_api_app,node_projects_api,node_files_api,node_graph_api,node_user toneBlue
class node_github_fetch,node_scanner,node_builder,node_js_bridge,node_babel_parser,node_js_classifier,node_js_resolver,node_python_parser,node_python_resolver,node_architecture toneAmber
class node_graph_analysis,node_cycles,node_impact,node_metrics,node_risk toneMint
class node_store toneRose
class node_api_client,node_project_page,node_graph_view,node_filters,node_file_tree,node_details,node_imports,node_impact_panel,node_local_repo,node_github toneIndigo
```

## Components

### Inputs and API

- [Analysis input](https://github.com/priyansh-tyagi/codemap/blob/main/frontend/src/pages/HomePage.jsx): `frontend/src/pages/HomePage.jsx`
- [FastAPI app](https://github.com/priyansh-tyagi/codemap/blob/main/backend/app/main.py): `backend/app/main.py`
- [Project API](https://github.com/priyansh-tyagi/codemap/blob/main/backend/app/api/projects.py): `backend/app/api/projects.py`
- [File API](https://github.com/priyansh-tyagi/codemap/blob/main/backend/app/api/files.py): `backend/app/api/files.py`
- [Graph API](https://github.com/priyansh-tyagi/codemap/blob/main/backend/app/api/graph.py): `backend/app/api/graph.py`

### Repository analysis

- [GitHub snapshot](https://github.com/priyansh-tyagi/codemap/blob/main/backend/app/analyzer/github_fetcher.py): `backend/app/analyzer/github_fetcher.py`
- [Repository scanner](https://github.com/priyansh-tyagi/codemap/blob/main/backend/app/analyzer/scanner.py): `backend/app/analyzer/scanner.py`
- [Dependency builder](https://github.com/priyansh-tyagi/codemap/blob/main/backend/app/graph/builder.py): `backend/app/graph/builder.py`
- [JS parser bridge](https://github.com/priyansh-tyagi/codemap/blob/main/backend/app/analyzer/parser_bridge.py): `backend/app/analyzer/parser_bridge.py`
- [Babel parser](https://github.com/priyansh-tyagi/codemap/blob/main/backend/parser/parse.js): `backend/parser/parse.js`
- [Import classifier](https://github.com/priyansh-tyagi/codemap/blob/main/backend/app/analyzer/classifier.py): `backend/app/analyzer/classifier.py`
- [JS resolver](https://github.com/priyansh-tyagi/codemap/blob/main/backend/app/analyzer/resolver.py): `backend/app/analyzer/resolver.py`
- [Python parser](https://github.com/priyansh-tyagi/codemap/blob/main/backend/app/analyzer/python_parser.py): `backend/app/analyzer/python_parser.py`
- [Python resolver](https://github.com/priyansh-tyagi/codemap/blob/main/backend/app/analyzer/python_resolver.py): `backend/app/analyzer/python_resolver.py`
- [Architecture classifier](https://github.com/priyansh-tyagi/codemap/blob/main/backend/app/analyzer/architecture.py): `backend/app/analyzer/architecture.py`

### Graph insights

- [Analysis coordinator](https://github.com/priyansh-tyagi/codemap/blob/main/backend/app/graph/analysis.py): `backend/app/graph/analysis.py`
- [Cycle detection](https://github.com/priyansh-tyagi/codemap/blob/main/backend/app/graph/cycles.py): `backend/app/graph/cycles.py`
- [Change impact](https://github.com/priyansh-tyagi/codemap/blob/main/backend/app/graph/impact.py): `backend/app/graph/impact.py`
- [Graph metrics](https://github.com/priyansh-tyagi/codemap/blob/main/backend/app/graph/metrics.py): `backend/app/graph/metrics.py`
- [Risk scoring](https://github.com/priyansh-tyagi/codemap/blob/main/backend/app/graph/risk.py): `backend/app/graph/risk.py`

### Project persistence

- [Project store](https://github.com/priyansh-tyagi/codemap/blob/main/backend/app/services/store.py): `backend/app/services/store.py`

### Interactive interface

- [API client](https://github.com/priyansh-tyagi/codemap/blob/main/frontend/src/services/api.js): `frontend/src/services/api.js`
- [Project workspace](https://github.com/priyansh-tyagi/codemap/blob/main/frontend/src/pages/ProjectPage.jsx): `frontend/src/pages/ProjectPage.jsx`
- [Dependency graph](https://github.com/priyansh-tyagi/codemap/blob/main/frontend/src/components/GraphView.jsx): `frontend/src/components/GraphView.jsx`
- [Graph filters](https://github.com/priyansh-tyagi/codemap/blob/main/frontend/src/components/FilterPanel.jsx): `frontend/src/components/FilterPanel.jsx`
- [File tree](https://github.com/priyansh-tyagi/codemap/blob/main/frontend/src/components/FileTree.jsx): `frontend/src/components/FileTree.jsx`
- [File details](https://github.com/priyansh-tyagi/codemap/blob/main/frontend/src/components/DetailsPanel.jsx): `frontend/src/components/DetailsPanel.jsx`
- [Import details](https://github.com/priyansh-tyagi/codemap/blob/main/frontend/src/components/ImportsPanel.jsx): `frontend/src/components/ImportsPanel.jsx`
- [Impact panel](https://github.com/priyansh-tyagi/codemap/blob/main/frontend/src/components/ImpactPanel.jsx): `frontend/src/components/ImpactPanel.jsx`

### Other components

- **Repository user**
- **Local repository**
- **GitHub**

## Connections

- Repository user → Analysis input: submits source
- Local repository → Analysis input: provides path
- Analysis input → API client: requests analysis
- API client → Project API: REST request
- FastAPI app → Project API: mounts router
- FastAPI app → File API: mounts router
- FastAPI app → Graph API: mounts router
- Project API → GitHub snapshot: fetches snapshot
- GitHub snapshot → GitHub: downloads archive
- Project API → Dependency builder: builds graph
- Dependency builder → Repository scanner: scans files
- Dependency builder → JS parser bridge: parses JS/TS
- JS parser bridge → Babel parser: runs subprocess
- Dependency builder → Python parser: parses Python
- Dependency builder → Import classifier: classifies imports
- Dependency builder → JS resolver: resolves imports
- Dependency builder → Python resolver: resolves imports
- Dependency builder → Architecture classifier: classifies files
- Project API → Project store: saves project
- Project store → Analysis coordinator: analyzes graph
- Analysis coordinator → Cycle detection: detects cycles
- Analysis coordinator → Change impact: computes impact
- Analysis coordinator → Graph metrics: computes metrics
- Analysis coordinator → Risk scoring: scores risk
- API client → Project workspace: loads project
- Project workspace → API client: requests graph
- API client → Project API: fetches project data
- API client → Graph API: requests insights
- File API → Project store: reads project
- Graph API → Project store: reads analysis
- Project API → Project store: reads project
- Project workspace → Dependency graph: renders graph
- Project workspace → Graph filters: sets filters
- Project workspace → File tree: shows files
- Project workspace → File details: shows selection
- Project workspace → Import details: shows dependencies
- Project workspace → Impact panel: shows impact
- Graph filters → Dependency graph: narrows display
