# aryanpandya0/replexity architecture

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

- Interactive diagram: https://gitdiagram.com/aryanpandya0/replexity
- Repository: https://github.com/aryanpandya0/replexity

## Overview

Replexity accepts a repository or local/ZIP source, analyzes supported files, and presents project health, file risks, dependencies, and refactoring guidance; users can also compare and export results. The backend separates source acquisition, analysis orchestration, specialized detectors, API/persistence, and the React experience. The README documents several capabilities whose individual implementations were not sampled; those are represented without asserting unverified internal calls. Edges reflect excerpts, SOURCE INDEX references, or README statements.

Main entry points: [`backend/api/pipeline.py`](https://github.com/aryanpandya0/replexity/blob/main/backend/api/pipeline.py) (Analysis pipeline), [`backend/api/analyze.py`](https://github.com/aryanpandya0/replexity/blob/main/backend/api/analyze.py) (Analysis API), [`frontend/src/pages/DashboardPage.tsx`](https://github.com/aryanpandya0/replexity/blob/main/frontend/src/pages/DashboardPage.tsx) (Analysis dashboard), [`frontend/src/api.ts`](https://github.com/aryanpandya0/replexity/blob/main/frontend/src/api.ts) (API client)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_acquisition["Source intake"]
  node_repo_manager["Repository manager<br/>[repo_manager.py]"]
end

subgraph group_analysis["Analysis engine"]
  node_pipeline["Analysis pipeline<br/>[pipeline.py]"]
  node_parser["Tree-sitter parser<br/>[code_parser.py]"]
  node_complexity["Complexity metrics"]
  node_smells["Smell detection<br/>[smell_detector.py]"]
  node_risk["Risk scoring<br/>[risk_model.py]"]
  node_bugs["Bug prediction<br/>[bug_predictor.py]"]
  node_clones["Clone detection<br/>[clone_detector.py]"]
  node_linter["Linter service<br/>[linter_service.py]"]
  node_refactor["Refactor suggestions<br/>[refactor_engine.py]"]
  node_ai_review["AI review<br/>[ai_reviewer.py]"]
  node_health["Health score<br/>[health_score.py]"]
end

subgraph group_service["API and state"]
  node_analysis_api["Analysis API<br/>[analyze.py]"]
  node_api_routes["API router<br/>[routes.py]"]
  node_schemas["Result schemas<br/>[schemas.py]"]
  node_auth["Authentication<br/>[auth.py]"]
  node_quotas["Usage quotas<br/>[quotas.py]"]
  node_database[("Analysis database<br/>[models.py]")]
  node_export_api["Export API<br/>[export.py]"]
end

subgraph group_experience["User experience"]
  node_input["Analysis input"]
  node_api_client["API client<br/>[api.ts]"]
  node_dashboard["Analysis dashboard<br/>[DashboardPage.tsx]"]
  node_file_detail["File detail<br/>[FileDetailPage.tsx]"]
  node_dependency_graph["Dependency graph view"]
  node_export_page["Export and reports<br/>[ExportPage.tsx]"]
  node_auth_context["Auth context<br/>[AuthContext.tsx]"]
  node_comparison["Comparison view<br/>[ComparisonPage.tsx]"]
end

node_user(("Developer"))
node_github(("GitHub / GitLab"))
node_firebase(("Firebase Auth"))

node_user -->|"submits source"| node_input
node_input -->|"requests analysis"| node_api_client
node_api_client -.->|"sends request"| node_analysis_api
node_github -->|"provides repository"| node_repo_manager
node_analysis_api -->|"collects source"| node_repo_manager
node_analysis_api -->|"starts analysis"| node_pipeline
node_pipeline -->|"parses files"| node_parser
node_pipeline -->|"measures complexity"| node_complexity
node_pipeline -->|"detects smells"| node_smells
node_pipeline -->|"scores risk"| node_risk
node_pipeline -->|"predicts hotspots"| node_bugs
node_pipeline -->|"finds clones"| node_clones
node_pipeline -->|"runs linters"| node_linter
node_pipeline -->|"generates suggestions"| node_refactor
node_pipeline -->|"calculates health"| node_health
node_pipeline -.->|"requests review"| node_ai_review
node_pipeline -->|"builds result"| node_schemas
node_api_routes -->|"routes analysis"| node_analysis_api
node_api_routes -->|"routes exports"| node_export_api
node_analysis_api -->|"checks identity"| node_auth
node_analysis_api -->|"checks usage"| node_quotas
node_analysis_api -->|"persists runs"| node_database
node_dashboard -->|"loads results"| node_api_client
node_dashboard -->|"renders dependencies"| node_dependency_graph
node_user -->|"views results"| node_dashboard
node_user -->|"inspects file"| node_file_detail
node_user -->|"compares analyses"| node_comparison
node_user -->|"requests report"| node_export_page
node_export_page -.->|"requests export"| node_export_api
node_user -->|"signs in"| node_auth_context
node_auth_context -->|"authenticates with"| node_firebase
node_analysis_api -.->|"returns result"| node_user

click node_input "https://github.com/aryanpandya0/replexity/blob/main/frontend/src/pages/AnalysisInputPage.tsx"
click node_api_client "https://github.com/aryanpandya0/replexity/blob/main/frontend/src/api.ts"
click node_analysis_api "https://github.com/aryanpandya0/replexity/blob/main/backend/api/analyze.py"
click node_repo_manager "https://github.com/aryanpandya0/replexity/blob/main/backend/analysis_engine/repo_manager.py"
click node_pipeline "https://github.com/aryanpandya0/replexity/blob/main/backend/api/pipeline.py"
click node_parser "https://github.com/aryanpandya0/replexity/blob/main/backend/analysis_engine/code_parser.py"
click node_complexity "https://github.com/aryanpandya0/replexity/blob/main/backend/analysis_engine/complexity_analyzer.py"
click node_smells "https://github.com/aryanpandya0/replexity/blob/main/backend/analysis_engine/smell_detector.py"
click node_risk "https://github.com/aryanpandya0/replexity/blob/main/backend/analysis_engine/risk_model.py"
click node_bugs "https://github.com/aryanpandya0/replexity/blob/main/backend/analysis_engine/bug_predictor.py"
click node_clones "https://github.com/aryanpandya0/replexity/blob/main/backend/analysis_engine/clone_detector.py"
click node_linter "https://github.com/aryanpandya0/replexity/blob/main/backend/analysis_engine/linter_service.py"
click node_refactor "https://github.com/aryanpandya0/replexity/blob/main/backend/analysis_engine/refactor_engine.py"
click node_ai_review "https://github.com/aryanpandya0/replexity/blob/main/backend/analysis_engine/ai_reviewer.py"
click node_health "https://github.com/aryanpandya0/replexity/blob/main/backend/analysis_engine/health_score.py"
click node_api_routes "https://github.com/aryanpandya0/replexity/blob/main/backend/api/routes.py"
click node_schemas "https://github.com/aryanpandya0/replexity/blob/main/backend/api/schemas.py"
click node_auth "https://github.com/aryanpandya0/replexity/blob/main/backend/api/auth.py"
click node_quotas "https://github.com/aryanpandya0/replexity/blob/main/backend/api/quotas.py"
click node_database "https://github.com/aryanpandya0/replexity/blob/main/backend/database/models.py"
click node_dashboard "https://github.com/aryanpandya0/replexity/blob/main/frontend/src/pages/DashboardPage.tsx"
click node_file_detail "https://github.com/aryanpandya0/replexity/blob/main/frontend/src/pages/FileDetailPage.tsx"
click node_dependency_graph "https://github.com/aryanpandya0/replexity/blob/main/frontend/src/components/DependencyGraph.tsx"
click node_export_api "https://github.com/aryanpandya0/replexity/blob/main/backend/api/export.py"
click node_export_page "https://github.com/aryanpandya0/replexity/blob/main/frontend/src/pages/ExportPage.tsx"
click node_auth_context "https://github.com/aryanpandya0/replexity/blob/main/frontend/src/context/AuthContext.tsx"
click node_comparison "https://github.com/aryanpandya0/replexity/blob/main/frontend/src/pages/ComparisonPage.tsx"

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_repo_manager toneBlue
class node_pipeline,node_parser,node_complexity,node_smells,node_risk,node_bugs,node_clones,node_linter,node_refactor,node_ai_review,node_health toneAmber
class node_analysis_api,node_api_routes,node_schemas,node_auth,node_quotas,node_database,node_export_api toneMint
class node_input,node_api_client,node_dashboard,node_file_detail,node_dependency_graph,node_export_page,node_auth_context,node_comparison toneRose
class node_user,node_github,node_firebase toneIndigo
```

## Components

### Source intake

- [Repository manager](https://github.com/aryanpandya0/replexity/blob/main/backend/analysis_engine/repo_manager.py): `backend/analysis_engine/repo_manager.py`

### Analysis engine

- [Analysis pipeline](https://github.com/aryanpandya0/replexity/blob/main/backend/api/pipeline.py): `backend/api/pipeline.py`
- [Tree-sitter parser](https://github.com/aryanpandya0/replexity/blob/main/backend/analysis_engine/code_parser.py): `backend/analysis_engine/code_parser.py`
- [Complexity metrics](https://github.com/aryanpandya0/replexity/blob/main/backend/analysis_engine/complexity_analyzer.py): `backend/analysis_engine/complexity_analyzer.py`
- [Smell detection](https://github.com/aryanpandya0/replexity/blob/main/backend/analysis_engine/smell_detector.py): `backend/analysis_engine/smell_detector.py`
- [Risk scoring](https://github.com/aryanpandya0/replexity/blob/main/backend/analysis_engine/risk_model.py): `backend/analysis_engine/risk_model.py`
- [Bug prediction](https://github.com/aryanpandya0/replexity/blob/main/backend/analysis_engine/bug_predictor.py): `backend/analysis_engine/bug_predictor.py`
- [Clone detection](https://github.com/aryanpandya0/replexity/blob/main/backend/analysis_engine/clone_detector.py): `backend/analysis_engine/clone_detector.py`
- [Linter service](https://github.com/aryanpandya0/replexity/blob/main/backend/analysis_engine/linter_service.py): `backend/analysis_engine/linter_service.py`
- [Refactor suggestions](https://github.com/aryanpandya0/replexity/blob/main/backend/analysis_engine/refactor_engine.py): `backend/analysis_engine/refactor_engine.py`
- [AI review](https://github.com/aryanpandya0/replexity/blob/main/backend/analysis_engine/ai_reviewer.py): `backend/analysis_engine/ai_reviewer.py`
- [Health score](https://github.com/aryanpandya0/replexity/blob/main/backend/analysis_engine/health_score.py): `backend/analysis_engine/health_score.py`

### API and state

- [Analysis API](https://github.com/aryanpandya0/replexity/blob/main/backend/api/analyze.py): `backend/api/analyze.py`
- [API router](https://github.com/aryanpandya0/replexity/blob/main/backend/api/routes.py): `backend/api/routes.py`
- [Result schemas](https://github.com/aryanpandya0/replexity/blob/main/backend/api/schemas.py): `backend/api/schemas.py`
- [Authentication](https://github.com/aryanpandya0/replexity/blob/main/backend/api/auth.py): `backend/api/auth.py`
- [Usage quotas](https://github.com/aryanpandya0/replexity/blob/main/backend/api/quotas.py): `backend/api/quotas.py`
- [Analysis database](https://github.com/aryanpandya0/replexity/blob/main/backend/database/models.py): `backend/database/models.py`
- [Export API](https://github.com/aryanpandya0/replexity/blob/main/backend/api/export.py): `backend/api/export.py`

### User experience

- [Analysis input](https://github.com/aryanpandya0/replexity/blob/main/frontend/src/pages/AnalysisInputPage.tsx): `frontend/src/pages/AnalysisInputPage.tsx`
- [API client](https://github.com/aryanpandya0/replexity/blob/main/frontend/src/api.ts): `frontend/src/api.ts`
- [Analysis dashboard](https://github.com/aryanpandya0/replexity/blob/main/frontend/src/pages/DashboardPage.tsx): `frontend/src/pages/DashboardPage.tsx`
- [File detail](https://github.com/aryanpandya0/replexity/blob/main/frontend/src/pages/FileDetailPage.tsx): `frontend/src/pages/FileDetailPage.tsx`
- [Dependency graph view](https://github.com/aryanpandya0/replexity/blob/main/frontend/src/components/DependencyGraph.tsx): `frontend/src/components/DependencyGraph.tsx`
- [Export and reports](https://github.com/aryanpandya0/replexity/blob/main/frontend/src/pages/ExportPage.tsx): `frontend/src/pages/ExportPage.tsx`
- [Auth context](https://github.com/aryanpandya0/replexity/blob/main/frontend/src/context/AuthContext.tsx): `frontend/src/context/AuthContext.tsx`
- [Comparison view](https://github.com/aryanpandya0/replexity/blob/main/frontend/src/pages/ComparisonPage.tsx): `frontend/src/pages/ComparisonPage.tsx`

### Other components

- **Developer**
- **GitHub / GitLab**
- **Firebase Auth**

## Connections

- Developer → Analysis input: submits source
- Analysis input → API client: requests analysis (evidence: `frontend/src/pages/AnalysisInputPage.tsx`)
- API client → Analysis API: sends request
- GitHub / GitLab → Repository manager: provides repository
- Analysis API → Repository manager: collects source (evidence: `backend/api/analyze.py`)
- Analysis API → Analysis pipeline: starts analysis (evidence: `backend/api/analyze.py`)
- Analysis pipeline → Tree-sitter parser: parses files (evidence: `backend/api/pipeline.py`)
- Analysis pipeline → Complexity metrics: measures complexity (evidence: `backend/api/pipeline.py`)
- Analysis pipeline → Smell detection: detects smells (evidence: `backend/api/pipeline.py`)
- Analysis pipeline → Risk scoring: scores risk (evidence: `backend/api/pipeline.py`)
- Analysis pipeline → Bug prediction: predicts hotspots (evidence: `backend/api/pipeline.py`)
- Analysis pipeline → Clone detection: finds clones (evidence: `backend/api/pipeline.py`)
- Analysis pipeline → Linter service: runs linters (evidence: `backend/api/pipeline.py`)
- Analysis pipeline → Refactor suggestions: generates suggestions (evidence: `backend/api/pipeline.py`)
- Analysis pipeline → Health score: calculates health (evidence: `backend/api/pipeline.py`)
- Analysis pipeline → AI review: requests review
- Analysis pipeline → Result schemas: builds result (evidence: `backend/api/pipeline.py`)
- API router → Analysis API: routes analysis (evidence: `backend/api/routes.py`)
- API router → Export API: routes exports (evidence: `backend/api/routes.py`)
- Analysis API → Authentication: checks identity (evidence: `backend/api/analyze.py`)
- Analysis API → Usage quotas: checks usage (evidence: `backend/api/analyze.py`)
- Analysis API → Analysis database: persists runs (evidence: `backend/api/analyze.py`)
- Analysis dashboard → API client: loads results (evidence: `frontend/src/pages/DashboardPage.tsx`)
- Analysis dashboard → Dependency graph view: renders dependencies (evidence: `frontend/src/pages/DashboardPage.tsx`)
- Developer → Analysis dashboard: views results
- Developer → File detail: inspects file
- Developer → Comparison view: compares analyses
- Developer → Export and reports: requests report
- Export and reports → Export API: requests export
- Developer → Auth context: signs in (evidence: `frontend/src/context/AuthContext.tsx`)
- Auth context → Firebase Auth: authenticates with (evidence: `frontend/src/context/AuthContext.tsx`)
- Analysis API → Developer: returns result
