# nagavardhini22/careerpilot-ai-agent architecture

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

- Interactive diagram: https://gitdiagram.com/nagavardhini22/careerpilot-ai-agent
- Repository: https://github.com/nagavardhini22/careerpilot-ai-agent

## Overview

CareerPilot is a web-based AI career agent. Users authenticate, build a candidate profile, discover and save jobs, then request compatibility analysis and interview preparation; the agent plans controlled tool calls and returns a data-grounded synthesis. The graph preserves the documented profile, job-search, analysis, application-history, dashboard, and audit capabilities. Several routes and services were not excerpted, so uncertain connections are omitted; README-documented agent and tool relationships are cited to the README.

Main entry points: [`backend/server.js`](https://github.com/nagavardhini22/careerpilot-ai-agent/blob/main/backend/server.js) (Express server), [`backend/config/db.js`](https://github.com/nagavardhini22/careerpilot-ai-agent/blob/main/backend/config/db.js) (MySQL data store), [`frontend/js/app.js`](https://github.com/nagavardhini22/careerpilot-ai-agent/blob/main/frontend/js/app.js) (Career workspace), [`backend/routes/jobRoutes.js`](https://github.com/nagavardhini22/careerpilot-ai-agent/blob/main/backend/routes/jobRoutes.js) (Job routes)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_client["User interface"]
  node_frontend["Career workspace<br/>[app.js]"]
  node_api["Browser API client<br/>[api.js]"]
  node_ui["Interface rendering<br/>[ui.js]"]
  node_agentui["Agent timeline<br/>[agent.js]"]
end

subgraph group_access["API and identity"]
  node_server["Express server<br/>[server.js]"]
  node_authroutes["Auth routes<br/>[authRoutes.js]"]
  node_authcontroller["Auth controller<br/>[authController.js]"]
  node_authservice["Identity service<br/>[authService.js]"]
  node_authmiddleware["Session security<br/>[authMiddleware.js]"]
end

subgraph group_career["Career workflows"]
  node_profileroutes["Profile routes<br/>[profileRoutes.js]"]
  node_profileservice["Profile builder<br/>[profileService.js]"]
  node_jobroutes["Job routes<br/>[jobRoutes.js]"]
  node_jobcontroller["Saved jobs<br/>[jobController.js]"]
  node_searchcontroller["Job discovery API"]
  node_aggregator["Job aggregator"]
  node_providers["Job-board providers"]
  node_analysisroutes["Analysis and activity routes<br/>[analysisRoutes.js]"]
  node_analysiscontroller["Dashboard and history"]
end

subgraph group_agent["Agent reasoning"]
  node_agentroutes["Agent routes<br/>[agentRoutes.js]"]
  node_agentcontroller["Agent endpoint<br/>[agentController.js]"]
  node_agentservice["Agent orchestrator<br/>[agentService.js]"]
  node_llm["LLM planner<br/>[llmService.js]"]
  node_registry["Tool registry<br/>[index.js]"]
  node_tools["Career analysis tools"]
end

subgraph group_data["Persistence"]
  node_database[("MySQL data store<br/>[db.js]")]
end

node_user(("CareerPilot user"))
node_externalboards["External job boards"]
node_llmprovider["LLM provider APIs"]

node_user -->|"uses"| node_frontend
node_frontend -->|"requests"| node_api
node_frontend -.->|"renders"| node_ui
node_frontend -.->|"shows activity"| node_agentui
node_api -.->|"calls API"| node_server
node_server -->|"mounts"| node_authroutes
node_server -->|"mounts"| node_profileroutes
node_server -->|"mounts"| node_jobroutes
node_server -->|"mounts"| node_analysisroutes
node_server -->|"mounts"| node_agentroutes
node_authroutes -->|"routes to"| node_authcontroller
node_authcontroller -->|"delegates"| node_authservice
node_authmiddleware -->|"verifies sessions"| node_authservice
node_profileroutes -.->|"routes to"| node_profileservice
node_jobroutes -->|"routes to"| node_jobcontroller
node_jobroutes -->|"routes to"| node_searchcontroller
node_searchcontroller -->|"delegates"| node_aggregator
node_aggregator -->|"queries providers"| node_providers
node_analysisroutes -.->|"routes to"| node_analysiscontroller
node_agentroutes -->|"routes to"| node_agentcontroller
node_agentcontroller -->|"delegates"| node_agentservice
node_agentservice -->|"requests plans"| node_llm
node_llm -.->|"calls provider"| node_llmprovider
node_agentservice -->|"dispatches tools"| node_registry
node_registry -->|"executes"| node_tools
node_tools -.->|"reads and writes"| node_database
node_aggregator -->|"saves jobs"| node_database
node_providers -.->|"searches"| node_externalboards
node_authservice -.->|"stores accounts"| node_database
node_profileservice -.->|"stores profiles"| node_database
node_analysiscontroller -->|"queries history"| node_database

click node_frontend "https://github.com/nagavardhini22/careerpilot-ai-agent/blob/main/frontend/js/app.js"
click node_api "https://github.com/nagavardhini22/careerpilot-ai-agent/blob/main/frontend/js/api.js"
click node_ui "https://github.com/nagavardhini22/careerpilot-ai-agent/blob/main/frontend/js/ui.js"
click node_agentui "https://github.com/nagavardhini22/careerpilot-ai-agent/blob/main/frontend/js/agent.js"
click node_server "https://github.com/nagavardhini22/careerpilot-ai-agent/blob/main/backend/server.js"
click node_authroutes "https://github.com/nagavardhini22/careerpilot-ai-agent/blob/main/backend/routes/authRoutes.js"
click node_authcontroller "https://github.com/nagavardhini22/careerpilot-ai-agent/blob/main/backend/controllers/authController.js"
click node_authservice "https://github.com/nagavardhini22/careerpilot-ai-agent/blob/main/backend/services/authService.js"
click node_authmiddleware "https://github.com/nagavardhini22/careerpilot-ai-agent/blob/main/backend/middleware/authMiddleware.js"
click node_profileroutes "https://github.com/nagavardhini22/careerpilot-ai-agent/blob/main/backend/routes/profileRoutes.js"
click node_profileservice "https://github.com/nagavardhini22/careerpilot-ai-agent/blob/main/backend/services/profileService.js"
click node_jobroutes "https://github.com/nagavardhini22/careerpilot-ai-agent/blob/main/backend/routes/jobRoutes.js"
click node_jobcontroller "https://github.com/nagavardhini22/careerpilot-ai-agent/blob/main/backend/controllers/jobController.js"
click node_searchcontroller "https://github.com/nagavardhini22/careerpilot-ai-agent/blob/main/backend/controllers/jobSearchController.js"
click node_aggregator "https://github.com/nagavardhini22/careerpilot-ai-agent/blob/main/backend/services/jobProviders/jobAggregatorService.js"
click node_providers "https://github.com/nagavardhini22/careerpilot-ai-agent/tree/main/backend/services/jobProviders"
click node_analysisroutes "https://github.com/nagavardhini22/careerpilot-ai-agent/blob/main/backend/routes/analysisRoutes.js"
click node_analysiscontroller "https://github.com/nagavardhini22/careerpilot-ai-agent/blob/main/backend/controllers/analysisController.js"
click node_agentroutes "https://github.com/nagavardhini22/careerpilot-ai-agent/blob/main/backend/routes/agentRoutes.js"
click node_agentcontroller "https://github.com/nagavardhini22/careerpilot-ai-agent/blob/main/backend/controllers/agentController.js"
click node_agentservice "https://github.com/nagavardhini22/careerpilot-ai-agent/blob/main/backend/services/agentService.js"
click node_llm "https://github.com/nagavardhini22/careerpilot-ai-agent/blob/main/backend/services/llmService.js"
click node_registry "https://github.com/nagavardhini22/careerpilot-ai-agent/blob/main/backend/tools/index.js"
click node_tools "https://github.com/nagavardhini22/careerpilot-ai-agent/tree/main/backend/tools"
click node_database "https://github.com/nagavardhini22/careerpilot-ai-agent/blob/main/backend/config/db.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_frontend,node_api,node_ui,node_agentui,node_user toneBlue
class node_server,node_authroutes,node_authcontroller,node_authservice,node_authmiddleware toneAmber
class node_profileroutes,node_profileservice,node_jobroutes,node_jobcontroller,node_searchcontroller,node_aggregator,node_providers,node_analysisroutes,node_analysiscontroller,node_llmprovider toneMint
class node_agentroutes,node_agentcontroller,node_agentservice,node_llm,node_registry,node_tools toneRose
class node_database,node_externalboards toneIndigo
```

## Components

### User interface

- [Career workspace](https://github.com/nagavardhini22/careerpilot-ai-agent/blob/main/frontend/js/app.js): `frontend/js/app.js`
- [Browser API client](https://github.com/nagavardhini22/careerpilot-ai-agent/blob/main/frontend/js/api.js): `frontend/js/api.js`
- [Interface rendering](https://github.com/nagavardhini22/careerpilot-ai-agent/blob/main/frontend/js/ui.js): `frontend/js/ui.js`
- [Agent timeline](https://github.com/nagavardhini22/careerpilot-ai-agent/blob/main/frontend/js/agent.js): `frontend/js/agent.js`

### API and identity

- [Express server](https://github.com/nagavardhini22/careerpilot-ai-agent/blob/main/backend/server.js): `backend/server.js`
- [Auth routes](https://github.com/nagavardhini22/careerpilot-ai-agent/blob/main/backend/routes/authRoutes.js): `backend/routes/authRoutes.js`
- [Auth controller](https://github.com/nagavardhini22/careerpilot-ai-agent/blob/main/backend/controllers/authController.js): `backend/controllers/authController.js`
- [Identity service](https://github.com/nagavardhini22/careerpilot-ai-agent/blob/main/backend/services/authService.js): `backend/services/authService.js`
- [Session security](https://github.com/nagavardhini22/careerpilot-ai-agent/blob/main/backend/middleware/authMiddleware.js): `backend/middleware/authMiddleware.js`

### Career workflows

- [Profile routes](https://github.com/nagavardhini22/careerpilot-ai-agent/blob/main/backend/routes/profileRoutes.js): `backend/routes/profileRoutes.js`
- [Profile builder](https://github.com/nagavardhini22/careerpilot-ai-agent/blob/main/backend/services/profileService.js): `backend/services/profileService.js`
- [Job routes](https://github.com/nagavardhini22/careerpilot-ai-agent/blob/main/backend/routes/jobRoutes.js): `backend/routes/jobRoutes.js`
- [Saved jobs](https://github.com/nagavardhini22/careerpilot-ai-agent/blob/main/backend/controllers/jobController.js): `backend/controllers/jobController.js`
- [Job discovery API](https://github.com/nagavardhini22/careerpilot-ai-agent/blob/main/backend/controllers/jobSearchController.js): `backend/controllers/jobSearchController.js`
- [Job aggregator](https://github.com/nagavardhini22/careerpilot-ai-agent/blob/main/backend/services/jobProviders/jobAggregatorService.js): `backend/services/jobProviders/jobAggregatorService.js`
- [Job-board providers](https://github.com/nagavardhini22/careerpilot-ai-agent/tree/main/backend/services/jobProviders): `backend/services/jobProviders`
- [Analysis and activity routes](https://github.com/nagavardhini22/careerpilot-ai-agent/blob/main/backend/routes/analysisRoutes.js): `backend/routes/analysisRoutes.js`
- [Dashboard and history](https://github.com/nagavardhini22/careerpilot-ai-agent/blob/main/backend/controllers/analysisController.js): `backend/controllers/analysisController.js`

### Agent reasoning

- [Agent routes](https://github.com/nagavardhini22/careerpilot-ai-agent/blob/main/backend/routes/agentRoutes.js): `backend/routes/agentRoutes.js`
- [Agent endpoint](https://github.com/nagavardhini22/careerpilot-ai-agent/blob/main/backend/controllers/agentController.js): `backend/controllers/agentController.js`
- [Agent orchestrator](https://github.com/nagavardhini22/careerpilot-ai-agent/blob/main/backend/services/agentService.js): `backend/services/agentService.js`
- [LLM planner](https://github.com/nagavardhini22/careerpilot-ai-agent/blob/main/backend/services/llmService.js): `backend/services/llmService.js`
- [Tool registry](https://github.com/nagavardhini22/careerpilot-ai-agent/blob/main/backend/tools/index.js): `backend/tools/index.js`
- [Career analysis tools](https://github.com/nagavardhini22/careerpilot-ai-agent/tree/main/backend/tools): `backend/tools`

### Persistence

- [MySQL data store](https://github.com/nagavardhini22/careerpilot-ai-agent/blob/main/backend/config/db.js): `backend/config/db.js`

### Other components

- **CareerPilot user**
- **External job boards**
- **LLM provider APIs**

## Connections

- CareerPilot user → Career workspace: uses
- Career workspace → Browser API client: requests (evidence: `frontend/js/app.js`)
- Career workspace → Interface rendering: renders
- Career workspace → Agent timeline: shows activity
- Browser API client → Express server: calls API
- Express server → Auth routes: mounts (evidence: `backend/server.js`)
- Express server → Profile routes: mounts (evidence: `backend/server.js`)
- Express server → Job routes: mounts (evidence: `backend/server.js`)
- Express server → Analysis and activity routes: mounts (evidence: `backend/server.js`)
- Express server → Agent routes: mounts (evidence: `backend/server.js`)
- Auth routes → Auth controller: routes to (evidence: `backend/routes/authRoutes.js`)
- Auth controller → Identity service: delegates (evidence: `backend/controllers/authController.js`)
- Session security → Identity service: verifies sessions (evidence: `backend/middleware/authMiddleware.js`)
- Profile routes → Profile builder: routes to
- Job routes → Saved jobs: routes to (evidence: `backend/routes/jobRoutes.js`)
- Job routes → Job discovery API: routes to (evidence: `backend/routes/jobRoutes.js`)
- Job discovery API → Job aggregator: delegates (evidence: `backend/controllers/jobSearchController.js`)
- Job aggregator → Job-board providers: queries providers (evidence: `backend/services/jobProviders/jobAggregatorService.js`)
- Analysis and activity routes → Dashboard and history: routes to (evidence: `backend/routes/analysisRoutes.js`)
- Agent routes → Agent endpoint: routes to (evidence: `backend/routes/agentRoutes.js`)
- Agent endpoint → Agent orchestrator: delegates (evidence: `backend/controllers/agentController.js`)
- Agent orchestrator → LLM planner: requests plans (evidence: `backend/services/agentService.js`)
- LLM planner → LLM provider APIs: calls provider
- Agent orchestrator → Tool registry: dispatches tools (evidence: `backend/services/agentService.js`)
- Tool registry → Career analysis tools: executes (evidence: `backend/tools/index.js`)
- Career analysis tools → MySQL data store: reads and writes (evidence: `backend/tools/generateInterviewQuestions.js`)
- Job aggregator → MySQL data store: saves jobs (evidence: `backend/services/jobProviders/jobAggregatorService.js`)
- Job-board providers → External job boards: searches
- Identity service → MySQL data store: stores accounts (evidence: `backend/services/authService.js`)
- Profile builder → MySQL data store: stores profiles (evidence: `backend/services/profileService.js`)
- Dashboard and history → MySQL data store: queries history (evidence: `backend/controllers/analysisController.js`)
