# legiahuy/csc13010-thinksage-ai architecture

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

- Interactive diagram: https://gitdiagram.com/legiahuy/csc13010-thinksage-ai
- Repository: https://github.com/legiahuy/csc13010-thinksage-ai

## Overview

ThinkSage AI turns scientific topics into editable educational videos, then stores, renders, manages, and optionally publishes them. The documented workflow collects scientific sources, summarizes and scripts content, generates scene imagery and speech/captions, and renders synchronized video; the interface also supports manual editing, previews, recording, analytics, and YouTube publishing. The sampled source confirms crawler dispatch, image-preview event dispatch, Inngest processing, Convex updates, and Remotion composition. Several UI and API implementations were not sampled, so their documented connections are cited to the README or left unverified.

Main entry points: [`frontend/app/(main)/create-new-video/page.jsx`](https://github.com/legiahuy/csc13010-thinksage-ai/blob/main/frontend/app/(main)/create-new-video/page.jsx) (Video editor), [`frontend/inngest/function.js`](https://github.com/legiahuy/csc13010-thinksage-ai/blob/main/frontend/inngest/function.js) (Media job functions), [`frontend/convex/videoData.js`](https://github.com/legiahuy/csc13010-thinksage-ai/blob/main/frontend/convex/videoData.js) (Video records), [`frontend/app/(main)/dashboard/page.jsx`](https://github.com/legiahuy/csc13010-thinksage-ai/blob/main/frontend/app/(main)/dashboard/page.jsx) (Video dashboard)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_creation["Content creation"]
  node_creation_ui["Video editor<br/>[page.jsx]"]
  node_research_api["Research endpoint<br/>[route.jsx]"]
  node_crawler_api["Crawler service<br/>[server.py]"]
  node_science_crawler["Science crawler<br/>[main.py]"]
  node_script_api["Script endpoint<br/>[route.jsx]"]
  node_ai_models["AI models<br/>[AiModel.jsx]"]
end

subgraph group_production["Media production"]
  node_image_preview_api["Image preview API<br/>[route.jsx]"]
  node_job_events["Job event client<br/>[client.js]"]
  node_job_functions["Media job functions<br/>[function.js]"]
  node_inngest_service["Inngest"]
  node_render_composition["Video composition"]
  node_remotion_root["Remotion entry<br/>[Root.jsx]"]
end

subgraph group_platform["Application platform"]
  node_video_data[("Video records<br/>[videoData.js]")]
  node_user_data[("User records<br/>[users.js]")]
  node_convex_schema["Data schema<br/>[schema.js]"]
  node_dashboard["Video dashboard<br/>[page.jsx]"]
  node_video_management["Video management<br/>[page.jsx]"]
  node_playback["Video playback<br/>[page.jsx]"]
end

subgraph group_publishing["Publishing and insights"]
  node_youtube_auth["YouTube OAuth<br/>[route.js]"]
  node_youtube_publish["YouTube publishing<br/>[route.js]"]
  node_youtube_stats["YouTube analytics<br/>[route.js]"]
  node_youtube(("YouTube"))
end

node_creator(("Creator"))

node_creator -->|"edits content"| node_creation_ui
node_creation_ui -.->|"requests research"| node_research_api
node_research_api -.->|"requests crawl"| node_crawler_api
node_crawler_api -->|"calls crawl_topic"| node_science_crawler
node_creation_ui -.->|"requests script"| node_script_api
node_script_api -.->|"generates script"| node_ai_models
node_creation_ui -->|"requests previews"| node_image_preview_api
node_image_preview_api -->|"sends event"| node_job_events
node_job_events -->|"dispatches jobs"| node_inngest_service
node_inngest_service -->|"runs functions"| node_job_functions
node_job_functions -->|"generates prompts"| node_ai_models
node_job_functions -->|"updates records"| node_video_data
node_job_functions -->|"renders video"| node_remotion_root
node_remotion_root -->|"composes scenes"| node_render_composition
node_creation_ui -.->|"saves video"| node_video_data
node_dashboard -.->|"tracks status"| node_video_data
node_video_management -.->|"manages videos"| node_video_data
node_playback -.->|"previews video"| node_render_composition
node_creator -.->|"authorizes account"| node_youtube_auth
node_creator -.->|"publishes video"| node_youtube_publish
node_youtube_publish -.->|"uploads video"| node_youtube
node_youtube_stats -.->|"fetches statistics"| node_youtube
node_dashboard -.->|"shows analytics"| node_youtube_stats

click node_creation_ui "https://github.com/legiahuy/csc13010-thinksage-ai/blob/main/frontend/app/(main)/create-new-video/page.jsx"
click node_research_api "https://github.com/legiahuy/csc13010-thinksage-ai/blob/main/frontend/app/api/crawl-and-summarize/route.jsx"
click node_crawler_api "https://github.com/legiahuy/csc13010-thinksage-ai/blob/main/crawler/server.py"
click node_science_crawler "https://github.com/legiahuy/csc13010-thinksage-ai/blob/main/crawler/main.py"
click node_script_api "https://github.com/legiahuy/csc13010-thinksage-ai/blob/main/frontend/app/api/generate-script/route.jsx"
click node_ai_models "https://github.com/legiahuy/csc13010-thinksage-ai/blob/main/frontend/configs/AiModel.jsx"
click node_image_preview_api "https://github.com/legiahuy/csc13010-thinksage-ai/blob/main/frontend/app/api/preview-images/route.jsx"
click node_job_events "https://github.com/legiahuy/csc13010-thinksage-ai/blob/main/frontend/inngest/client.js"
click node_job_functions "https://github.com/legiahuy/csc13010-thinksage-ai/blob/main/frontend/inngest/function.js"
click node_render_composition "https://github.com/legiahuy/csc13010-thinksage-ai/blob/main/frontend/app/_components/RemotionComposition.jsx"
click node_remotion_root "https://github.com/legiahuy/csc13010-thinksage-ai/blob/main/frontend/remotion/Root.jsx"
click node_video_data "https://github.com/legiahuy/csc13010-thinksage-ai/blob/main/frontend/convex/videoData.js"
click node_user_data "https://github.com/legiahuy/csc13010-thinksage-ai/blob/main/frontend/convex/users.js"
click node_convex_schema "https://github.com/legiahuy/csc13010-thinksage-ai/blob/main/frontend/convex/schema.js"
click node_dashboard "https://github.com/legiahuy/csc13010-thinksage-ai/blob/main/frontend/app/(main)/dashboard/page.jsx"
click node_video_management "https://github.com/legiahuy/csc13010-thinksage-ai/blob/main/frontend/app/(main)/manage-videos/page.jsx"
click node_playback "https://github.com/legiahuy/csc13010-thinksage-ai/blob/main/frontend/app/(main)/play-video/%5BvideoId%5D/page.jsx"
click node_youtube_auth "https://github.com/legiahuy/csc13010-thinksage-ai/blob/main/frontend/app/api/auth/google/route.js"
click node_youtube_publish "https://github.com/legiahuy/csc13010-thinksage-ai/blob/main/frontend/app/api/youtube-upload/route.js"
click node_youtube_stats "https://github.com/legiahuy/csc13010-thinksage-ai/blob/main/frontend/app/api/youtube-stats/route.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_creation_ui,node_research_api,node_crawler_api,node_science_crawler,node_script_api,node_ai_models toneBlue
class node_image_preview_api,node_job_events,node_job_functions,node_inngest_service,node_render_composition,node_remotion_root toneAmber
class node_video_data,node_user_data,node_convex_schema,node_dashboard,node_video_management,node_playback toneMint
class node_youtube_auth,node_youtube_publish,node_youtube_stats,node_youtube toneRose
class node_creator toneIndigo
```

## Components

### Content creation

- [Video editor](https://github.com/legiahuy/csc13010-thinksage-ai/blob/main/frontend/app/(main)/create-new-video/page.jsx): `frontend/app/(main)/create-new-video/page.jsx`
- [Research endpoint](https://github.com/legiahuy/csc13010-thinksage-ai/blob/main/frontend/app/api/crawl-and-summarize/route.jsx): `frontend/app/api/crawl-and-summarize/route.jsx`
- [Crawler service](https://github.com/legiahuy/csc13010-thinksage-ai/blob/main/crawler/server.py): `crawler/server.py`
- [Science crawler](https://github.com/legiahuy/csc13010-thinksage-ai/blob/main/crawler/main.py): `crawler/main.py`
- [Script endpoint](https://github.com/legiahuy/csc13010-thinksage-ai/blob/main/frontend/app/api/generate-script/route.jsx): `frontend/app/api/generate-script/route.jsx`
- [AI models](https://github.com/legiahuy/csc13010-thinksage-ai/blob/main/frontend/configs/AiModel.jsx): `frontend/configs/AiModel.jsx`

### Media production

- [Image preview API](https://github.com/legiahuy/csc13010-thinksage-ai/blob/main/frontend/app/api/preview-images/route.jsx): `frontend/app/api/preview-images/route.jsx`
- [Job event client](https://github.com/legiahuy/csc13010-thinksage-ai/blob/main/frontend/inngest/client.js): `frontend/inngest/client.js`
- [Media job functions](https://github.com/legiahuy/csc13010-thinksage-ai/blob/main/frontend/inngest/function.js): `frontend/inngest/function.js`
- **Inngest**
- [Video composition](https://github.com/legiahuy/csc13010-thinksage-ai/blob/main/frontend/app/_components/RemotionComposition.jsx): `frontend/app/_components/RemotionComposition.jsx`
- [Remotion entry](https://github.com/legiahuy/csc13010-thinksage-ai/blob/main/frontend/remotion/Root.jsx): `frontend/remotion/Root.jsx`

### Application platform

- [Video records](https://github.com/legiahuy/csc13010-thinksage-ai/blob/main/frontend/convex/videoData.js): `frontend/convex/videoData.js`
- [User records](https://github.com/legiahuy/csc13010-thinksage-ai/blob/main/frontend/convex/users.js): `frontend/convex/users.js`
- [Data schema](https://github.com/legiahuy/csc13010-thinksage-ai/blob/main/frontend/convex/schema.js): `frontend/convex/schema.js`
- [Video dashboard](https://github.com/legiahuy/csc13010-thinksage-ai/blob/main/frontend/app/(main)/dashboard/page.jsx): `frontend/app/(main)/dashboard/page.jsx`
- [Video management](https://github.com/legiahuy/csc13010-thinksage-ai/blob/main/frontend/app/(main)/manage-videos/page.jsx): `frontend/app/(main)/manage-videos/page.jsx`
- [Video playback](https://github.com/legiahuy/csc13010-thinksage-ai/blob/main/frontend/app/(main)/play-video/%5BvideoId%5D/page.jsx): `frontend/app/(main)/play-video/[videoId]/page.jsx`

### Publishing and insights

- [YouTube OAuth](https://github.com/legiahuy/csc13010-thinksage-ai/blob/main/frontend/app/api/auth/google/route.js): `frontend/app/api/auth/google/route.js`
- [YouTube publishing](https://github.com/legiahuy/csc13010-thinksage-ai/blob/main/frontend/app/api/youtube-upload/route.js): `frontend/app/api/youtube-upload/route.js`
- [YouTube analytics](https://github.com/legiahuy/csc13010-thinksage-ai/blob/main/frontend/app/api/youtube-stats/route.js): `frontend/app/api/youtube-stats/route.js`
- **YouTube**

### Other components

- **Creator**

## Connections

- Creator → Video editor: edits content (evidence: `README.md`)
- Video editor → Research endpoint: requests research
- Research endpoint → Crawler service: requests crawl
- Crawler service → Science crawler: calls crawl_topic (evidence: `crawler/server.py`)
- Video editor → Script endpoint: requests script
- Script endpoint → AI models: generates script (evidence: `README.md`)
- Video editor → Image preview API: requests previews (evidence: `frontend/app/api/preview-images/route.jsx`)
- Image preview API → Job event client: sends event (evidence: `frontend/app/api/preview-images/route.jsx`)
- Job event client → Inngest: dispatches jobs (evidence: `frontend/inngest/client.js`)
- Inngest → Media job functions: runs functions
- Media job functions → AI models: generates prompts (evidence: `frontend/inngest/function.js`)
- Media job functions → Video records: updates records (evidence: `frontend/inngest/function.js`)
- Media job functions → Remotion entry: renders video (evidence: `frontend/inngest/function.js`)
- Remotion entry → Video composition: composes scenes (evidence: `frontend/remotion/Root.jsx`)
- Video editor → Video records: saves video (evidence: `README.md`)
- Video dashboard → Video records: tracks status (evidence: `README.md`)
- Video management → Video records: manages videos (evidence: `README.md`)
- Video playback → Video composition: previews video (evidence: `README.md`)
- Creator → YouTube OAuth: authorizes account (evidence: `README.md`)
- Creator → YouTube publishing: publishes video (evidence: `README.md`)
- YouTube publishing → YouTube: uploads video (evidence: `README.md`)
- YouTube analytics → YouTube: fetches statistics (evidence: `README.md`)
- Video dashboard → YouTube analytics: shows analytics (evidence: `README.md`)
