# shubhrajyoti65/drishya architecture

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

- Interactive diagram: https://gitdiagram.com/shubhrajyoti65/drishya
- Repository: https://github.com/shubhrajyoti65/drishya

## Overview

Drishya is a video-sharing and creator platform. The main journey runs from account and channel setup through video publishing, discovery and viewing, with community participation and paid memberships alongside it; creator tools add AI-generated titles, ideas and thumbnail concepts. The React client talks to an Express API backed by MongoDB and Cloudinary, and to a FastAPI AI service using retrieval and generative models. The README documents major capabilities, but many frontend and backend handlers were not sampled, so some feature links are documented rather than source-verified.

Main entry points: [`frontend/src/App.jsx`](https://github.com/shubhrajyoti65/drishya/blob/main/frontend/src/App.jsx) (App routing), [`frontend/src/services/api.js`](https://github.com/shubhrajyoti65/drishya/blob/main/frontend/src/services/api.js) (API clients), [`backend/controllers/video.controller.js`](https://github.com/shubhrajyoti65/drishya/blob/main/backend/controllers/video.controller.js) (Video endpoints), [`backend/controllers/payment.controller.js`](https://github.com/shubhrajyoti65/drishya/blob/main/backend/controllers/payment.controller.js) (Membership and payments)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_client["Creator and viewer app"]
  node_webapp["App routing<br/>[App.jsx]"]
  node_accounts["Accounts and profiles"]
  node_watch["Video discovery and watch<br/>[Watch.jsx]"]
  node_upload["Video publishing<br/>[Upload.jsx]"]
  node_communityui["Community and polls<br/>[CommunityTab.jsx]"]
  node_tierui["Creator tier setup"]
  node_memberui["Membership management<br/>[MyMemberships.jsx]"]
  node_generatorui["AI creator tools"]
  node_clientapi["API clients<br/>[api.js]"]
  node_authstate["Authentication state<br/>[authStore.js]"]
end

subgraph group_media["Video and community"]
  node_videoapi["Video endpoints"]
  node_communityapi["Community endpoints"]
  node_videostore[("Video records<br/>[video.model.js]")]
  node_communitydata[("Community records<br/>[tweet.model.js]")]
end

subgraph group_commerce["Membership and payments"]
  node_membershipapi["Membership and payments"]
  node_memberdata[("Membership records")]
  node_tierdata[("Tier records")]
  node_razorpay["Razorpay checkout"]
end

subgraph group_platform["API and persistence"]
  node_express["Express API routing<br/>[app.js]"]
  node_identityapi["Identity endpoints<br/>[user.controller.js]"]
  node_authmw["JWT authorization<br/>[auth.middleware.js]"]
  node_userstore[("User records<br/>[user.model.js]")]
  node_cloudinary[("Cloudinary media storage")]
end

subgraph group_ai["AI creator tools"]
  node_aiclient["AI API client<br/>[aiApi.js]"]
  node_airoutes["Generation endpoints"]
  node_rag["Retrieval and generation<br/>[rag_service.py]"]
  node_gemini["Gemini models<br/>[gemini_service.py]"]
  node_fal["Thumbnail image fallback<br/>[fal_service.py]"]
end

node_viewer(("Creators and viewers"))

node_viewer -->|"uses"| node_webapp
node_webapp -->|"routes to"| node_accounts
node_webapp -->|"routes to"| node_watch
node_webapp -->|"routes to"| node_upload
node_webapp -.->|"routes to"| node_communityui
node_webapp -->|"routes to"| node_tierui
node_webapp -->|"routes to"| node_memberui
node_webapp -->|"routes to"| node_generatorui
node_accounts -->|"updates"| node_authstate
node_accounts -->|"calls"| node_clientapi
node_watch -.->|"requests data"| node_clientapi
node_upload -.->|"uploads video"| node_clientapi
node_communityui -.->|"manages polls"| node_clientapi
node_tierui -.->|"configures tiers"| node_clientapi
node_memberui -.->|"requests membership"| node_clientapi
node_generatorui -.->|"requests generation"| node_aiclient
node_clientapi -.->|"calls API"| node_express
node_aiclient -.->|"calls AI API"| node_airoutes
node_express -->|"routes video"| node_videoapi
node_express -->|"routes tweets"| node_communityapi
node_express -->|"routes payments"| node_membershipapi
node_express -->|"routes users"| node_identityapi
node_videoapi -->|"reads and writes"| node_videostore
node_videoapi -->|"checks owner"| node_userstore
node_videoapi -->|"checks access"| node_memberdata
node_videoapi -->|"checks tier"| node_tierdata
node_videoapi -->|"uploads media"| node_cloudinary
node_communityapi -->|"reads and writes"| node_communitydata
node_communityapi -->|"reads authors"| node_userstore
node_membershipapi -->|"activates membership"| node_memberdata
node_membershipapi -->|"reads tier"| node_tierdata
node_membershipapi -->|"reads subscriber"| node_userstore
node_identityapi -->|"manages accounts"| node_userstore
node_authmw -->|"loads identity"| node_userstore
node_membershipapi -.->|"verifies payment"| node_razorpay
node_airoutes -->|"dispatches generation"| node_rag
node_rag -.->|"generates content"| node_gemini
node_airoutes -->|"optional image fallback"| node_fal

click node_webapp "https://github.com/shubhrajyoti65/drishya/blob/main/frontend/src/App.jsx"
click node_accounts "https://github.com/shubhrajyoti65/drishya/tree/main/frontend/src/pages/auth"
click node_watch "https://github.com/shubhrajyoti65/drishya/blob/main/frontend/src/pages/Watch.jsx"
click node_upload "https://github.com/shubhrajyoti65/drishya/blob/main/frontend/src/pages/Upload.jsx"
click node_communityui "https://github.com/shubhrajyoti65/drishya/blob/main/frontend/src/components/CommunityTab.jsx"
click node_tierui "https://github.com/shubhrajyoti65/drishya/blob/main/frontend/src/pages/CreatorMemberships.jsx"
click node_memberui "https://github.com/shubhrajyoti65/drishya/blob/main/frontend/src/pages/MyMemberships.jsx"
click node_generatorui "https://github.com/shubhrajyoti65/drishya/blob/main/frontend/src/pages/ContentGenerator.jsx"
click node_clientapi "https://github.com/shubhrajyoti65/drishya/blob/main/frontend/src/services/api.js"
click node_authstate "https://github.com/shubhrajyoti65/drishya/blob/main/frontend/src/stores/authStore.js"
click node_express "https://github.com/shubhrajyoti65/drishya/blob/main/backend/app.js"
click node_videoapi "https://github.com/shubhrajyoti65/drishya/blob/main/backend/controllers/video.controller.js"
click node_communityapi "https://github.com/shubhrajyoti65/drishya/blob/main/backend/controllers/tweet.controller.js"
click node_membershipapi "https://github.com/shubhrajyoti65/drishya/blob/main/backend/controllers/payment.controller.js"
click node_identityapi "https://github.com/shubhrajyoti65/drishya/blob/main/backend/controllers/user.controller.js"
click node_authmw "https://github.com/shubhrajyoti65/drishya/blob/main/backend/middlewares/auth.middleware.js"
click node_userstore "https://github.com/shubhrajyoti65/drishya/blob/main/backend/models/user.model.js"
click node_videostore "https://github.com/shubhrajyoti65/drishya/blob/main/backend/models/video.model.js"
click node_communitydata "https://github.com/shubhrajyoti65/drishya/blob/main/backend/models/tweet.model.js"
click node_memberdata "https://github.com/shubhrajyoti65/drishya/blob/main/backend/models/membership.model.js"
click node_tierdata "https://github.com/shubhrajyoti65/drishya/blob/main/backend/models/membershipTier.model.js"
click node_aiclient "https://github.com/shubhrajyoti65/drishya/blob/main/frontend/src/services/aiApi.js"
click node_airoutes "https://github.com/shubhrajyoti65/drishya/blob/main/ai-service/routes/generator_routes.py"
click node_rag "https://github.com/shubhrajyoti65/drishya/blob/main/ai-service/rag/rag_service.py"
click node_gemini "https://github.com/shubhrajyoti65/drishya/blob/main/ai-service/services/gemini_service.py"
click node_fal "https://github.com/shubhrajyoti65/drishya/blob/main/ai-service/services/fal_service.py"

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_accounts,node_watch,node_upload,node_communityui,node_tierui,node_memberui,node_generatorui,node_clientapi,node_authstate,node_viewer toneBlue
class node_videoapi,node_communityapi,node_videostore,node_communitydata toneAmber
class node_membershipapi,node_memberdata,node_tierdata,node_razorpay toneMint
class node_express,node_identityapi,node_authmw,node_userstore,node_cloudinary toneRose
class node_aiclient,node_airoutes,node_rag,node_gemini,node_fal toneIndigo
```

## Components

### Creator and viewer app

- [App routing](https://github.com/shubhrajyoti65/drishya/blob/main/frontend/src/App.jsx): `frontend/src/App.jsx`
- [Accounts and profiles](https://github.com/shubhrajyoti65/drishya/tree/main/frontend/src/pages/auth): `frontend/src/pages/auth`
- [Video discovery and watch](https://github.com/shubhrajyoti65/drishya/blob/main/frontend/src/pages/Watch.jsx): `frontend/src/pages/Watch.jsx`
- [Video publishing](https://github.com/shubhrajyoti65/drishya/blob/main/frontend/src/pages/Upload.jsx): `frontend/src/pages/Upload.jsx`
- [Community and polls](https://github.com/shubhrajyoti65/drishya/blob/main/frontend/src/components/CommunityTab.jsx): `frontend/src/components/CommunityTab.jsx`
- [Creator tier setup](https://github.com/shubhrajyoti65/drishya/blob/main/frontend/src/pages/CreatorMemberships.jsx): `frontend/src/pages/CreatorMemberships.jsx`
- [Membership management](https://github.com/shubhrajyoti65/drishya/blob/main/frontend/src/pages/MyMemberships.jsx): `frontend/src/pages/MyMemberships.jsx`
- [AI creator tools](https://github.com/shubhrajyoti65/drishya/blob/main/frontend/src/pages/ContentGenerator.jsx): `frontend/src/pages/ContentGenerator.jsx`
- [API clients](https://github.com/shubhrajyoti65/drishya/blob/main/frontend/src/services/api.js): `frontend/src/services/api.js`
- [Authentication state](https://github.com/shubhrajyoti65/drishya/blob/main/frontend/src/stores/authStore.js): `frontend/src/stores/authStore.js`

### Video and community

- [Video endpoints](https://github.com/shubhrajyoti65/drishya/blob/main/backend/controllers/video.controller.js): `backend/controllers/video.controller.js`
- [Community endpoints](https://github.com/shubhrajyoti65/drishya/blob/main/backend/controllers/tweet.controller.js): `backend/controllers/tweet.controller.js`
- [Video records](https://github.com/shubhrajyoti65/drishya/blob/main/backend/models/video.model.js): `backend/models/video.model.js`
- [Community records](https://github.com/shubhrajyoti65/drishya/blob/main/backend/models/tweet.model.js): `backend/models/tweet.model.js`

### Membership and payments

- [Membership and payments](https://github.com/shubhrajyoti65/drishya/blob/main/backend/controllers/payment.controller.js): `backend/controllers/payment.controller.js`
- [Membership records](https://github.com/shubhrajyoti65/drishya/blob/main/backend/models/membership.model.js): `backend/models/membership.model.js`
- [Tier records](https://github.com/shubhrajyoti65/drishya/blob/main/backend/models/membershipTier.model.js): `backend/models/membershipTier.model.js`
- **Razorpay checkout**

### API and persistence

- [Express API routing](https://github.com/shubhrajyoti65/drishya/blob/main/backend/app.js): `backend/app.js`
- [Identity endpoints](https://github.com/shubhrajyoti65/drishya/blob/main/backend/controllers/user.controller.js): `backend/controllers/user.controller.js`
- [JWT authorization](https://github.com/shubhrajyoti65/drishya/blob/main/backend/middlewares/auth.middleware.js): `backend/middlewares/auth.middleware.js`
- [User records](https://github.com/shubhrajyoti65/drishya/blob/main/backend/models/user.model.js): `backend/models/user.model.js`
- **Cloudinary media storage**

### AI creator tools

- [AI API client](https://github.com/shubhrajyoti65/drishya/blob/main/frontend/src/services/aiApi.js): `frontend/src/services/aiApi.js`
- [Generation endpoints](https://github.com/shubhrajyoti65/drishya/blob/main/ai-service/routes/generator_routes.py): `ai-service/routes/generator_routes.py`
- [Retrieval and generation](https://github.com/shubhrajyoti65/drishya/blob/main/ai-service/rag/rag_service.py): `ai-service/rag/rag_service.py`
- [Gemini models](https://github.com/shubhrajyoti65/drishya/blob/main/ai-service/services/gemini_service.py): `ai-service/services/gemini_service.py`
- [Thumbnail image fallback](https://github.com/shubhrajyoti65/drishya/blob/main/ai-service/services/fal_service.py): `ai-service/services/fal_service.py`

### Other components

- **Creators and viewers**

## Connections

- Creators and viewers → App routing: uses
- App routing → Accounts and profiles: routes to (evidence: `frontend/src/App.jsx`)
- App routing → Video discovery and watch: routes to (evidence: `frontend/src/App.jsx`)
- App routing → Video publishing: routes to (evidence: `frontend/src/App.jsx`)
- App routing → Community and polls: routes to
- App routing → Creator tier setup: routes to (evidence: `frontend/src/App.jsx`)
- App routing → Membership management: routes to (evidence: `frontend/src/App.jsx`)
- App routing → AI creator tools: routes to (evidence: `frontend/src/App.jsx`)
- Accounts and profiles → Authentication state: updates
- Accounts and profiles → API clients: calls
- Video discovery and watch → API clients: requests data
- Video publishing → API clients: uploads video
- Community and polls → API clients: manages polls
- Creator tier setup → API clients: configures tiers
- Membership management → API clients: requests membership
- AI creator tools → AI API client: requests generation
- API clients → Express API routing: calls API
- AI API client → Generation endpoints: calls AI API
- Express API routing → Video endpoints: routes video (evidence: `backend/app.js`)
- Express API routing → Community endpoints: routes tweets (evidence: `backend/app.js`)
- Express API routing → Membership and payments: routes payments (evidence: `backend/app.js`)
- Express API routing → Identity endpoints: routes users (evidence: `backend/app.js`)
- Video endpoints → Video records: reads and writes (evidence: `backend/controllers/video.controller.js`)
- Video endpoints → User records: checks owner (evidence: `backend/controllers/video.controller.js`)
- Video endpoints → Membership records: checks access (evidence: `backend/controllers/video.controller.js`)
- Video endpoints → Tier records: checks tier (evidence: `backend/controllers/video.controller.js`)
- Video endpoints → Cloudinary media storage: uploads media (evidence: `backend/controllers/video.controller.js`)
- Community endpoints → Community records: reads and writes (evidence: `backend/controllers/tweet.controller.js`)
- Community endpoints → User records: reads authors (evidence: `backend/controllers/tweet.controller.js`)
- Membership and payments → Membership records: activates membership (evidence: `backend/controllers/payment.controller.js`)
- Membership and payments → Tier records: reads tier (evidence: `backend/controllers/payment.controller.js`)
- Membership and payments → User records: reads subscriber (evidence: `backend/controllers/payment.controller.js`)
- Identity endpoints → User records: manages accounts (evidence: `backend/controllers/user.controller.js`)
- JWT authorization → User records: loads identity (evidence: `backend/middlewares/auth.middleware.js`)
- Membership and payments → Razorpay checkout: verifies payment
- Generation endpoints → Retrieval and generation: dispatches generation (evidence: `ai-service/routes/generator_routes.py`)
- Retrieval and generation → Gemini models: generates content
- Generation endpoints → Thumbnail image fallback: optional image fallback (evidence: `ai-service/routes/generator_routes.py`)
