# tinashe2023/personal-intelligence-hub architecture

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

- Interactive diagram: https://gitdiagram.com/tinashe2023/personal-intelligence-hub
- Repository: https://github.com/tinashe2023/personal-intelligence-hub

## Overview

PIOS is a Next.js personal dashboard aggregating operational metrics and external information. The user-facing flow is dashboard → API routes → domain integrations → displayed results; a separate scheduled collection flow persists selected data, while AI routes process content and expose cached insights. The README documents the major dashboard capabilities and scheduler; sampled route code confirms several API-to-library and collection-to-storage calls, but not the page’s exact request wiring or scheduler internals.

Main entry points: [`app/api/cron/collect/route.js`](https://github.com/tinashe2023/personal-intelligence-hub/blob/main/app/api/cron/collect/route.js) (Scheduled collection), [`app/page.js`](https://github.com/tinashe2023/personal-intelligence-hub/blob/main/app/page.js) (Dashboard UI), [`lib/news.js`](https://github.com/tinashe2023/personal-intelligence-hub/blob/main/lib/news.js) (News feeds), [`lib/research.js`](https://github.com/tinashe2023/personal-intelligence-hub/blob/main/lib/research.js) (Research papers)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_presentation["Dashboard and API"]
  node_dashboard["Dashboard UI<br/>[page.js]"]
  node_system_route["System API<br/>[route.js]"]
  node_weather_route["Weather API<br/>[route.js]"]
  node_news_route["News API<br/>[route.js]"]
  node_email_route["Email API<br/>[route.js]"]
  node_research_route["Research API<br/>[route.js]"]
  node_youtube_route["YouTube API<br/>[route.js]"]
  node_analytics_route["Analytics API<br/>[route.js]"]
end

subgraph group_domains["Dashboard domains"]
  node_system_lib["System metrics<br/>[system.js]"]
  node_weather_lib["Weather data<br/>[weather.js]"]
  node_news_lib["News feeds<br/>[news.js]"]
  node_gmail_lib["Gmail filtering<br/>[gmail.js]"]
  node_research_lib["Research papers<br/>[research.js]"]
  node_youtube_lib["YouTube metrics<br/>[youtube.js]"]
  node_analytics_lib["GA4 metrics<br/>[analytics.js]"]
end

subgraph group_automation["Collection and AI"]
  node_collect_route["Scheduled collection<br/>[route.js]"]
  node_process_route["Scheduled AI<br/>[route.js]"]
  node_ai_process["AI processing API<br/>[route.js]"]
  node_ai_insights["Cached insights API<br/>[route.js]"]
  node_ai_processor["AI processor<br/>[processor.js]"]
  node_ai_cache["AI cache access<br/>[cache.js]"]
end

subgraph group_state["Persistence"]
  node_db[("MongoDB<br/>[mongodb.js]")]
  node_system_model[("System metrics model<br/>[SystemMetric.js]")]
  node_weather_model[("Weather model<br/>[WeatherData.js]")]
  node_news_model[("News model<br/>[NewsItem.js]")]
  node_research_model[("Research model<br/>[ResearchPaper.js]")]
  node_ai_model[("AI cache model<br/>[AICache.js]")]
end

subgraph group_integrations["External services"]
  node_open_meteo["Open-Meteo"]
  node_news_api["News provider"]
  node_gmail["Gmail"]
  node_semantic_scholar["Semantic Scholar"]
  node_youtube["YouTube service"]
  node_ga4["Google Analytics"]
end

node_user(("Dashboard user"))

node_user -->|"views"| node_dashboard
node_dashboard -->|"requests metrics"| node_system_route
node_dashboard -->|"requests weather"| node_weather_route
node_dashboard -->|"requests news"| node_news_route
node_dashboard -->|"requests email"| node_email_route
node_dashboard -->|"requests research"| node_research_route
node_dashboard -->|"requests analytics"| node_youtube_route
node_dashboard -->|"requests analytics"| node_analytics_route
node_system_route -->|"calls"| node_system_lib
node_weather_route -->|"calls"| node_weather_lib
node_news_route -->|"calls"| node_news_lib
node_email_route -->|"calls"| node_gmail_lib
node_research_route -->|"calls"| node_research_lib
node_youtube_route -->|"calls"| node_youtube_lib
node_analytics_route -->|"calls"| node_analytics_lib
node_collect_route -->|"collects"| node_system_lib
node_collect_route -->|"collects"| node_weather_lib
node_collect_route -->|"collects"| node_news_lib
node_collect_route -->|"collects"| node_research_lib
node_collect_route -->|"connects"| node_db
node_collect_route -->|"writes metrics"| node_system_model
node_collect_route -->|"writes weather"| node_weather_model
node_collect_route -->|"reads and writes"| node_news_model
node_collect_route -->|"reads and writes"| node_research_model
node_process_route -->|"fetches news"| node_news_lib
node_process_route -->|"fetches papers"| node_research_lib
node_process_route -->|"processes content"| node_ai_processor
node_ai_process -->|"fetches news"| node_news_lib
node_ai_process -->|"fetches papers"| node_research_lib
node_ai_process -->|"processes content"| node_ai_processor
node_ai_insights -->|"reads insights"| node_ai_cache
node_ai_cache -->|"reads cache"| node_ai_model
node_system_lib -.->|"returns local metrics"| node_system_model
node_weather_lib -.->|"fetches weather"| node_open_meteo
node_news_lib -.->|"fetches articles"| node_news_api
node_gmail_lib -.->|"fetches messages"| node_gmail
node_research_lib -.->|"fetches papers"| node_semantic_scholar
node_youtube_lib -.->|"fetches channel stats"| node_youtube
node_analytics_lib -.->|"queries reports"| node_ga4

click node_dashboard "https://github.com/tinashe2023/personal-intelligence-hub/blob/main/app/page.js"
click node_system_route "https://github.com/tinashe2023/personal-intelligence-hub/blob/main/app/api/system/route.js"
click node_weather_route "https://github.com/tinashe2023/personal-intelligence-hub/blob/main/app/api/weather/route.js"
click node_news_route "https://github.com/tinashe2023/personal-intelligence-hub/blob/main/app/api/news/route.js"
click node_email_route "https://github.com/tinashe2023/personal-intelligence-hub/blob/main/app/api/email/route.js"
click node_research_route "https://github.com/tinashe2023/personal-intelligence-hub/blob/main/app/api/research/route.js"
click node_youtube_route "https://github.com/tinashe2023/personal-intelligence-hub/blob/main/app/api/youtube/route.js"
click node_analytics_route "https://github.com/tinashe2023/personal-intelligence-hub/blob/main/app/api/analytics/route.js"
click node_system_lib "https://github.com/tinashe2023/personal-intelligence-hub/blob/main/lib/system.js"
click node_weather_lib "https://github.com/tinashe2023/personal-intelligence-hub/blob/main/lib/weather.js"
click node_news_lib "https://github.com/tinashe2023/personal-intelligence-hub/blob/main/lib/news.js"
click node_gmail_lib "https://github.com/tinashe2023/personal-intelligence-hub/blob/main/lib/gmail.js"
click node_research_lib "https://github.com/tinashe2023/personal-intelligence-hub/blob/main/lib/research.js"
click node_youtube_lib "https://github.com/tinashe2023/personal-intelligence-hub/blob/main/lib/youtube.js"
click node_analytics_lib "https://github.com/tinashe2023/personal-intelligence-hub/blob/main/lib/analytics.js"
click node_collect_route "https://github.com/tinashe2023/personal-intelligence-hub/blob/main/app/api/cron/collect/route.js"
click node_process_route "https://github.com/tinashe2023/personal-intelligence-hub/blob/main/app/api/cron/process/route.js"
click node_ai_process "https://github.com/tinashe2023/personal-intelligence-hub/blob/main/app/api/ai/process/route.js"
click node_ai_insights "https://github.com/tinashe2023/personal-intelligence-hub/blob/main/app/api/ai/insights/route.js"
click node_ai_processor "https://github.com/tinashe2023/personal-intelligence-hub/blob/main/lib/ai/processor.js"
click node_ai_cache "https://github.com/tinashe2023/personal-intelligence-hub/blob/main/lib/ai/cache.js"
click node_db "https://github.com/tinashe2023/personal-intelligence-hub/blob/main/lib/mongodb.js"
click node_system_model "https://github.com/tinashe2023/personal-intelligence-hub/blob/main/models/SystemMetric.js"
click node_weather_model "https://github.com/tinashe2023/personal-intelligence-hub/blob/main/models/WeatherData.js"
click node_news_model "https://github.com/tinashe2023/personal-intelligence-hub/blob/main/models/NewsItem.js"
click node_research_model "https://github.com/tinashe2023/personal-intelligence-hub/blob/main/models/ResearchPaper.js"
click node_ai_model "https://github.com/tinashe2023/personal-intelligence-hub/blob/main/models/AICache.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_dashboard,node_system_route,node_weather_route,node_news_route,node_email_route,node_research_route,node_youtube_route,node_analytics_route,node_user toneBlue
class node_system_lib,node_weather_lib,node_news_lib,node_gmail_lib,node_research_lib,node_youtube_lib,node_analytics_lib toneAmber
class node_collect_route,node_process_route,node_ai_process,node_ai_insights,node_ai_processor,node_ai_cache toneMint
class node_db,node_system_model,node_weather_model,node_news_model,node_research_model,node_ai_model toneRose
class node_open_meteo,node_news_api,node_gmail,node_semantic_scholar,node_youtube,node_ga4 toneIndigo
```

## Components

### Dashboard and API

- [Dashboard UI](https://github.com/tinashe2023/personal-intelligence-hub/blob/main/app/page.js): `app/page.js`
- [System API](https://github.com/tinashe2023/personal-intelligence-hub/blob/main/app/api/system/route.js): `app/api/system/route.js`
- [Weather API](https://github.com/tinashe2023/personal-intelligence-hub/blob/main/app/api/weather/route.js): `app/api/weather/route.js`
- [News API](https://github.com/tinashe2023/personal-intelligence-hub/blob/main/app/api/news/route.js): `app/api/news/route.js`
- [Email API](https://github.com/tinashe2023/personal-intelligence-hub/blob/main/app/api/email/route.js): `app/api/email/route.js`
- [Research API](https://github.com/tinashe2023/personal-intelligence-hub/blob/main/app/api/research/route.js): `app/api/research/route.js`
- [YouTube API](https://github.com/tinashe2023/personal-intelligence-hub/blob/main/app/api/youtube/route.js): `app/api/youtube/route.js`
- [Analytics API](https://github.com/tinashe2023/personal-intelligence-hub/blob/main/app/api/analytics/route.js): `app/api/analytics/route.js`

### Dashboard domains

- [System metrics](https://github.com/tinashe2023/personal-intelligence-hub/blob/main/lib/system.js): `lib/system.js`
- [Weather data](https://github.com/tinashe2023/personal-intelligence-hub/blob/main/lib/weather.js): `lib/weather.js`
- [News feeds](https://github.com/tinashe2023/personal-intelligence-hub/blob/main/lib/news.js): `lib/news.js`
- [Gmail filtering](https://github.com/tinashe2023/personal-intelligence-hub/blob/main/lib/gmail.js): `lib/gmail.js`
- [Research papers](https://github.com/tinashe2023/personal-intelligence-hub/blob/main/lib/research.js): `lib/research.js`
- [YouTube metrics](https://github.com/tinashe2023/personal-intelligence-hub/blob/main/lib/youtube.js): `lib/youtube.js`
- [GA4 metrics](https://github.com/tinashe2023/personal-intelligence-hub/blob/main/lib/analytics.js): `lib/analytics.js`

### Collection and AI

- [Scheduled collection](https://github.com/tinashe2023/personal-intelligence-hub/blob/main/app/api/cron/collect/route.js): `app/api/cron/collect/route.js`
- [Scheduled AI](https://github.com/tinashe2023/personal-intelligence-hub/blob/main/app/api/cron/process/route.js): `app/api/cron/process/route.js`
- [AI processing API](https://github.com/tinashe2023/personal-intelligence-hub/blob/main/app/api/ai/process/route.js): `app/api/ai/process/route.js`
- [Cached insights API](https://github.com/tinashe2023/personal-intelligence-hub/blob/main/app/api/ai/insights/route.js): `app/api/ai/insights/route.js`
- [AI processor](https://github.com/tinashe2023/personal-intelligence-hub/blob/main/lib/ai/processor.js): `lib/ai/processor.js`
- [AI cache access](https://github.com/tinashe2023/personal-intelligence-hub/blob/main/lib/ai/cache.js): `lib/ai/cache.js`

### Persistence

- [MongoDB](https://github.com/tinashe2023/personal-intelligence-hub/blob/main/lib/mongodb.js): `lib/mongodb.js`
- [System metrics model](https://github.com/tinashe2023/personal-intelligence-hub/blob/main/models/SystemMetric.js): `models/SystemMetric.js`
- [Weather model](https://github.com/tinashe2023/personal-intelligence-hub/blob/main/models/WeatherData.js): `models/WeatherData.js`
- [News model](https://github.com/tinashe2023/personal-intelligence-hub/blob/main/models/NewsItem.js): `models/NewsItem.js`
- [Research model](https://github.com/tinashe2023/personal-intelligence-hub/blob/main/models/ResearchPaper.js): `models/ResearchPaper.js`
- [AI cache model](https://github.com/tinashe2023/personal-intelligence-hub/blob/main/models/AICache.js): `models/AICache.js`

### External services

- **Open-Meteo**
- **News provider**
- **Gmail**
- **Semantic Scholar**
- **YouTube service**
- **Google Analytics**

### Other components

- **Dashboard user**

## Connections

- Dashboard user → Dashboard UI: views
- Dashboard UI → System API: requests metrics
- Dashboard UI → Weather API: requests weather
- Dashboard UI → News API: requests news
- Dashboard UI → Email API: requests email
- Dashboard UI → Research API: requests research
- Dashboard UI → YouTube API: requests analytics
- Dashboard UI → Analytics API: requests analytics
- System API → System metrics: calls
- Weather API → Weather data: calls
- News API → News feeds: calls
- Email API → Gmail filtering: calls
- Research API → Research papers: calls
- YouTube API → YouTube metrics: calls
- Analytics API → GA4 metrics: calls
- Scheduled collection → System metrics: collects
- Scheduled collection → Weather data: collects
- Scheduled collection → News feeds: collects
- Scheduled collection → Research papers: collects
- Scheduled collection → MongoDB: connects
- Scheduled collection → System metrics model: writes metrics
- Scheduled collection → Weather model: writes weather
- Scheduled collection → News model: reads and writes
- Scheduled collection → Research model: reads and writes
- Scheduled AI → News feeds: fetches news
- Scheduled AI → Research papers: fetches papers
- Scheduled AI → AI processor: processes content
- AI processing API → News feeds: fetches news
- AI processing API → Research papers: fetches papers
- AI processing API → AI processor: processes content
- Cached insights API → AI cache access: reads insights
- AI cache access → AI cache model: reads cache
- System metrics → System metrics model: returns local metrics
- Weather data → Open-Meteo: fetches weather
- News feeds → News provider: fetches articles
- Gmail filtering → Gmail: fetches messages
- Research papers → Semantic Scholar: fetches papers
- YouTube metrics → YouTube service: fetches channel stats
- GA4 metrics → Google Analytics: queries reports
