# junyoung-03/ai_hub architecture

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

- Interactive diagram: https://gitdiagram.com/junyoung-03/ai_hub
- Repository: https://github.com/junyoung-03/ai_hub

## Overview

etc. is a web service that unifies material from Google services, uploads, and manual text so users can find source-backed information and manage resulting actions and dates. The graph follows the documented collect → find → act workflow and includes major UI and integration capabilities. Some subsystem links rely on the README because their implementation files were not sampled; these links are cited as documented relationships.

Main entry points: [`src/types/database.ts`](https://github.com/junyoung-03/ai_hub/blob/main/src/types/database.ts) (Unified items and actions), [`workers/analysis/runner.ts`](https://github.com/junyoung-03/ai_hub/blob/main/workers/analysis/runner.ts) (Analysis job runner), [`src/lib/uploads/service.ts`](https://github.com/junyoung-03/ai_hub/blob/main/src/lib/uploads/service.ts) (Upload processing), [`src/app/api/v1/search/route.ts`](https://github.com/junyoung-03/ai_hub/blob/main/src/app/api/v1/search/route.ts) (Search API)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_intake["Material intake"]
  node_google_collect["Google collection"]
  node_upload_service["Upload processing<br/>[service.ts]"]
  node_upload_worker["Upload parser and OCR<br/>[parser.mjs]"]
  node_manual_service["Manual item creation<br/>[manual.ts]"]
  node_item_api["Item API<br/>[route.ts]"]
end

subgraph group_analysis["Analysis and records"]
  node_item_store[("Unified items and actions<br/>[database.ts]")]
  node_analysis_worker["Analysis job runner<br/>[runner.ts]"]
  node_gemini["Gemini analysis and validation<br/>[client.ts]"]
end

subgraph group_discovery["Search and evidence"]
  node_search_api["Search API<br/>[route.ts]"]
  node_search_service["Keyword and semantic search<br/>[service.ts]"]
  node_embedding["Embedding provider<br/>[provider.ts]"]
  node_search_workspace["Search results and evidence"]
  node_library["Library and item detail<br/>[library-list.tsx]"]
end

subgraph group_action["Actions and workspace"]
  node_actions_api["Action API<br/>[route.ts]"]
  node_schedule_model["Deadline and event calendar logic<br/>[schedule-model.ts]"]
  node_home["Home deadlines and calendar<br/>[today-calendar.tsx]"]
end

subgraph group_platform["Identity and storage"]
  node_google_oauth["Google connection management<br/>[connections.ts]"]
  node_auth["User authentication<br/>[auth.ts]"]
  node_supabase[("Supabase database and storage<br/>[admin.ts]")]
end

node_user(("User"))
node_google["Google services"]
node_upload["PDF and image upload"]
node_manual["Manual text"]

node_user -->|"connect and collect"| node_google_collect
node_google -->|"provides source data"| node_google_collect
node_user -->|"uploads files"| node_upload_service
node_upload -->|"provides files"| node_upload_service
node_upload_service -.->|"extracts text"| node_upload_worker
node_user -->|"adds text"| node_manual_service
node_manual -->|"provides content"| node_manual_service
node_user -->|"browses materials"| node_item_api
node_item_api -->|"queries items"| node_item_store
node_google_collect -->|"creates unified items"| node_item_store
node_upload_service -->|"creates upload items"| node_item_store
node_manual_service -->|"creates manual items"| node_item_store
node_item_store -->|"supplies analysis jobs"| node_analysis_worker
node_analysis_worker -->|"analyzes material"| node_gemini
node_gemini -->|"returns validated results"| node_analysis_worker
node_analysis_worker -->|"persists analysis"| node_item_store
node_user -->|"searches materials"| node_search_api
node_search_api -->|"routes query"| node_search_service
node_search_service -->|"requests embeddings"| node_embedding
node_search_service -->|"searches stored records"| node_item_store
node_search_api -->|"returns results"| node_search_workspace
node_search_workspace -->|"shows source evidence"| node_user
node_user -->|"explores materials"| node_library
node_user -->|"manages actions"| node_actions_api
node_actions_api -->|"reads and updates actions"| node_item_store
node_item_store -->|"provides action dates"| node_schedule_model
node_schedule_model -->|"groups deadlines and events"| node_home
node_google_oauth -->|"authorizes access"| node_google
node_google_oauth -->|"stores connections"| node_supabase
node_user -->|"signs in"| node_auth
node_auth -->|"verifies user"| node_supabase
node_analysis_worker -->|"claims and finishes jobs"| node_supabase

click node_google_collect "https://github.com/junyoung-03/ai_hub/blob/main/src/lib/google/drive-collection.ts"
click node_upload_service "https://github.com/junyoung-03/ai_hub/blob/main/src/lib/uploads/service.ts"
click node_upload_worker "https://github.com/junyoung-03/ai_hub/blob/main/workers/upload/parser.mjs"
click node_manual_service "https://github.com/junyoung-03/ai_hub/blob/main/src/lib/items/manual.ts"
click node_item_api "https://github.com/junyoung-03/ai_hub/blob/main/src/app/api/v1/items/route.ts"
click node_item_store "https://github.com/junyoung-03/ai_hub/blob/main/src/types/database.ts"
click node_analysis_worker "https://github.com/junyoung-03/ai_hub/blob/main/workers/analysis/runner.ts"
click node_gemini "https://github.com/junyoung-03/ai_hub/blob/main/src/lib/gemini/client.ts"
click node_search_api "https://github.com/junyoung-03/ai_hub/blob/main/src/app/api/v1/search/route.ts"
click node_search_service "https://github.com/junyoung-03/ai_hub/blob/main/src/lib/search/service.ts"
click node_embedding "https://github.com/junyoung-03/ai_hub/blob/main/src/lib/search/provider.ts"
click node_search_workspace "https://github.com/junyoung-03/ai_hub/blob/main/src/components/search/search-workspace.tsx"
click node_library "https://github.com/junyoung-03/ai_hub/blob/main/src/components/library/library-list.tsx"
click node_actions_api "https://github.com/junyoung-03/ai_hub/blob/main/src/app/api/v1/actions/route.ts"
click node_schedule_model "https://github.com/junyoung-03/ai_hub/blob/main/src/components/actions/schedule-model.ts"
click node_home "https://github.com/junyoung-03/ai_hub/blob/main/src/components/home/today-calendar.tsx"
click node_google_oauth "https://github.com/junyoung-03/ai_hub/blob/main/src/lib/google/connections.ts"
click node_auth "https://github.com/junyoung-03/ai_hub/blob/main/src/lib/supabase/auth.ts"
click node_supabase "https://github.com/junyoung-03/ai_hub/blob/main/src/lib/supabase/admin.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_google_collect,node_upload_service,node_upload_worker,node_manual_service,node_item_api,node_user toneBlue
class node_item_store,node_analysis_worker,node_gemini toneAmber
class node_search_api,node_search_service,node_embedding,node_search_workspace,node_library toneMint
class node_actions_api,node_schedule_model,node_home toneRose
class node_google_oauth,node_auth,node_supabase,node_google,node_upload,node_manual toneIndigo
```

## Components

### Material intake

- [Google collection](https://github.com/junyoung-03/ai_hub/blob/main/src/lib/google/drive-collection.ts): `src/lib/google/drive-collection.ts`
- [Upload processing](https://github.com/junyoung-03/ai_hub/blob/main/src/lib/uploads/service.ts): `src/lib/uploads/service.ts`
- [Upload parser and OCR](https://github.com/junyoung-03/ai_hub/blob/main/workers/upload/parser.mjs): `workers/upload/parser.mjs`
- [Manual item creation](https://github.com/junyoung-03/ai_hub/blob/main/src/lib/items/manual.ts): `src/lib/items/manual.ts`
- [Item API](https://github.com/junyoung-03/ai_hub/blob/main/src/app/api/v1/items/route.ts): `src/app/api/v1/items/route.ts`

### Analysis and records

- [Unified items and actions](https://github.com/junyoung-03/ai_hub/blob/main/src/types/database.ts): `src/types/database.ts`
- [Analysis job runner](https://github.com/junyoung-03/ai_hub/blob/main/workers/analysis/runner.ts): `workers/analysis/runner.ts`
- [Gemini analysis and validation](https://github.com/junyoung-03/ai_hub/blob/main/src/lib/gemini/client.ts): `src/lib/gemini/client.ts`

### Search and evidence

- [Search API](https://github.com/junyoung-03/ai_hub/blob/main/src/app/api/v1/search/route.ts): `src/app/api/v1/search/route.ts`
- [Keyword and semantic search](https://github.com/junyoung-03/ai_hub/blob/main/src/lib/search/service.ts): `src/lib/search/service.ts`
- [Embedding provider](https://github.com/junyoung-03/ai_hub/blob/main/src/lib/search/provider.ts): `src/lib/search/provider.ts`
- [Search results and evidence](https://github.com/junyoung-03/ai_hub/blob/main/src/components/search/search-workspace.tsx): `src/components/search/search-workspace.tsx`
- [Library and item detail](https://github.com/junyoung-03/ai_hub/blob/main/src/components/library/library-list.tsx): `src/components/library/library-list.tsx`

### Actions and workspace

- [Action API](https://github.com/junyoung-03/ai_hub/blob/main/src/app/api/v1/actions/route.ts): `src/app/api/v1/actions/route.ts`
- [Deadline and event calendar logic](https://github.com/junyoung-03/ai_hub/blob/main/src/components/actions/schedule-model.ts): `src/components/actions/schedule-model.ts`
- [Home deadlines and calendar](https://github.com/junyoung-03/ai_hub/blob/main/src/components/home/today-calendar.tsx): `src/components/home/today-calendar.tsx`

### Identity and storage

- [Google connection management](https://github.com/junyoung-03/ai_hub/blob/main/src/lib/google/connections.ts): `src/lib/google/connections.ts`
- [User authentication](https://github.com/junyoung-03/ai_hub/blob/main/src/lib/supabase/auth.ts): `src/lib/supabase/auth.ts`
- [Supabase database and storage](https://github.com/junyoung-03/ai_hub/blob/main/src/lib/supabase/admin.ts): `src/lib/supabase/admin.ts`

### Other components

- **User**
- **Google services**
- **PDF and image upload**
- **Manual text**

## Connections

- User → Google collection: connect and collect (evidence: `README.md`)
- Google services → Google collection: provides source data (evidence: `README.md`)
- User → Upload processing: uploads files (evidence: `README.md`)
- PDF and image upload → Upload processing: provides files (evidence: `README.md`)
- Upload processing → Upload parser and OCR: extracts text
- User → Manual item creation: adds text (evidence: `README.md`)
- Manual text → Manual item creation: provides content (evidence: `README.md`)
- User → Item API: browses materials (evidence: `README.md`)
- Item API → Unified items and actions: queries items (evidence: `src/app/api/v1/items/route.ts`)
- Google collection → Unified items and actions: creates unified items (evidence: `README.md`)
- Upload processing → Unified items and actions: creates upload items (evidence: `src/lib/uploads/service.ts`)
- Manual item creation → Unified items and actions: creates manual items
- Unified items and actions → Analysis job runner: supplies analysis jobs (evidence: `README.md`)
- Analysis job runner → Gemini analysis and validation: analyzes material (evidence: `workers/analysis/runner.ts`)
- Gemini analysis and validation → Analysis job runner: returns validated results (evidence: `src/lib/gemini/client.ts`)
- Analysis job runner → Unified items and actions: persists analysis (evidence: `workers/analysis/runner.ts`)
- User → Search API: searches materials (evidence: `README.md`)
- Search API → Keyword and semantic search: routes query (evidence: `src/app/api/v1/search/route.ts`)
- Keyword and semantic search → Embedding provider: requests embeddings (evidence: `src/lib/search/service.ts`)
- Keyword and semantic search → Unified items and actions: searches stored records (evidence: `src/lib/search/service.ts`)
- Search API → Search results and evidence: returns results (evidence: `README.md`)
- Search results and evidence → User: shows source evidence (evidence: `README.md`)
- User → Library and item detail: explores materials (evidence: `README.md`)
- User → Action API: manages actions (evidence: `README.md`)
- Action API → Unified items and actions: reads and updates actions (evidence: `src/app/api/v1/actions/route.ts`)
- Unified items and actions → Deadline and event calendar logic: provides action dates (evidence: `README.md`)
- Deadline and event calendar logic → Home deadlines and calendar: groups deadlines and events (evidence: `README.md`)
- Google connection management → Google services: authorizes access (evidence: `README.md`)
- Google connection management → Supabase database and storage: stores connections (evidence: `src/lib/google/connections.ts`)
- User → User authentication: signs in (evidence: `README.md`)
- User authentication → Supabase database and storage: verifies user (evidence: `src/lib/supabase/auth.ts`)
- Analysis job runner → Supabase database and storage: claims and finishes jobs (evidence: `workers/analysis/runner.ts`)
