# kedar-1118/repoanalyzer architecture

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

- Interactive diagram: https://gitdiagram.com/kedar-1118/repoanalyzer
- Repository: https://github.com/kedar-1118/repoanalyzer

## Overview

#### Purpose and topology
OpenPulse is a dual-sided developer/recruiter platform for GitHub-based developer profiling, open-source recommendations, candidate search, and AI codebase evaluation. It is split into a React SPA, an Express API, and a Python FastAPI RAG service:
- `frontend/src/main.jsx`
- `backend/src/server.js`
- `rag-service/main.py`

#### Frontend application
The Vite/React client provides separate developer and recruiter workflows, with routing and top-level composition rooted in:
- `frontend/src/App.jsx`
- `frontend/src/components/AppLayout.jsx`
- `frontend/src/services/apiClient.js`

Developer-facing pages cover login, profile, recommendations, issues, saved items, history, and deep analysis. Recruiter pages cover search, dashboards, shortlists, candidate details, and reports. Client authentication and notifications are centralized in Zustand stores:
- `frontend/src/store/authStore.js`
- `frontend/src/store/toastStore.js`

#### Express API boundary
The Node/Express service is the primary application API and broker between the SPA, Supabase, GitHub, and the RAG service:
- `backend/src/app.js`
- `backend/src/server.js`
- `backend/src/middleware/auth.js`

Routes divide major domains into authentication, profiles, candidates/recruiters, repository analysis, recommendations, saved items, issues, search, and bulk analysis. JWT authentication and role-aware recruiter flows form the security boundary; controllers implement HTTP orchestration while services contain integration/business logic:
- `backend/src/routes/authRoutes.js`
- `backend/src/controllers/analyzeController.js`
- `backend/src/services/recruiterService.js`

#### GitHub ingestion and matching
GitHub OAuth and repository/activity retrieval feed profile construction, issue discovery, and candidate analysis. The backend translates external GitHub data into platform records and matching inputs:
- `backend/src/config/github.js`
- `backend/src/services/githubService.js`
- `backend/src/services/matchService.js`

Recommendation and issue functionality are separate application domains, allowing repository compatibility scoring and good-first-issue discovery to evolve independently:
- `backend/src/controllers/recommendationController.js`
- `backend/src/controllers/issueController.js`

#### Persistence and operational data
Supabase provides authentication and PostgreSQL-backed application persistence, including users, repositories, tech-stack data, candidate/bulk-analysis records, and recommended issues. Schema evolution is represented by SQL migrations:
- `backend/src/config/database.js`
- `backend/supabase/migrations/20251202173826_create_users_and_repos_tables.sql`
- `backend/supabase/migrations/003_create_recommended_issues.sql`

The backend also contains a migration runner, indicating database changes may be applied from the service environment:
- `backend/run-migrations.js`
- `backend/src/migrations/001_bulk_candidates.sql`

#### Deep-analysis RAG pipeline
The FastAPI service isolates expensive code analysis from request-routing concerns. Its analysis endpoint fetches GitHub code, chunks it, embeds chunks, retrieves relevant context, prompts an LLM, scores results, and caches/reuses completed analyses:
- `rag-service/main.py`
- `rag-service/modules/github_fetcher.py`
- `rag-service/modules/llm_analyzer.py`

ChromaDB is the vector-search layer, while SQLite/local caching and repository SHA-based deduplication reduce repeat embedding and LLM work:
- `rag-service/modules/vector_store.py`
- `rag-service/modules/analysis_cache.py`
- `rag-service/modules/rag_retriever.py`

#### Primary control flow
1. The SPA authenticates through the Express API using GitHub OAuth; the backend issues/uses JWT-backed identity.
2. Backend services fetch GitHub profile, contribution, repository, and issue data; Supabase stores durable platform state.
3. Developer recommendation and recruiter search endpoints query stored candidate/repository signals and apply matching logic.
4. A deep-analysis request reaches the backend analysis domain, which calls the FastAPI RAG service over HTTP.
5. The RAG service returns structured AI assessment/scoring; the backend persists or exposes it to recruiter reports and frontend analysis views.

Material external dependencies are GitHub OAuth/API, Supabase/PostgreSQL, Gemini or OpenAI for LLM inference, ChromaDB for embeddings, and local SQLite caching.

Main entry points: [`backend/src/app.js`](https://github.com/kedar-1118/repoanalyzer/blob/main/backend/src/app.js) (Application routes), [`backend/src/config/database.js`](https://github.com/kedar-1118/repoanalyzer/blob/main/backend/src/config/database.js) (Supabase PostgreSQL), [`frontend/src/App.jsx`](https://github.com/kedar-1118/repoanalyzer/blob/main/frontend/src/App.jsx) (App routes and layout), [`backend/src/services/githubService.js`](https://github.com/kedar-1118/repoanalyzer/blob/main/backend/src/services/githubService.js) (GitHub ingestion)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_frontend["React SPA"]
  node_spa_entry["Vite entry<br/>React bootstrap<br/>[main.jsx]"]
  node_spa_shell["App routes and layout<br/>React application<br/>[App.jsx]"]
  node_client_state["Auth and toast state<br/>Zustand stores<br/>[authStore.js]"]
  node_api_client["API client<br/>HTTP client<br/>[apiClient.js]"]
end

subgraph group_api["Express API"]
  node_express_server["Express server<br/>Node runtime<br/>[server.js]"]
  node_express_app["Application routes<br/>Express app<br/>[app.js]"]
  node_auth_boundary["JWT and role guard<br/>Express middleware<br/>[auth.js]"]
  node_github_integration["GitHub ingestion<br/>backend service<br/>[githubService.js]"]
  node_matching["Candidate matching<br/>backend service<br/>[matchService.js]"]
  node_analysis_controller["Deep analysis API<br/>controller"]
  node_recommendations["Recommendations and issues<br/>controllers"]
  node_migrations["Schema migrations<br/>SQL migrations"]
end

subgraph group_rag["RAG Analysis Service"]
  node_rag_api["FastAPI analysis endpoint<br/>Python service<br/>[main.py]"]
  node_code_fetch["Repository code fetcher<br/>pipeline stage<br/>[github_fetcher.py]"]
  node_vector_retrieval["Chunk embedding and retrieval<br/>RAG pipeline<br/>[rag_retriever.py]"]
  node_llm_analysis["LLM assessment<br/>analysis stage<br/>[llm_analyzer.py]"]
  node_analysis_cache[("SHA analysis cache<br/>SQLite/local cache<br/>[analysis_cache.py]")]
end

node_supabase[("Supabase PostgreSQL<br/>auth and database<br/>[database.js]")]
node_github{{"GitHub OAuth and API<br/>external platform"}}
node_chroma[("ChromaDB<br/>vector store<br/>[vector_store.py]")]
node_llm_provider{{"Gemini or OpenAI<br/>LLM provider"}}

node_spa_entry -->|"mounts"| node_spa_shell
node_spa_shell -->|"uses"| node_client_state
node_spa_shell -->|"calls through"| node_api_client
node_api_client -->|"HTTPS API requests"| node_express_server
node_express_server -->|"hosts"| node_express_app
node_express_app -->|"protects routes with"| node_auth_boundary
node_express_app -->|"profile and issue flows"| node_github_integration
node_express_app -->|"search and recommendation flows"| node_matching
node_express_app -->|"dispatches"| node_recommendations
node_express_app -->|"dispatches"| node_analysis_controller
node_auth_boundary -->|"validates identity"| node_supabase
node_github_integration -->|"OAuth and data API"| node_github
node_github_integration -->|"persists platform records"| node_supabase
node_matching -->|"queries candidate signals"| node_supabase
node_recommendations -->|"reads and stores results"| node_supabase
node_analysis_controller -->|"HTTP deep-analysis request"| node_rag_api
node_analysis_controller -->|"stores assessments"| node_supabase
node_migrations -.->|"evolves schema"| node_supabase
node_rag_api -->|"checks SHA cache"| node_analysis_cache
node_rag_api -->|"on cache miss"| node_code_fetch
node_code_fetch -->|"fetches repository code"| node_github
node_code_fetch -->|"supplies chunks"| node_vector_retrieval
node_vector_retrieval -->|"indexes and searches"| node_chroma
node_vector_retrieval -->|"retrieved context"| node_llm_analysis
node_llm_analysis -->|"inference"| node_llm_provider
node_llm_analysis -->|"caches result"| node_analysis_cache

click node_spa_entry "https://github.com/kedar-1118/repoanalyzer/blob/main/frontend/src/main.jsx"
click node_spa_shell "https://github.com/kedar-1118/repoanalyzer/blob/main/frontend/src/App.jsx"
click node_client_state "https://github.com/kedar-1118/repoanalyzer/blob/main/frontend/src/store/authStore.js"
click node_api_client "https://github.com/kedar-1118/repoanalyzer/blob/main/frontend/src/services/apiClient.js"
click node_express_server "https://github.com/kedar-1118/repoanalyzer/blob/main/backend/src/server.js"
click node_express_app "https://github.com/kedar-1118/repoanalyzer/blob/main/backend/src/app.js"
click node_auth_boundary "https://github.com/kedar-1118/repoanalyzer/blob/main/backend/src/middleware/auth.js"
click node_github_integration "https://github.com/kedar-1118/repoanalyzer/blob/main/backend/src/services/githubService.js"
click node_matching "https://github.com/kedar-1118/repoanalyzer/blob/main/backend/src/services/matchService.js"
click node_analysis_controller "https://github.com/kedar-1118/repoanalyzer/blob/main/backend/src/controllers/analyzeController.js"
click node_recommendations "https://github.com/kedar-1118/repoanalyzer/blob/main/backend/src/controllers/recommendationController.js"
click node_supabase "https://github.com/kedar-1118/repoanalyzer/blob/main/backend/src/config/database.js"
click node_migrations "https://github.com/kedar-1118/repoanalyzer/blob/main/backend/supabase/migrations/20251202173826_create_users_and_repos_tables.sql"
click node_rag_api "https://github.com/kedar-1118/repoanalyzer/blob/main/rag-service/main.py"
click node_code_fetch "https://github.com/kedar-1118/repoanalyzer/blob/main/rag-service/modules/github_fetcher.py"
click node_vector_retrieval "https://github.com/kedar-1118/repoanalyzer/blob/main/rag-service/modules/rag_retriever.py"
click node_chroma "https://github.com/kedar-1118/repoanalyzer/blob/main/rag-service/modules/vector_store.py"
click node_llm_analysis "https://github.com/kedar-1118/repoanalyzer/blob/main/rag-service/modules/llm_analyzer.py"
click node_analysis_cache "https://github.com/kedar-1118/repoanalyzer/blob/main/rag-service/modules/analysis_cache.py"

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_spa_entry,node_spa_shell,node_client_state,node_api_client toneBlue
class node_express_server,node_express_app,node_auth_boundary,node_github_integration,node_matching,node_analysis_controller,node_recommendations,node_migrations toneAmber
class node_rag_api,node_code_fetch,node_vector_retrieval,node_llm_analysis,node_analysis_cache toneMint
class node_supabase,node_github,node_chroma,node_llm_provider toneNeutral
```

## Components

### React SPA

- [Vite entry](https://github.com/kedar-1118/repoanalyzer/blob/main/frontend/src/main.jsx): React bootstrap · `frontend/src/main.jsx`
- [App routes and layout](https://github.com/kedar-1118/repoanalyzer/blob/main/frontend/src/App.jsx): React application · Hosts developer and recruiter workflows. · `frontend/src/App.jsx`
- [Auth and toast state](https://github.com/kedar-1118/repoanalyzer/blob/main/frontend/src/store/authStore.js): Zustand stores · `frontend/src/store/authStore.js`
- [API client](https://github.com/kedar-1118/repoanalyzer/blob/main/frontend/src/services/apiClient.js): HTTP client · `frontend/src/services/apiClient.js`

### Express API

- [Express server](https://github.com/kedar-1118/repoanalyzer/blob/main/backend/src/server.js): Node runtime · `backend/src/server.js`
- [Application routes](https://github.com/kedar-1118/repoanalyzer/blob/main/backend/src/app.js): Express app · Routes authentication, profiles, candidates, analysis, recommendations, issues, and search. · `backend/src/app.js`
- [JWT and role guard](https://github.com/kedar-1118/repoanalyzer/blob/main/backend/src/middleware/auth.js): Express middleware · Protects authenticated and recruiter-only flows. · `backend/src/middleware/auth.js`
- [GitHub ingestion](https://github.com/kedar-1118/repoanalyzer/blob/main/backend/src/services/githubService.js): backend service · Retrieves OAuth, profile, repository, activity, and issue data. · `backend/src/services/githubService.js`
- [Candidate matching](https://github.com/kedar-1118/repoanalyzer/blob/main/backend/src/services/matchService.js): backend service · Applies repository and candidate matching logic. · `backend/src/services/matchService.js`
- [Deep analysis API](https://github.com/kedar-1118/repoanalyzer/blob/main/backend/src/controllers/analyzeController.js): controller · Delegates codebase analysis requests to the RAG service. · `backend/src/controllers/analyzeController.js`
- [Recommendations and issues](https://github.com/kedar-1118/repoanalyzer/blob/main/backend/src/controllers/recommendationController.js): controllers · Separately serves compatibility recommendations and good-first-issue discovery. · `backend/src/controllers/recommendationController.js`
- [Schema migrations](https://github.com/kedar-1118/repoanalyzer/blob/main/backend/supabase/migrations/20251202173826_create_users_and_repos_tables.sql): SQL migrations · `backend/supabase/migrations/20251202173826_create_users_and_repos_tables.sql`

### RAG Analysis Service

- [FastAPI analysis endpoint](https://github.com/kedar-1118/repoanalyzer/blob/main/rag-service/main.py): Python service · Coordinates cached retrieval and AI assessment. · `rag-service/main.py`
- [Repository code fetcher](https://github.com/kedar-1118/repoanalyzer/blob/main/rag-service/modules/github_fetcher.py): pipeline stage · `rag-service/modules/github_fetcher.py`
- [Chunk embedding and retrieval](https://github.com/kedar-1118/repoanalyzer/blob/main/rag-service/modules/rag_retriever.py): RAG pipeline · Indexes code chunks and retrieves relevant context. · `rag-service/modules/rag_retriever.py`
- [LLM assessment](https://github.com/kedar-1118/repoanalyzer/blob/main/rag-service/modules/llm_analyzer.py): analysis stage · Prompts an LLM and produces structured scoring. · `rag-service/modules/llm_analyzer.py`
- [SHA analysis cache](https://github.com/kedar-1118/repoanalyzer/blob/main/rag-service/modules/analysis_cache.py): SQLite/local cache · Deduplicates completed analyses and repeat inference. · `rag-service/modules/analysis_cache.py`

### Other components

- [Supabase PostgreSQL](https://github.com/kedar-1118/repoanalyzer/blob/main/backend/src/config/database.js): auth and database · Durable users, repositories, tech stack, candidates, analyses, and issues. · `backend/src/config/database.js`
- **GitHub OAuth and API**: external platform
- [ChromaDB](https://github.com/kedar-1118/repoanalyzer/blob/main/rag-service/modules/vector_store.py): vector store · `rag-service/modules/vector_store.py`
- **Gemini or OpenAI**: LLM provider

## Connections

- Vite entry → App routes and layout: mounts
- App routes and layout → Auth and toast state: uses
- App routes and layout → API client: calls through
- API client → Express server: HTTPS API requests
- Express server → Application routes: hosts
- Application routes → JWT and role guard: protects routes with
- Application routes → GitHub ingestion: profile and issue flows
- Application routes → Candidate matching: search and recommendation flows
- Application routes → Recommendations and issues: dispatches
- Application routes → Deep analysis API: dispatches
- JWT and role guard → Supabase PostgreSQL: validates identity
- GitHub ingestion → GitHub OAuth and API: OAuth and data API
- GitHub ingestion → Supabase PostgreSQL: persists platform records
- Candidate matching → Supabase PostgreSQL: queries candidate signals
- Recommendations and issues → Supabase PostgreSQL: reads and stores results
- Deep analysis API → FastAPI analysis endpoint: HTTP deep-analysis request
- Deep analysis API → Supabase PostgreSQL: stores assessments
- Schema migrations → Supabase PostgreSQL: evolves schema
- FastAPI analysis endpoint → SHA analysis cache: checks SHA cache
- FastAPI analysis endpoint → Repository code fetcher: on cache miss
- Repository code fetcher → GitHub OAuth and API: fetches repository code
- Repository code fetcher → Chunk embedding and retrieval: supplies chunks
- Chunk embedding and retrieval → ChromaDB: indexes and searches
- Chunk embedding and retrieval → LLM assessment: retrieved context
- LLM assessment → Gemini or OpenAI: inference
- LLM assessment → SHA analysis cache: caches result
