# kanlka/creatormind architecture

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

- Interactive diagram: https://gitdiagram.com/kanlka/creatormind
- Repository: https://github.com/kanlka/creatormind

## Overview

CreatorMind is a YouTube creator analytics and content-planning application. Creators connect a channel, review performance and audience insights, and use those signals to develop video ideas; the product also offers brand-collaboration analysis and scheduled email features. The tree and sampled files establish these capability areas, but the README provides no architectural detail, and most route and integration implementations were not sampled. Dashed, uncited edges indicate likely entry points or subsystem links that could not be verified from the available evidence.

Main entry points: [`workers/index.ts`](https://github.com/kanlka/creatormind/blob/main/workers/index.ts) (Email worker), [`app/api`](https://github.com/kanlka/creatormind/tree/main/app/api) (Analytics endpoints), [`app/api/auth/[...nextauth]/route.ts`](https://github.com/kanlka/creatormind/blob/main/app/api/auth/%5B...nextauth%5D/route.ts) (Authentication), [`app/api/brand-collaboration/route.ts`](https://github.com/kanlka/creatormind/blob/main/app/api/brand-collaboration/route.ts) (Brand collaboration)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_experience["Creator experience"]
  node_dashboard["Dashboard<br/>[page.tsx]"]
  node_ideas_ui["Ideas pages"]
  node_insights_ui["Insights pages<br/>[page.tsx]"]
  node_performance_ui["Performance page<br/>[page.tsx]"]
  node_videos_ui["Video details<br/>[page.tsx]"]
end

subgraph group_api["Application API"]
  node_auth_api["Authentication<br/>[route.ts]"]
  node_youtube_api["YouTube endpoints"]
  node_analytics_api["Analytics endpoints"]
  node_ideas_api["Ideas endpoints"]
  node_collab_api["Brand collaboration<br/>[route.ts]"]
end

subgraph group_youtube["YouTube analysis"]
  node_sync["YouTube sync<br/>[sync.ts]"]
  node_fetcher["YouTube fetcher<br/>[fetcher.ts]"]
  node_transcript["Transcript processing<br/>[transcript.ts]"]
  node_pattern["Pattern analysis"]
end

subgraph group_content["Ideas and insights"]
  node_idea_generation["Idea generation<br/>[idea-generator.ts]"]
  node_insight_generation["Insight generation"]
  node_geo["Content recommendations"]
end

subgraph group_platform["Data and delivery"]
  node_worker["Email worker<br/>[index.ts]"]
  node_email_sender["Email delivery<br/>[sender.ts]"]
  node_database[("MongoDB<br/>[mongodb.ts]")]
  node_redis["Redis queue<br/>[queue.ts]"]
  node_user_model[("User records<br/>[User.ts]")]
  node_video_model[("Video records<br/>[Video.ts]")]
  node_ideas_model[("Generated ideas<br/>[GeneratedIdea.ts]")]
end

node_creator(("Creator"))
node_google["Google OAuth"]

node_creator -.->|"views"| node_dashboard
node_creator -.->|"signs in"| node_auth_api
node_dashboard -.->|"connects channel"| node_youtube_api
node_dashboard -.->|"requests analytics"| node_analytics_api
node_dashboard -.->|"requests ideas"| node_ideas_api
node_creator -.->|"reviews ideas"| node_ideas_ui
node_creator -.->|"reviews insights"| node_insights_ui
node_creator -.->|"reviews performance"| node_performance_ui
node_creator -.->|"reviews videos"| node_videos_ui
node_auth_api -->|"authenticates with"| node_google
node_auth_api -->|"imports client"| node_database
node_youtube_api -.->|"dispatches sync"| node_sync
node_sync -.->|"fetches channel data"| node_fetcher
node_sync -.->|"processes transcripts"| node_transcript
node_sync -.->|"updates records"| node_video_model
node_analytics_api -->|"checks session"| node_auth_api
node_analytics_api -->|"connects"| node_database
node_analytics_api -->|"queries user"| node_user_model
node_analytics_api -->|"queries videos"| node_video_model
node_ideas_api -.->|"generates ideas"| node_idea_generation
node_idea_generation -.->|"stores ideas"| node_ideas_model
node_insights_ui -->|"uses recommendations"| node_geo
node_ideas_ui -->|"uses recommendations"| node_geo
node_collab_api -->|"checks session"| node_auth_api
node_collab_api -->|"connects"| node_database
node_collab_api -->|"queries user"| node_user_model
node_collab_api -->|"analyzes videos"| node_video_model
node_worker -->|"sends emails"| node_email_sender
node_worker -->|"generates ideas"| node_idea_generation
node_worker -->|"generates insights"| node_insight_generation
node_worker -->|"connects"| node_database
node_worker -->|"queries users"| node_user_model
node_worker -->|"loads ideas"| node_ideas_model
node_worker -.->|"queues jobs"| node_redis

click node_dashboard "https://github.com/kanlka/creatormind/blob/main/app/dashboard/page.tsx"
click node_ideas_ui "https://github.com/kanlka/creatormind/tree/main/app/ideas"
click node_insights_ui "https://github.com/kanlka/creatormind/blob/main/app/insights/page.tsx"
click node_performance_ui "https://github.com/kanlka/creatormind/blob/main/app/performance/page.tsx"
click node_videos_ui "https://github.com/kanlka/creatormind/blob/main/app/videos/%5BvideoId%5D/page.tsx"
click node_auth_api "https://github.com/kanlka/creatormind/blob/main/app/api/auth/%5B...nextauth%5D/route.ts"
click node_youtube_api "https://github.com/kanlka/creatormind/tree/main/app/api/youtube"
click node_analytics_api "https://github.com/kanlka/creatormind/tree/main/app/api"
click node_ideas_api "https://github.com/kanlka/creatormind/tree/main/app/api/ideas"
click node_collab_api "https://github.com/kanlka/creatormind/blob/main/app/api/brand-collaboration/route.ts"
click node_sync "https://github.com/kanlka/creatormind/blob/main/lib/youtube/sync.ts"
click node_fetcher "https://github.com/kanlka/creatormind/blob/main/lib/youtube/fetcher.ts"
click node_transcript "https://github.com/kanlka/creatormind/blob/main/lib/youtube/transcript.ts"
click node_pattern "https://github.com/kanlka/creatormind/blob/main/lib/ai/pattern-analyzer.ts"
click node_idea_generation "https://github.com/kanlka/creatormind/blob/main/lib/ai/idea-generator.ts"
click node_insight_generation "https://github.com/kanlka/creatormind/blob/main/lib/ai/insights-generator.ts"
click node_geo "https://github.com/kanlka/creatormind/tree/main/lib/content"
click node_worker "https://github.com/kanlka/creatormind/blob/main/workers/index.ts"
click node_email_sender "https://github.com/kanlka/creatormind/blob/main/lib/email/sender.ts"
click node_database "https://github.com/kanlka/creatormind/blob/main/lib/db/mongodb.ts"
click node_redis "https://github.com/kanlka/creatormind/blob/main/lib/jobs/queue.ts"
click node_user_model "https://github.com/kanlka/creatormind/blob/main/models/User.ts"
click node_video_model "https://github.com/kanlka/creatormind/blob/main/models/Video.ts"
click node_ideas_model "https://github.com/kanlka/creatormind/blob/main/models/GeneratedIdea.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_dashboard,node_ideas_ui,node_insights_ui,node_performance_ui,node_videos_ui toneBlue
class node_auth_api,node_youtube_api,node_analytics_api,node_ideas_api,node_collab_api toneAmber
class node_sync,node_fetcher,node_transcript,node_pattern toneMint
class node_idea_generation,node_insight_generation,node_geo toneRose
class node_worker,node_email_sender,node_database,node_redis,node_user_model,node_video_model,node_ideas_model,node_creator,node_google toneIndigo
```

## Components

### Creator experience

- [Dashboard](https://github.com/kanlka/creatormind/blob/main/app/dashboard/page.tsx): `app/dashboard/page.tsx`
- [Ideas pages](https://github.com/kanlka/creatormind/tree/main/app/ideas): `app/ideas`
- [Insights pages](https://github.com/kanlka/creatormind/blob/main/app/insights/page.tsx): `app/insights/page.tsx`
- [Performance page](https://github.com/kanlka/creatormind/blob/main/app/performance/page.tsx): `app/performance/page.tsx`
- [Video details](https://github.com/kanlka/creatormind/blob/main/app/videos/%5BvideoId%5D/page.tsx): `app/videos/[videoId]/page.tsx`

### Application API

- [Authentication](https://github.com/kanlka/creatormind/blob/main/app/api/auth/%5B...nextauth%5D/route.ts): `app/api/auth/[...nextauth]/route.ts`
- [YouTube endpoints](https://github.com/kanlka/creatormind/tree/main/app/api/youtube): `app/api/youtube`
- [Analytics endpoints](https://github.com/kanlka/creatormind/tree/main/app/api): `app/api`
- [Ideas endpoints](https://github.com/kanlka/creatormind/tree/main/app/api/ideas): `app/api/ideas`
- [Brand collaboration](https://github.com/kanlka/creatormind/blob/main/app/api/brand-collaboration/route.ts): `app/api/brand-collaboration/route.ts`

### YouTube analysis

- [YouTube sync](https://github.com/kanlka/creatormind/blob/main/lib/youtube/sync.ts): `lib/youtube/sync.ts`
- [YouTube fetcher](https://github.com/kanlka/creatormind/blob/main/lib/youtube/fetcher.ts): `lib/youtube/fetcher.ts`
- [Transcript processing](https://github.com/kanlka/creatormind/blob/main/lib/youtube/transcript.ts): `lib/youtube/transcript.ts`
- [Pattern analysis](https://github.com/kanlka/creatormind/blob/main/lib/ai/pattern-analyzer.ts): `lib/ai/pattern-analyzer.ts`

### Ideas and insights

- [Idea generation](https://github.com/kanlka/creatormind/blob/main/lib/ai/idea-generator.ts): `lib/ai/idea-generator.ts`
- [Insight generation](https://github.com/kanlka/creatormind/blob/main/lib/ai/insights-generator.ts): `lib/ai/insights-generator.ts`
- [Content recommendations](https://github.com/kanlka/creatormind/tree/main/lib/content): `lib/content`

### Data and delivery

- [Email worker](https://github.com/kanlka/creatormind/blob/main/workers/index.ts): `workers/index.ts`
- [Email delivery](https://github.com/kanlka/creatormind/blob/main/lib/email/sender.ts): `lib/email/sender.ts`
- [MongoDB](https://github.com/kanlka/creatormind/blob/main/lib/db/mongodb.ts): `lib/db/mongodb.ts`
- [Redis queue](https://github.com/kanlka/creatormind/blob/main/lib/jobs/queue.ts): `lib/jobs/queue.ts`
- [User records](https://github.com/kanlka/creatormind/blob/main/models/User.ts): `models/User.ts`
- [Video records](https://github.com/kanlka/creatormind/blob/main/models/Video.ts): `models/Video.ts`
- [Generated ideas](https://github.com/kanlka/creatormind/blob/main/models/GeneratedIdea.ts): `models/GeneratedIdea.ts`

### Other components

- **Creator**
- **Google OAuth**

## Connections

- Creator → Dashboard: views
- Creator → Authentication: signs in
- Dashboard → YouTube endpoints: connects channel
- Dashboard → Analytics endpoints: requests analytics
- Dashboard → Ideas endpoints: requests ideas
- Creator → Ideas pages: reviews ideas
- Creator → Insights pages: reviews insights
- Creator → Performance page: reviews performance
- Creator → Video details: reviews videos
- Authentication → Google OAuth: authenticates with (evidence: `app/api/auth/[...nextauth]/route.ts`)
- Authentication → MongoDB: imports client (evidence: `app/api/auth/[...nextauth]/route.ts`)
- YouTube endpoints → YouTube sync: dispatches sync
- YouTube sync → YouTube fetcher: fetches channel data
- YouTube sync → Transcript processing: processes transcripts
- YouTube sync → Video records: updates records
- Analytics endpoints → Authentication: checks session (evidence: `app/api/engagement-timeline/route.ts`)
- Analytics endpoints → MongoDB: connects (evidence: `app/api/engagement-timeline/route.ts`)
- Analytics endpoints → User records: queries user (evidence: `app/api/engagement-timeline/route.ts`)
- Analytics endpoints → Video records: queries videos (evidence: `app/api/engagement-timeline/route.ts`)
- Ideas endpoints → Idea generation: generates ideas
- Idea generation → Generated ideas: stores ideas
- Insights pages → Content recommendations: uses recommendations (evidence: `app/insights/page.tsx`)
- Ideas pages → Content recommendations: uses recommendations (evidence: `app/ideas/[id]/page.tsx`)
- Brand collaboration → Authentication: checks session (evidence: `app/api/brand-collaboration/route.ts`)
- Brand collaboration → MongoDB: connects (evidence: `app/api/brand-collaboration/route.ts`)
- Brand collaboration → User records: queries user (evidence: `app/api/brand-collaboration/route.ts`)
- Brand collaboration → Video records: analyzes videos (evidence: `app/api/brand-collaboration/route.ts`)
- Email worker → Email delivery: sends emails (evidence: `workers/index.ts`)
- Email worker → Idea generation: generates ideas (evidence: `workers/index.ts`)
- Email worker → Insight generation: generates insights (evidence: `workers/index.ts`)
- Email worker → MongoDB: connects (evidence: `workers/index.ts`)
- Email worker → User records: queries users (evidence: `workers/index.ts`)
- Email worker → Generated ideas: loads ideas (evidence: `workers/index.ts`)
- Email worker → Redis queue: queues jobs
