# millionco/react-doctor architecture

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

- Interactive diagram: https://gitdiagram.com/millionco/react-doctor
- Repository: https://github.com/millionco/react-doctor

## Overview

React Doctor is a React codebase auditing CLI and rule plugin. Its main workflow is to scan a project, apply configured diagnostic controls, and report findings; it also supports changed-scope comparisons and browser performance traces. The repository includes project-analysis and framework-specific checks alongside lint rules. The graph combines README-documented capabilities with relationships visible in the supplied excerpts and SOURCE INDEX; unsampled implementation links are omitted rather than inferred.

Main entry points: [`packages/api/src/diagnose.ts`](https://github.com/millionco/react-doctor/blob/main/packages/api/src/diagnose.ts) (Diagnose API), [`packages/react-doctor/src/cli/index.ts`](https://github.com/millionco/react-doctor/blob/main/packages/react-doctor/src/cli/index.ts) (React Doctor CLI), [`packages/oxlint-plugin-react-doctor/src/index.ts`](https://github.com/millionco/react-doctor/blob/main/packages/oxlint-plugin-react-doctor/src/index.ts) (Rule plugin), [`packages/react-doctor/src/cli/commands/inspect.ts`](https://github.com/millionco/react-doctor/blob/main/packages/react-doctor/src/cli/commands/inspect.ts) (Browser trace scan)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_entry["CLI and API"]
  node_cli["React Doctor CLI<br/>[index.ts]"]
  node_api["Diagnose API<br/>[diagnose.ts]"]
end

subgraph group_analysis["Project analysis"]
  node_project["Project discovery"]
  node_project_analysis["Dependency analysis<br/>[analyze-project.ts]"]
  node_framework_checks["Framework checks"]
  node_rn_checks["React Native checks"]
end

subgraph group_rules["Lint rules"]
  node_plugin["Rule plugin<br/>[index.ts]"]
  node_security_rule["Storage security rule"]
  node_query_rule["Query client rule"]
  node_storage_rule["Storage performance rule"]
  node_rule_wrapper["Rule wrapper<br/>[define-rule.ts]"]
end

subgraph group_results["Findings and traces"]
  node_diagnostics["Diagnostic pipeline"]
  node_changed_scope["Changed-scope comparison"]
  node_report["Report and score"]
  node_trace["Browser trace scan<br/>[inspect.ts]"]
end

node_user(("Developer or agent"))
node_chrome(("Chrome browser"))

node_user -->|"runs scan"| node_cli
node_cli -.->|"requests diagnosis"| node_api
node_api -.->|"discovers project"| node_project
node_api -.->|"analyzes project"| node_project_analysis
node_api -.->|"checks framework"| node_framework_checks
node_api -.->|"checks platform"| node_rn_checks
node_plugin -.->|"provides rule"| node_security_rule
node_plugin -.->|"provides rule"| node_query_rule
node_plugin -.->|"provides rule"| node_storage_rule
node_security_rule -->|"uses wrapper"| node_rule_wrapper
node_query_rule -->|"defines rule"| node_rule_wrapper
node_storage_rule -->|"defines rule"| node_rule_wrapper
node_api -.->|"filters findings"| node_diagnostics
node_diagnostics -->|"looks up rules"| node_plugin
node_cli -.->|"compares changes"| node_changed_scope
node_cli -.->|"emits report"| node_report
node_user -->|"starts trace"| node_trace
node_trace -->|"records performance"| node_chrome
node_trace -->|"returns summary"| node_report

click node_cli "https://github.com/millionco/react-doctor/blob/main/packages/react-doctor/src/cli/index.ts"
click node_api "https://github.com/millionco/react-doctor/blob/main/packages/api/src/diagnose.ts"
click node_project "https://github.com/millionco/react-doctor/blob/main/packages/core/src/project-info/discover-project.ts"
click node_project_analysis "https://github.com/millionco/react-doctor/blob/main/packages/core/src/project-analysis/analyze-project.ts"
click node_framework_checks "https://github.com/millionco/react-doctor/blob/main/packages/core/src/check-expo-project.ts"
click node_rn_checks "https://github.com/millionco/react-doctor/blob/main/packages/core/src/check-react-native-project.ts"
click node_plugin "https://github.com/millionco/react-doctor/blob/main/packages/oxlint-plugin-react-doctor/src/index.ts"
click node_security_rule "https://github.com/millionco/react-doctor/blob/main/packages/oxlint-plugin-react-doctor/src/plugin/rules/security/auth-token-in-web-storage.ts"
click node_query_rule "https://github.com/millionco/react-doctor/blob/main/packages/oxlint-plugin-react-doctor/src/plugin/rules/tanstack-query/query-stable-query-client.ts"
click node_storage_rule "https://github.com/millionco/react-doctor/blob/main/packages/oxlint-plugin-react-doctor/src/plugin/rules/js-performance/js-cache-storage.ts"
click node_rule_wrapper "https://github.com/millionco/react-doctor/blob/main/packages/oxlint-plugin-react-doctor/src/plugin/utils/define-rule.ts"
click node_diagnostics "https://github.com/millionco/react-doctor/blob/main/packages/core/src/build-diagnostic-pipeline.ts"
click node_changed_scope "https://github.com/millionco/react-doctor/blob/main/packages/core/src/compute-diagnostic-delta.ts"
click node_report "https://github.com/millionco/react-doctor/blob/main/packages/core/src/build-json-report.ts"
click node_trace "https://github.com/millionco/react-doctor/blob/main/packages/react-doctor/src/cli/commands/inspect.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_cli,node_api,node_chrome toneBlue
class node_project,node_project_analysis,node_framework_checks,node_rn_checks toneAmber
class node_plugin,node_security_rule,node_query_rule,node_storage_rule,node_rule_wrapper toneMint
class node_diagnostics,node_changed_scope,node_report,node_trace toneRose
class node_user toneIndigo
```

## Components

### CLI and API

- [React Doctor CLI](https://github.com/millionco/react-doctor/blob/main/packages/react-doctor/src/cli/index.ts): `packages/react-doctor/src/cli/index.ts`
- [Diagnose API](https://github.com/millionco/react-doctor/blob/main/packages/api/src/diagnose.ts): `packages/api/src/diagnose.ts`

### Project analysis

- [Project discovery](https://github.com/millionco/react-doctor/blob/main/packages/core/src/project-info/discover-project.ts): `packages/core/src/project-info/discover-project.ts`
- [Dependency analysis](https://github.com/millionco/react-doctor/blob/main/packages/core/src/project-analysis/analyze-project.ts): `packages/core/src/project-analysis/analyze-project.ts`
- [Framework checks](https://github.com/millionco/react-doctor/blob/main/packages/core/src/check-expo-project.ts): `packages/core/src/check-expo-project.ts`
- [React Native checks](https://github.com/millionco/react-doctor/blob/main/packages/core/src/check-react-native-project.ts): `packages/core/src/check-react-native-project.ts`

### Lint rules

- [Rule plugin](https://github.com/millionco/react-doctor/blob/main/packages/oxlint-plugin-react-doctor/src/index.ts): `packages/oxlint-plugin-react-doctor/src/index.ts`
- [Storage security rule](https://github.com/millionco/react-doctor/blob/main/packages/oxlint-plugin-react-doctor/src/plugin/rules/security/auth-token-in-web-storage.ts): `packages/oxlint-plugin-react-doctor/src/plugin/rules/security/auth-token-in-web-storage.ts`
- [Query client rule](https://github.com/millionco/react-doctor/blob/main/packages/oxlint-plugin-react-doctor/src/plugin/rules/tanstack-query/query-stable-query-client.ts): `packages/oxlint-plugin-react-doctor/src/plugin/rules/tanstack-query/query-stable-query-client.ts`
- [Storage performance rule](https://github.com/millionco/react-doctor/blob/main/packages/oxlint-plugin-react-doctor/src/plugin/rules/js-performance/js-cache-storage.ts): `packages/oxlint-plugin-react-doctor/src/plugin/rules/js-performance/js-cache-storage.ts`
- [Rule wrapper](https://github.com/millionco/react-doctor/blob/main/packages/oxlint-plugin-react-doctor/src/plugin/utils/define-rule.ts): `packages/oxlint-plugin-react-doctor/src/plugin/utils/define-rule.ts`

### Findings and traces

- [Diagnostic pipeline](https://github.com/millionco/react-doctor/blob/main/packages/core/src/build-diagnostic-pipeline.ts): `packages/core/src/build-diagnostic-pipeline.ts`
- [Changed-scope comparison](https://github.com/millionco/react-doctor/blob/main/packages/core/src/compute-diagnostic-delta.ts): `packages/core/src/compute-diagnostic-delta.ts`
- [Report and score](https://github.com/millionco/react-doctor/blob/main/packages/core/src/build-json-report.ts): `packages/core/src/build-json-report.ts`
- [Browser trace scan](https://github.com/millionco/react-doctor/blob/main/packages/react-doctor/src/cli/commands/inspect.ts): `packages/react-doctor/src/cli/commands/inspect.ts`

### Other components

- **Developer or agent**
- **Chrome browser**

## Connections

- Developer or agent → React Doctor CLI: runs scan
- React Doctor CLI → Diagnose API: requests diagnosis
- Diagnose API → Project discovery: discovers project
- Diagnose API → Dependency analysis: analyzes project
- Diagnose API → Framework checks: checks framework
- Diagnose API → React Native checks: checks platform
- Rule plugin → Storage security rule: provides rule
- Rule plugin → Query client rule: provides rule
- Rule plugin → Storage performance rule: provides rule
- Storage security rule → Rule wrapper: uses wrapper (evidence: `packages/oxlint-plugin-react-doctor/src/plugin/rules/security/auth-token-in-web-storage.ts`)
- Query client rule → Rule wrapper: defines rule (evidence: `packages/oxlint-plugin-react-doctor/src/plugin/rules/tanstack-query/query-stable-query-client.ts`)
- Storage performance rule → Rule wrapper: defines rule (evidence: `packages/oxlint-plugin-react-doctor/src/plugin/rules/js-performance/js-cache-storage.ts`)
- Diagnose API → Diagnostic pipeline: filters findings
- Diagnostic pipeline → Rule plugin: looks up rules (evidence: `packages/core/src/build-diagnostic-pipeline.ts`)
- React Doctor CLI → Changed-scope comparison: compares changes
- React Doctor CLI → Report and score: emits report
- Developer or agent → Browser trace scan: starts trace
- Browser trace scan → Chrome browser: records performance
- Browser trace scan → Report and score: returns summary
