# prkr-28/project-aivora architecture

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

- Interactive diagram: https://gitdiagram.com/prkr-28/project-aivora
- Repository: https://github.com/prkr-28/project-aivora

## Overview

Aivora turns a user’s goal into an AI-generated day-by-day plan, then supports daily progress tracking, sentiment and analytics, AI insights, plan regeneration, chat guidance, and PDF reporting. The graph follows documented REST flows and sampled controller behavior; several frontend API calls and unsampled chat/PDF/AI wiring are represented only where supported by the README or tree, so uncertain internal links are omitted.

Main entry points: [`backend/src/controllers/pdf.controller.js`](https://github.com/prkr-28/project-aivora/blob/main/backend/src/controllers/pdf.controller.js) (PDF endpoint), [`frontend/src/App.jsx`](https://github.com/prkr-28/project-aivora/blob/main/frontend/src/App.jsx) (React app), [`backend/src/server.js`](https://github.com/prkr-28/project-aivora/blob/main/backend/src/server.js) (Express API), [`backend/src/controllers/goal.controller.js`](https://github.com/prkr-28/project-aivora/blob/main/backend/src/controllers/goal.controller.js) (Goal workflow)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_client["Web application"]
  node_app["React app<br/>[App.jsx]"]
  node_goalpages["Goal pages"]
  node_dashboard["Dashboard<br/>[DashboardPage.jsx]"]
  node_insightspage["Insights page<br/>[InsightsPage.jsx]"]
  node_chatui["Chat assistant<br/>[ChatAssistant.jsx]"]
  node_stores["Client stores"]
  node_http["HTTP client<br/>[api.js]"]
end

subgraph group_api["API workflows"]
  node_server["Express API<br/>[server.js]"]
  node_goalroutes["Goal routes<br/>[goal.routes.js]"]
  node_progressroutes["Progress routes<br/>[progress.routes.js]"]
  node_authroutes["Auth routes<br/>[auth.routes.js]"]
  node_goalctrl["Goal workflow<br/>[goal.controller.js]"]
  node_progressctrl["Progress workflow"]
  node_authctrl["Authentication<br/>[auth.controller.js]"]
  node_chatctrl["Chat workflow<br/>[chat.controller.js]"]
end

subgraph group_ai["AI engine"]
  node_planner["Goal planner"]
  node_regenerator["Plan regeneration"]
  node_insightai["Insight analyzer"]
  node_reportai["Report generator"]
  node_aigraph["Validated generation"]
  node_sentiment["Sentiment analysis"]
end

subgraph group_data["Persistent data"]
  node_goalmodel[("Goals<br/>[Goal.js]")]
  node_progressmodel[("Progress<br/>[Progress.js]")]
  node_insightmodel[("Insights<br/>[Insight.js]")]
  node_usermodel[("Users<br/>[User.js]")]
end

subgraph group_reporting["Insights and reports"]
  node_insightctrl["Insight workflow"]
  node_pdfctrl["PDF endpoint<br/>[pdf.controller.js]"]
  node_pdfservice["PDF renderer<br/>[pdf.service.js]"]
end

node_user(("User"))
node_gemini{{"Gemini AI"}}
node_mongodb[("MongoDB")]

node_user -->|"uses"| node_app
node_app -->|"routes to"| node_goalpages
node_app -->|"routes to"| node_dashboard
node_app -->|"routes to"| node_insightspage
node_app -->|"renders"| node_chatui
node_goalpages -->|"updates"| node_stores
node_dashboard -->|"reads"| node_stores
node_insightspage -->|"requests"| node_http
node_goalpages -->|"requests"| node_http
node_dashboard -->|"requests"| node_http
node_chatui -->|"requests"| node_http
node_http -->|"sends REST"| node_server
node_server -->|"mounts"| node_goalroutes
node_server -->|"mounts"| node_progressroutes
node_server -->|"mounts"| node_authroutes
node_goalroutes -->|"dispatches"| node_goalctrl
node_progressroutes -->|"dispatches"| node_progressctrl
node_authroutes -->|"dispatches"| node_authctrl
node_goalctrl -->|"generates plan"| node_planner
node_goalctrl -->|"regenerates plan"| node_regenerator
node_progressctrl -->|"scores comment"| node_sentiment
node_insightctrl -->|"analyzes progress"| node_insightai
node_chatctrl -.->|"requests guidance"| node_gemini
node_planner -->|"uses workflow"| node_aigraph
node_regenerator -->|"uses workflow"| node_aigraph
node_insightai -->|"uses workflow"| node_aigraph
node_aigraph -->|"prompts"| node_gemini
node_goalctrl -->|"reads and writes"| node_goalmodel
node_goalctrl -->|"reads and deletes"| node_progressmodel
node_progressctrl -->|"reads and updates"| node_goalmodel
node_progressctrl -->|"reads and writes"| node_progressmodel
node_authctrl -->|"reads and writes"| node_usermodel
node_insightctrl -->|"verifies goal"| node_goalmodel
node_insightctrl -->|"reads progress"| node_progressmodel
node_insightctrl -->|"stores and reads"| node_insightmodel
node_server -->|"mounts PDF routes"| node_pdfctrl
node_pdfctrl -->|"generates report"| node_pdfservice
node_pdfctrl -->|"reads goal"| node_goalmodel
node_pdfctrl -->|"reads progress"| node_progressmodel
node_pdfctrl -->|"reads insights"| node_insightmodel
node_pdfctrl -.->|"requests report content"| node_reportai
node_goalmodel -->|"persists"| node_mongodb
node_progressmodel -->|"persists"| node_mongodb
node_insightmodel -->|"persists"| node_mongodb
node_usermodel -->|"persists"| node_mongodb

click node_app "https://github.com/prkr-28/project-aivora/blob/main/frontend/src/App.jsx"
click node_goalpages "https://github.com/prkr-28/project-aivora/tree/main/frontend/src/pages"
click node_dashboard "https://github.com/prkr-28/project-aivora/blob/main/frontend/src/pages/DashboardPage.jsx"
click node_insightspage "https://github.com/prkr-28/project-aivora/blob/main/frontend/src/pages/InsightsPage.jsx"
click node_chatui "https://github.com/prkr-28/project-aivora/blob/main/frontend/src/components/ChatAssistant.jsx"
click node_stores "https://github.com/prkr-28/project-aivora/tree/main/frontend/src/store"
click node_http "https://github.com/prkr-28/project-aivora/blob/main/frontend/src/lib/api.js"
click node_server "https://github.com/prkr-28/project-aivora/blob/main/backend/src/server.js"
click node_goalroutes "https://github.com/prkr-28/project-aivora/blob/main/backend/src/routes/goal.routes.js"
click node_progressroutes "https://github.com/prkr-28/project-aivora/blob/main/backend/src/routes/progress.routes.js"
click node_authroutes "https://github.com/prkr-28/project-aivora/blob/main/backend/src/routes/auth.routes.js"
click node_goalctrl "https://github.com/prkr-28/project-aivora/blob/main/backend/src/controllers/goal.controller.js"
click node_progressctrl "https://github.com/prkr-28/project-aivora/blob/main/backend/src/controllers/progress.controller.js"
click node_authctrl "https://github.com/prkr-28/project-aivora/blob/main/backend/src/controllers/auth.controller.js"
click node_insightctrl "https://github.com/prkr-28/project-aivora/blob/main/backend/src/controllers/insight.controller.js"
click node_pdfctrl "https://github.com/prkr-28/project-aivora/blob/main/backend/src/controllers/pdf.controller.js"
click node_pdfservice "https://github.com/prkr-28/project-aivora/blob/main/backend/src/services/pdf.service.js"
click node_chatctrl "https://github.com/prkr-28/project-aivora/blob/main/backend/src/controllers/chat.controller.js"
click node_planner "https://github.com/prkr-28/project-aivora/blob/main/backend/src/ai/chains/goalPlannerChain.js"
click node_regenerator "https://github.com/prkr-28/project-aivora/blob/main/backend/src/ai/chains/regenerationChain.js"
click node_insightai "https://github.com/prkr-28/project-aivora/blob/main/backend/src/ai/chains/insightAnalyzerChain.js"
click node_reportai "https://github.com/prkr-28/project-aivora/blob/main/backend/src/ai/chains/reportGeneratorChain.js"
click node_aigraph "https://github.com/prkr-28/project-aivora/blob/main/backend/src/ai/graphs/structuredGenerationGraph.js"
click node_sentiment "https://github.com/prkr-28/project-aivora/blob/main/backend/src/ai/utils/sentimentAnalyzer.js"
click node_goalmodel "https://github.com/prkr-28/project-aivora/blob/main/backend/src/models/Goal.js"
click node_progressmodel "https://github.com/prkr-28/project-aivora/blob/main/backend/src/models/Progress.js"
click node_insightmodel "https://github.com/prkr-28/project-aivora/blob/main/backend/src/models/Insight.js"
click node_usermodel "https://github.com/prkr-28/project-aivora/blob/main/backend/src/models/User.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_app,node_goalpages,node_dashboard,node_insightspage,node_chatui,node_stores,node_http,node_user toneBlue
class node_server,node_goalroutes,node_progressroutes,node_authroutes,node_goalctrl,node_progressctrl,node_authctrl,node_chatctrl,node_mongodb toneAmber
class node_planner,node_regenerator,node_insightai,node_reportai,node_aigraph,node_sentiment toneMint
class node_goalmodel,node_progressmodel,node_insightmodel,node_usermodel toneRose
class node_insightctrl,node_pdfctrl,node_pdfservice,node_gemini toneIndigo
```

## Components

### Web application

- [React app](https://github.com/prkr-28/project-aivora/blob/main/frontend/src/App.jsx): `frontend/src/App.jsx`
- [Goal pages](https://github.com/prkr-28/project-aivora/tree/main/frontend/src/pages): `frontend/src/pages`
- [Dashboard](https://github.com/prkr-28/project-aivora/blob/main/frontend/src/pages/DashboardPage.jsx): `frontend/src/pages/DashboardPage.jsx`
- [Insights page](https://github.com/prkr-28/project-aivora/blob/main/frontend/src/pages/InsightsPage.jsx): `frontend/src/pages/InsightsPage.jsx`
- [Chat assistant](https://github.com/prkr-28/project-aivora/blob/main/frontend/src/components/ChatAssistant.jsx): `frontend/src/components/ChatAssistant.jsx`
- [Client stores](https://github.com/prkr-28/project-aivora/tree/main/frontend/src/store): `frontend/src/store`
- [HTTP client](https://github.com/prkr-28/project-aivora/blob/main/frontend/src/lib/api.js): `frontend/src/lib/api.js`

### API workflows

- [Express API](https://github.com/prkr-28/project-aivora/blob/main/backend/src/server.js): `backend/src/server.js`
- [Goal routes](https://github.com/prkr-28/project-aivora/blob/main/backend/src/routes/goal.routes.js): `backend/src/routes/goal.routes.js`
- [Progress routes](https://github.com/prkr-28/project-aivora/blob/main/backend/src/routes/progress.routes.js): `backend/src/routes/progress.routes.js`
- [Auth routes](https://github.com/prkr-28/project-aivora/blob/main/backend/src/routes/auth.routes.js): `backend/src/routes/auth.routes.js`
- [Goal workflow](https://github.com/prkr-28/project-aivora/blob/main/backend/src/controllers/goal.controller.js): `backend/src/controllers/goal.controller.js`
- [Progress workflow](https://github.com/prkr-28/project-aivora/blob/main/backend/src/controllers/progress.controller.js): `backend/src/controllers/progress.controller.js`
- [Authentication](https://github.com/prkr-28/project-aivora/blob/main/backend/src/controllers/auth.controller.js): `backend/src/controllers/auth.controller.js`
- [Chat workflow](https://github.com/prkr-28/project-aivora/blob/main/backend/src/controllers/chat.controller.js): `backend/src/controllers/chat.controller.js`

### AI engine

- [Goal planner](https://github.com/prkr-28/project-aivora/blob/main/backend/src/ai/chains/goalPlannerChain.js): `backend/src/ai/chains/goalPlannerChain.js`
- [Plan regeneration](https://github.com/prkr-28/project-aivora/blob/main/backend/src/ai/chains/regenerationChain.js): `backend/src/ai/chains/regenerationChain.js`
- [Insight analyzer](https://github.com/prkr-28/project-aivora/blob/main/backend/src/ai/chains/insightAnalyzerChain.js): `backend/src/ai/chains/insightAnalyzerChain.js`
- [Report generator](https://github.com/prkr-28/project-aivora/blob/main/backend/src/ai/chains/reportGeneratorChain.js): `backend/src/ai/chains/reportGeneratorChain.js`
- [Validated generation](https://github.com/prkr-28/project-aivora/blob/main/backend/src/ai/graphs/structuredGenerationGraph.js): `backend/src/ai/graphs/structuredGenerationGraph.js`
- [Sentiment analysis](https://github.com/prkr-28/project-aivora/blob/main/backend/src/ai/utils/sentimentAnalyzer.js): `backend/src/ai/utils/sentimentAnalyzer.js`

### Persistent data

- [Goals](https://github.com/prkr-28/project-aivora/blob/main/backend/src/models/Goal.js): `backend/src/models/Goal.js`
- [Progress](https://github.com/prkr-28/project-aivora/blob/main/backend/src/models/Progress.js): `backend/src/models/Progress.js`
- [Insights](https://github.com/prkr-28/project-aivora/blob/main/backend/src/models/Insight.js): `backend/src/models/Insight.js`
- [Users](https://github.com/prkr-28/project-aivora/blob/main/backend/src/models/User.js): `backend/src/models/User.js`

### Insights and reports

- [Insight workflow](https://github.com/prkr-28/project-aivora/blob/main/backend/src/controllers/insight.controller.js): `backend/src/controllers/insight.controller.js`
- [PDF endpoint](https://github.com/prkr-28/project-aivora/blob/main/backend/src/controllers/pdf.controller.js): `backend/src/controllers/pdf.controller.js`
- [PDF renderer](https://github.com/prkr-28/project-aivora/blob/main/backend/src/services/pdf.service.js): `backend/src/services/pdf.service.js`

### Other components

- **User**
- **Gemini AI**
- **MongoDB**

## Connections

- User → React app: uses
- React app → Goal pages: routes to
- React app → Dashboard: routes to
- React app → Insights page: routes to
- React app → Chat assistant: renders
- Goal pages → Client stores: updates
- Dashboard → Client stores: reads
- Insights page → HTTP client: requests
- Goal pages → HTTP client: requests
- Dashboard → HTTP client: requests
- Chat assistant → HTTP client: requests
- HTTP client → Express API: sends REST
- Express API → Goal routes: mounts
- Express API → Progress routes: mounts
- Express API → Auth routes: mounts
- Goal routes → Goal workflow: dispatches
- Progress routes → Progress workflow: dispatches
- Auth routes → Authentication: dispatches
- Goal workflow → Goal planner: generates plan
- Goal workflow → Plan regeneration: regenerates plan
- Progress workflow → Sentiment analysis: scores comment
- Insight workflow → Insight analyzer: analyzes progress
- Chat workflow → Gemini AI: requests guidance
- Goal planner → Validated generation: uses workflow
- Plan regeneration → Validated generation: uses workflow
- Insight analyzer → Validated generation: uses workflow
- Validated generation → Gemini AI: prompts
- Goal workflow → Goals: reads and writes
- Goal workflow → Progress: reads and deletes
- Progress workflow → Goals: reads and updates
- Progress workflow → Progress: reads and writes
- Authentication → Users: reads and writes
- Insight workflow → Goals: verifies goal
- Insight workflow → Progress: reads progress
- Insight workflow → Insights: stores and reads
- Express API → PDF endpoint: mounts PDF routes
- PDF endpoint → PDF renderer: generates report
- PDF endpoint → Goals: reads goal
- PDF endpoint → Progress: reads progress
- PDF endpoint → Insights: reads insights
- PDF endpoint → Report generator: requests report content
- Goals → MongoDB: persists
- Progress → MongoDB: persists
- Insights → MongoDB: persists
- Users → MongoDB: persists
