# yahyanaim/ai-hub architecture

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

- Interactive diagram: https://gitdiagram.com/yahyanaim/ai-hub
- Repository: https://github.com/yahyanaim/ai-hub

## Overview

AIHubTools combines a curated resource catalog with career-development workflows. Users browse or search resources, request goal-based recommendations, and use the AI Career Advisor to create CV and learning-plan artifacts; account, mentoring, and portfolio workflows add persistent services, while administrators manage users and operations. The README documents the main service architecture and storage; sampled route excerpts show some concrete service calls. Other branches are represented from documented capabilities and the repository tree, without asserting unshown internal call sequences.

Main entry points: [`app/page.tsx`](https://github.com/yahyanaim/ai-hub/blob/main/app/page.tsx) (Web experience), [`app/chat/page.tsx`](https://github.com/yahyanaim/ai-hub/blob/main/app/chat/page.tsx) (Career Advisor), [`app/api/chat/route.ts`](https://github.com/yahyanaim/ai-hub/blob/main/app/api/chat/route.ts) (Chat service), [`lib/server/quota.ts`](https://github.com/yahyanaim/ai-hub/blob/main/lib/server/quota.ts) (AI quotas)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_discovery["Resource discovery"]
  node_web["Web experience<br/>[page.tsx]"]
  node_catalog[("Seed catalog<br/>[index.ts]")]
  node_catalog_indexes["Catalog indexes<br/>[index-tools.ts]"]
  node_catalog_ui["Catalog views<br/>[ListingView.tsx]"]
  node_catalog_data["Catalog collections<br/>[courses.ts]"]
end

subgraph group_career["Career workflows"]
  node_goal_ui["Goal finder<br/>[GoalFinder.tsx]"]
  node_goal_api["Goal matching<br/>[route.ts]"]
  node_goal_logic["Goal matching logic<br/>[goal-finder.ts]"]
  node_chat_ui["Career Advisor<br/>[page.tsx]"]
  node_chat_api["Chat service<br/>[route.ts]"]
  node_cv_api["CV assistance<br/>[route.ts]"]
  node_roadmap_api["Learning calendars<br/>[route.ts]"]
  node_roadmap_tools["Calendar tools<br/>[scheduler.ts]"]
  node_portfolio_api["Portfolio publishing<br/>[route.ts]"]
  node_portfolio_store["Portfolio storage"]
end

subgraph group_platform["Accounts and services"]
  node_auth_api["Account workflows<br/>[route.ts]"]
  node_auth_service["Authentication<br/>[auth.ts]"]
  node_user_sessions["User sessions<br/>[user-session.ts]"]
  node_api_routes["API routes"]
end

subgraph group_operations["Mentoring and administration"]
  node_mentoring["Mentoring programs<br/>[route.ts]"]
  node_admin_ui["Admin console"]
  node_admin_metrics["Usage metrics<br/>[admin-metrics.ts]"]
end

subgraph group_foundation["Shared foundations"]
  node_redis[("Redis services<br/>[redis.ts]")]
  node_quotas["AI quotas<br/>[quota.ts]"]
  node_visitor_identity["Visitor identity<br/>[visitor.ts]"]
  node_budget["Budget controls<br/>[budget-config.ts]"]
  node_ai_provider["NVIDIA inference<br/>[nvidia-models.ts]"]
  node_ui_primitives["UI primitives<br/>[FacetedGlyph.tsx]"]
  node_metadata["Metadata and SEO<br/>[seo.ts]"]
  node_site_config["Site configuration<br/>[site.ts]"]
  node_structured_data["Structured data<br/>[json-ld.ts]"]
end

node_visitor(("Visitor"))

node_visitor -->|"browses"| node_web
node_web -->|"renders through"| node_catalog_indexes
node_catalog_indexes -->|"reads"| node_catalog
node_catalog -->|"includes"| node_catalog_data
node_web -->|"renders"| node_catalog_ui
node_visitor -->|"describes goal"| node_goal_ui
node_goal_ui -.->|"requests matches"| node_goal_api
node_goal_api -->|"uses"| node_goal_logic
node_visitor -->|"starts conversation"| node_chat_ui
node_chat_ui -.->|"sends turns"| node_chat_api
node_chat_api -->|"checks session"| node_user_sessions
node_chat_api -->|"selects models"| node_ai_provider
node_chat_ui -.->|"requests CV help"| node_cv_api
node_chat_ui -.->|"creates calendar"| node_roadmap_api
node_roadmap_api -->|"schedules courses"| node_roadmap_tools
node_visitor -->|"publishes portfolio"| node_portfolio_api
node_portfolio_api -->|"stores artifact"| node_portfolio_store
node_portfolio_store -->|"stores metadata"| node_redis
node_visitor -->|"creates account"| node_auth_api
node_auth_api -.->|"authenticates"| node_auth_service
node_auth_service -->|"checks revocation"| node_redis
node_visitor -->|"applies to program"| node_mentoring
node_admin_ui -.->|"manages operations"| node_api_routes
node_admin_ui -.->|"views metrics"| node_admin_metrics
node_admin_metrics -->|"stores metrics"| node_redis
node_chat_api -->|"enforces limits"| node_quotas
node_quotas -->|"reads limits"| node_budget
node_quotas -->|"keys visitor"| node_visitor_identity
node_quotas -->|"coordinates limits"| node_redis
node_web -.->|"sets metadata"| node_metadata
node_web -->|"uses canonical URL"| node_site_config
node_web -->|"embeds JSON-LD"| node_structured_data

click node_web "https://github.com/yahyanaim/ai-hub/blob/main/app/page.tsx"
click node_catalog "https://github.com/yahyanaim/ai-hub/blob/main/lib/seed/index.ts"
click node_catalog_indexes "https://github.com/yahyanaim/ai-hub/blob/main/lib/server/index-tools.ts"
click node_catalog_ui "https://github.com/yahyanaim/ai-hub/blob/main/components/listing/ListingView.tsx"
click node_catalog_data "https://github.com/yahyanaim/ai-hub/blob/main/lib/seed/courses.ts"
click node_goal_ui "https://github.com/yahyanaim/ai-hub/blob/main/components/goal/GoalFinder.tsx"
click node_goal_api "https://github.com/yahyanaim/ai-hub/blob/main/app/api/goal-match/route.ts"
click node_goal_logic "https://github.com/yahyanaim/ai-hub/blob/main/lib/goal-finder.ts"
click node_chat_ui "https://github.com/yahyanaim/ai-hub/blob/main/app/chat/page.tsx"
click node_chat_api "https://github.com/yahyanaim/ai-hub/blob/main/app/api/chat/route.ts"
click node_cv_api "https://github.com/yahyanaim/ai-hub/blob/main/app/api/chat/cv/route.ts"
click node_roadmap_api "https://github.com/yahyanaim/ai-hub/blob/main/app/api/roadmaps/generate/route.ts"
click node_roadmap_tools "https://github.com/yahyanaim/ai-hub/blob/main/lib/roadmap/scheduler.ts"
click node_portfolio_api "https://github.com/yahyanaim/ai-hub/blob/main/app/api/portfolio/route.ts"
click node_portfolio_store "https://github.com/yahyanaim/ai-hub/blob/main/lib/server/portfolio-storage.ts"
click node_auth_api "https://github.com/yahyanaim/ai-hub/blob/main/app/api/auth/login/route.ts"
click node_auth_service "https://github.com/yahyanaim/ai-hub/blob/main/lib/server/auth.ts"
click node_user_sessions "https://github.com/yahyanaim/ai-hub/blob/main/lib/server/user-session.ts"
click node_mentoring "https://github.com/yahyanaim/ai-hub/blob/main/app/api/mentoring/applications/route.ts"
click node_admin_ui "https://github.com/yahyanaim/ai-hub/blob/main/components/admin/AdminDashboardClient.tsx"
click node_admin_metrics "https://github.com/yahyanaim/ai-hub/blob/main/lib/server/admin-metrics.ts"
click node_api_routes "https://github.com/yahyanaim/ai-hub/tree/main/app/api"
click node_redis "https://github.com/yahyanaim/ai-hub/blob/main/lib/server/redis.ts"
click node_quotas "https://github.com/yahyanaim/ai-hub/blob/main/lib/server/quota.ts"
click node_visitor_identity "https://github.com/yahyanaim/ai-hub/blob/main/lib/server/visitor.ts"
click node_budget "https://github.com/yahyanaim/ai-hub/blob/main/lib/server/budget-config.ts"
click node_ai_provider "https://github.com/yahyanaim/ai-hub/blob/main/lib/server/nvidia-models.ts"
click node_ui_primitives "https://github.com/yahyanaim/ai-hub/blob/main/components/ui/FacetedGlyph.tsx"
click node_metadata "https://github.com/yahyanaim/ai-hub/blob/main/lib/seo.ts"
click node_site_config "https://github.com/yahyanaim/ai-hub/blob/main/lib/site.ts"
click node_structured_data "https://github.com/yahyanaim/ai-hub/blob/main/lib/json-ld.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_web,node_catalog,node_catalog_indexes,node_catalog_ui,node_catalog_data toneBlue
class node_goal_ui,node_goal_api,node_goal_logic,node_chat_ui,node_chat_api,node_cv_api,node_roadmap_api,node_roadmap_tools,node_portfolio_api,node_portfolio_store toneAmber
class node_auth_api,node_auth_service,node_user_sessions,node_api_routes toneMint
class node_mentoring,node_admin_ui,node_admin_metrics toneRose
class node_redis,node_quotas,node_visitor_identity,node_budget,node_ai_provider,node_ui_primitives,node_metadata,node_site_config,node_structured_data,node_visitor toneIndigo
```

## Components

### Resource discovery

- [Web experience](https://github.com/yahyanaim/ai-hub/blob/main/app/page.tsx): `app/page.tsx`
- [Seed catalog](https://github.com/yahyanaim/ai-hub/blob/main/lib/seed/index.ts): `lib/seed/index.ts`
- [Catalog indexes](https://github.com/yahyanaim/ai-hub/blob/main/lib/server/index-tools.ts): `lib/server/index-tools.ts`
- [Catalog views](https://github.com/yahyanaim/ai-hub/blob/main/components/listing/ListingView.tsx): `components/listing/ListingView.tsx`
- [Catalog collections](https://github.com/yahyanaim/ai-hub/blob/main/lib/seed/courses.ts): `lib/seed/courses.ts`

### Career workflows

- [Goal finder](https://github.com/yahyanaim/ai-hub/blob/main/components/goal/GoalFinder.tsx): `components/goal/GoalFinder.tsx`
- [Goal matching](https://github.com/yahyanaim/ai-hub/blob/main/app/api/goal-match/route.ts): `app/api/goal-match/route.ts`
- [Goal matching logic](https://github.com/yahyanaim/ai-hub/blob/main/lib/goal-finder.ts): `lib/goal-finder.ts`
- [Career Advisor](https://github.com/yahyanaim/ai-hub/blob/main/app/chat/page.tsx): `app/chat/page.tsx`
- [Chat service](https://github.com/yahyanaim/ai-hub/blob/main/app/api/chat/route.ts): `app/api/chat/route.ts`
- [CV assistance](https://github.com/yahyanaim/ai-hub/blob/main/app/api/chat/cv/route.ts): `app/api/chat/cv/route.ts`
- [Learning calendars](https://github.com/yahyanaim/ai-hub/blob/main/app/api/roadmaps/generate/route.ts): `app/api/roadmaps/generate/route.ts`
- [Calendar tools](https://github.com/yahyanaim/ai-hub/blob/main/lib/roadmap/scheduler.ts): `lib/roadmap/scheduler.ts`
- [Portfolio publishing](https://github.com/yahyanaim/ai-hub/blob/main/app/api/portfolio/route.ts): `app/api/portfolio/route.ts`
- [Portfolio storage](https://github.com/yahyanaim/ai-hub/blob/main/lib/server/portfolio-storage.ts): `lib/server/portfolio-storage.ts`

### Accounts and services

- [Account workflows](https://github.com/yahyanaim/ai-hub/blob/main/app/api/auth/login/route.ts): `app/api/auth/login/route.ts`
- [Authentication](https://github.com/yahyanaim/ai-hub/blob/main/lib/server/auth.ts): `lib/server/auth.ts`
- [User sessions](https://github.com/yahyanaim/ai-hub/blob/main/lib/server/user-session.ts): `lib/server/user-session.ts`
- [API routes](https://github.com/yahyanaim/ai-hub/tree/main/app/api): `app/api`

### Mentoring and administration

- [Mentoring programs](https://github.com/yahyanaim/ai-hub/blob/main/app/api/mentoring/applications/route.ts): `app/api/mentoring/applications/route.ts`
- [Admin console](https://github.com/yahyanaim/ai-hub/blob/main/components/admin/AdminDashboardClient.tsx): `components/admin/AdminDashboardClient.tsx`
- [Usage metrics](https://github.com/yahyanaim/ai-hub/blob/main/lib/server/admin-metrics.ts): `lib/server/admin-metrics.ts`

### Shared foundations

- [Redis services](https://github.com/yahyanaim/ai-hub/blob/main/lib/server/redis.ts): `lib/server/redis.ts`
- [AI quotas](https://github.com/yahyanaim/ai-hub/blob/main/lib/server/quota.ts): `lib/server/quota.ts`
- [Visitor identity](https://github.com/yahyanaim/ai-hub/blob/main/lib/server/visitor.ts): `lib/server/visitor.ts`
- [Budget controls](https://github.com/yahyanaim/ai-hub/blob/main/lib/server/budget-config.ts): `lib/server/budget-config.ts`
- [NVIDIA inference](https://github.com/yahyanaim/ai-hub/blob/main/lib/server/nvidia-models.ts): `lib/server/nvidia-models.ts`
- [UI primitives](https://github.com/yahyanaim/ai-hub/blob/main/components/ui/FacetedGlyph.tsx): `components/ui/FacetedGlyph.tsx`
- [Metadata and SEO](https://github.com/yahyanaim/ai-hub/blob/main/lib/seo.ts): `lib/seo.ts`
- [Site configuration](https://github.com/yahyanaim/ai-hub/blob/main/lib/site.ts): `lib/site.ts`
- [Structured data](https://github.com/yahyanaim/ai-hub/blob/main/lib/json-ld.ts): `lib/json-ld.ts`

### Other components

- **Visitor**

## Connections

- Visitor → Web experience: browses
- Web experience → Catalog indexes: renders through (evidence: `app/page.tsx`)
- Catalog indexes → Seed catalog: reads
- Seed catalog → Catalog collections: includes (evidence: `lib/seed/index.ts`)
- Web experience → Catalog views: renders (evidence: `app/page.tsx`)
- Visitor → Goal finder: describes goal
- Goal finder → Goal matching: requests matches
- Goal matching → Goal matching logic: uses (evidence: `app/api/goal-match/route.ts`)
- Visitor → Career Advisor: starts conversation
- Career Advisor → Chat service: sends turns
- Chat service → User sessions: checks session (evidence: `app/api/chat/route.ts`)
- Chat service → NVIDIA inference: selects models (evidence: `app/api/chat/route.ts`)
- Career Advisor → CV assistance: requests CV help
- Career Advisor → Learning calendars: creates calendar
- Learning calendars → Calendar tools: schedules courses (evidence: `app/api/roadmaps/generate/route.ts`)
- Visitor → Portfolio publishing: publishes portfolio
- Portfolio publishing → Portfolio storage: stores artifact (evidence: `app/api/portfolio/route.ts`)
- Portfolio storage → Redis services: stores metadata (evidence: `lib/server/portfolio-storage.ts`)
- Visitor → Account workflows: creates account
- Account workflows → Authentication: authenticates
- Authentication → Redis services: checks revocation (evidence: `lib/server/auth.ts`)
- Visitor → Mentoring programs: applies to program
- Admin console → API routes: manages operations
- Admin console → Usage metrics: views metrics
- Usage metrics → Redis services: stores metrics (evidence: `lib/server/admin-metrics.ts`)
- Chat service → AI quotas: enforces limits (evidence: `app/api/chat/route.ts`)
- AI quotas → Budget controls: reads limits (evidence: `lib/server/quota.ts`)
- AI quotas → Visitor identity: keys visitor (evidence: `lib/server/quota.ts`)
- AI quotas → Redis services: coordinates limits (evidence: `lib/server/quota.ts`)
- Web experience → Metadata and SEO: sets metadata
- Web experience → Site configuration: uses canonical URL (evidence: `app/page.tsx`)
- Web experience → Structured data: embeds JSON-LD (evidence: `app/page.tsx`)
