# hemanthpallapothu/ai-powered-thumbnail-generator architecture

> Architecture diagram of the GitHub repository hemanthpallapothu/ai-powered-thumbnail-generator, 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/hemanthpallapothu/ai-powered-thumbnail-generator
- Repository: https://github.com/hemanthpallapothu/ai-powered-thumbnail-generator

## Overview

Thumblify is a creator-facing thumbnail generation and sharing app. Users authenticate, submit a new or recreate request with visual options, receive an AI-generated image, and can manage or share saved results. The backend also supports a public community feed and credit accounting. The README documents Groq prompt optimization and Pollinations image generation; sampled controller code confirms the generation sequence and Mongo-backed persistence. Page-to-API wiring is described at product level but not fully sampled, so uncertain client call details are omitted.

Main entry points: [`client/src/api/api.js`](https://github.com/hemanthpallapothu/ai-powered-thumbnail-generator/blob/main/client/src/api/api.js) (HTTP client), [`client/src/App.jsx`](https://github.com/hemanthpallapothu/ai-powered-thumbnail-generator/blob/main/client/src/App.jsx) (App routing), [`server/server.js`](https://github.com/hemanthpallapothu/ai-powered-thumbnail-generator/blob/main/server/server.js) (API server), [`server/controllers/aiController.js`](https://github.com/hemanthpallapothu/ai-powered-thumbnail-generator/blob/main/server/controllers/aiController.js) (Generation logic)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_client["Creator app"]
  node_webapp["App routing<br/>[App.jsx]"]
  node_authpage["Sign in / up<br/>[AuthPage.jsx]"]
  node_authstate["Auth session<br/>[AuthContext.jsx]"]
  node_studio["Generate studio<br/>[Generate.jsx]"]
  node_library["My generations<br/>[MyGenerations.jsx]"]
  node_community["Community feed<br/>[Community.jsx]"]
end

subgraph group_http["API and access"]
  node_api["HTTP client<br/>[api.js]"]
  node_server["API server<br/>[server.js]"]
  node_authroutes["Auth routes<br/>[authRoutes.js]"]
  node_thumb_routes["Thumbnail routes<br/>[thumbnailRoutes.js]"]
  node_airoutes["AI routes<br/>[aiRoutes.js]"]
  node_authguard["JWT guard<br/>[authMiddleware.js]"]
end

subgraph group_generation["Thumbnail generation"]
  node_generationlogic["Generation logic<br/>[aiController.js]"]
  node_helpers["Prompt and image helpers"]
end

subgraph group_persistence["Accounts and library"]
  node_authlogic["Account logic<br/>[authController.js]"]
  node_thumbnaillogic["Library and feed"]
  node_userdb[("User records<br/>[User.js]")]
  node_thumbdb[("Thumbnail records<br/>[Thumbnail.js]")]
end

node_creator(("Creator"))
node_mongo[("MongoDB")]
node_groq{{"Groq AI"}}
node_pollinations{{"Pollinations"}}

node_creator -->|"uses"| node_webapp
node_webapp -->|"routes to"| node_authpage
node_webapp -->|"routes to"| node_studio
node_webapp -->|"routes to"| node_library
node_webapp -->|"routes to"| node_community
node_authpage -->|"submits credentials"| node_api
node_authpage -->|"saves session"| node_authstate
node_authstate -->|"loads profile"| node_api
node_studio -->|"requests generation"| node_api
node_library -->|"requests library"| node_api
node_community -->|"requests feed"| node_api
node_api -->|"sends requests"| node_server
node_server -->|"dispatches"| node_authroutes
node_server -->|"dispatches"| node_airoutes
node_server -->|"dispatches"| node_thumb_routes
node_authroutes -->|"invokes"| node_authlogic
node_airoutes -->|"checks token"| node_authguard
node_airoutes -->|"invokes"| node_generationlogic
node_thumb_routes -->|"checks token"| node_authguard
node_thumb_routes -->|"invokes"| node_thumbnaillogic
node_authguard -->|"loads user"| node_userdb
node_authlogic -->|"reads and writes"| node_userdb
node_generationlogic -->|"optimizes and builds"| node_helpers
node_generationlogic -->|"creates thumbnail"| node_thumbdb
node_generationlogic -->|"deducts credit"| node_userdb
node_thumbnaillogic -->|"reads and updates"| node_thumbdb
node_helpers -.->|"optimizes prompt"| node_groq
node_helpers -.->|"builds image request"| node_pollinations
node_userdb -->|"persists"| node_mongo
node_thumbdb -->|"persists"| node_mongo

click node_webapp "https://github.com/hemanthpallapothu/ai-powered-thumbnail-generator/blob/main/client/src/App.jsx"
click node_authpage "https://github.com/hemanthpallapothu/ai-powered-thumbnail-generator/blob/main/client/src/pages/AuthPage.jsx"
click node_authstate "https://github.com/hemanthpallapothu/ai-powered-thumbnail-generator/blob/main/client/src/context/AuthContext.jsx"
click node_studio "https://github.com/hemanthpallapothu/ai-powered-thumbnail-generator/blob/main/client/src/pages/Generate.jsx"
click node_library "https://github.com/hemanthpallapothu/ai-powered-thumbnail-generator/blob/main/client/src/pages/MyGenerations.jsx"
click node_community "https://github.com/hemanthpallapothu/ai-powered-thumbnail-generator/blob/main/client/src/pages/Community.jsx"
click node_api "https://github.com/hemanthpallapothu/ai-powered-thumbnail-generator/blob/main/client/src/api/api.js"
click node_server "https://github.com/hemanthpallapothu/ai-powered-thumbnail-generator/blob/main/server/server.js"
click node_authroutes "https://github.com/hemanthpallapothu/ai-powered-thumbnail-generator/blob/main/server/routes/authRoutes.js"
click node_thumb_routes "https://github.com/hemanthpallapothu/ai-powered-thumbnail-generator/blob/main/server/routes/thumbnailRoutes.js"
click node_airoutes "https://github.com/hemanthpallapothu/ai-powered-thumbnail-generator/blob/main/server/routes/aiRoutes.js"
click node_authguard "https://github.com/hemanthpallapothu/ai-powered-thumbnail-generator/blob/main/server/middleware/authMiddleware.js"
click node_authlogic "https://github.com/hemanthpallapothu/ai-powered-thumbnail-generator/blob/main/server/controllers/authController.js"
click node_generationlogic "https://github.com/hemanthpallapothu/ai-powered-thumbnail-generator/blob/main/server/controllers/aiController.js"
click node_thumbnaillogic "https://github.com/hemanthpallapothu/ai-powered-thumbnail-generator/blob/main/server/controllers/thumbnailController.js"
click node_helpers "https://github.com/hemanthpallapothu/ai-powered-thumbnail-generator/blob/main/server/utils/thumbnailHelpers.js"
click node_userdb "https://github.com/hemanthpallapothu/ai-powered-thumbnail-generator/blob/main/server/models/User.js"
click node_thumbdb "https://github.com/hemanthpallapothu/ai-powered-thumbnail-generator/blob/main/server/models/Thumbnail.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_webapp,node_authpage,node_authstate,node_studio,node_library,node_community toneBlue
class node_api,node_server,node_authroutes,node_thumb_routes,node_airoutes,node_authguard,node_mongo toneAmber
class node_generationlogic,node_helpers toneMint
class node_authlogic,node_thumbnaillogic,node_userdb,node_thumbdb toneRose
class node_creator,node_groq,node_pollinations toneIndigo
```

## Components

### Creator app

- [App routing](https://github.com/hemanthpallapothu/ai-powered-thumbnail-generator/blob/main/client/src/App.jsx): `client/src/App.jsx`
- [Sign in / up](https://github.com/hemanthpallapothu/ai-powered-thumbnail-generator/blob/main/client/src/pages/AuthPage.jsx): `client/src/pages/AuthPage.jsx`
- [Auth session](https://github.com/hemanthpallapothu/ai-powered-thumbnail-generator/blob/main/client/src/context/AuthContext.jsx): `client/src/context/AuthContext.jsx`
- [Generate studio](https://github.com/hemanthpallapothu/ai-powered-thumbnail-generator/blob/main/client/src/pages/Generate.jsx): `client/src/pages/Generate.jsx`
- [My generations](https://github.com/hemanthpallapothu/ai-powered-thumbnail-generator/blob/main/client/src/pages/MyGenerations.jsx): `client/src/pages/MyGenerations.jsx`
- [Community feed](https://github.com/hemanthpallapothu/ai-powered-thumbnail-generator/blob/main/client/src/pages/Community.jsx): `client/src/pages/Community.jsx`

### API and access

- [HTTP client](https://github.com/hemanthpallapothu/ai-powered-thumbnail-generator/blob/main/client/src/api/api.js): `client/src/api/api.js`
- [API server](https://github.com/hemanthpallapothu/ai-powered-thumbnail-generator/blob/main/server/server.js): `server/server.js`
- [Auth routes](https://github.com/hemanthpallapothu/ai-powered-thumbnail-generator/blob/main/server/routes/authRoutes.js): `server/routes/authRoutes.js`
- [Thumbnail routes](https://github.com/hemanthpallapothu/ai-powered-thumbnail-generator/blob/main/server/routes/thumbnailRoutes.js): `server/routes/thumbnailRoutes.js`
- [AI routes](https://github.com/hemanthpallapothu/ai-powered-thumbnail-generator/blob/main/server/routes/aiRoutes.js): `server/routes/aiRoutes.js`
- [JWT guard](https://github.com/hemanthpallapothu/ai-powered-thumbnail-generator/blob/main/server/middleware/authMiddleware.js): `server/middleware/authMiddleware.js`

### Thumbnail generation

- [Generation logic](https://github.com/hemanthpallapothu/ai-powered-thumbnail-generator/blob/main/server/controllers/aiController.js): `server/controllers/aiController.js`
- [Prompt and image helpers](https://github.com/hemanthpallapothu/ai-powered-thumbnail-generator/blob/main/server/utils/thumbnailHelpers.js): `server/utils/thumbnailHelpers.js`

### Accounts and library

- [Account logic](https://github.com/hemanthpallapothu/ai-powered-thumbnail-generator/blob/main/server/controllers/authController.js): `server/controllers/authController.js`
- [Library and feed](https://github.com/hemanthpallapothu/ai-powered-thumbnail-generator/blob/main/server/controllers/thumbnailController.js): `server/controllers/thumbnailController.js`
- [User records](https://github.com/hemanthpallapothu/ai-powered-thumbnail-generator/blob/main/server/models/User.js): `server/models/User.js`
- [Thumbnail records](https://github.com/hemanthpallapothu/ai-powered-thumbnail-generator/blob/main/server/models/Thumbnail.js): `server/models/Thumbnail.js`

### Other components

- **Creator**
- **MongoDB**
- **Groq AI**
- **Pollinations**

## Connections

- Creator → App routing: uses
- App routing → Sign in / up: routes to
- App routing → Generate studio: routes to
- App routing → My generations: routes to
- App routing → Community feed: routes to
- Sign in / up → HTTP client: submits credentials
- Sign in / up → Auth session: saves session
- Auth session → HTTP client: loads profile
- Generate studio → HTTP client: requests generation
- My generations → HTTP client: requests library
- Community feed → HTTP client: requests feed
- HTTP client → API server: sends requests
- API server → Auth routes: dispatches
- API server → AI routes: dispatches
- API server → Thumbnail routes: dispatches
- Auth routes → Account logic: invokes
- AI routes → JWT guard: checks token
- AI routes → Generation logic: invokes
- Thumbnail routes → JWT guard: checks token
- Thumbnail routes → Library and feed: invokes
- JWT guard → User records: loads user
- Account logic → User records: reads and writes
- Generation logic → Prompt and image helpers: optimizes and builds
- Generation logic → Thumbnail records: creates thumbnail
- Generation logic → User records: deducts credit
- Library and feed → Thumbnail records: reads and updates
- Prompt and image helpers → Groq AI: optimizes prompt
- Prompt and image helpers → Pollinations: builds image request
- User records → MongoDB: persists
- Thumbnail records → MongoDB: persists
