# saikrishna-bathina/blockchain-based-drm architecture

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

- Interactive diagram: https://gitdiagram.com/saikrishna-bathina/blockchain-based-drm
- Repository: https://github.com/saikrishna-bathina/blockchain-based-drm

## Overview

This is a web and desktop DRM platform for creator asset registration, originality checks, encrypted storage, licensing, and protected delivery. The main workflow runs from creator upload through backend processing and originality verification, then storage and rights registration; consumers browse assets, obtain licenses, and stream protected content. The README documents blockchain and media-processing integrations, while sampled source confirms application wiring, authentication, and individual engine endpoints. Some domain-controller and contract internals were not sampled, so those links rely on README documentation rather than inspected implementation.

Main entry points: [`backend/src/app.js`](https://github.com/saikrishna-bathina/blockchain-based-drm/blob/main/backend/src/app.js) (Express API), [`backend/src/controllers/asset.js`](https://github.com/saikrishna-bathina/blockchain-based-drm/blob/main/backend/src/controllers/asset.js) (Asset processing), [`backend/src/services/originalityService.js`](https://github.com/saikrishna-bathina/blockchain-based-drm/blob/main/backend/src/services/originalityService.js) (Originality dispatch), [`originality-engine/videoFiles/server.py`](https://github.com/saikrishna-bathina/blockchain-based-drm/blob/main/originality-engine/videoFiles/server.py) (Video verification)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_clients["Client apps"]
  node_webapp["DRM web app<br/>[App.jsx]"]
  node_authui["Web3 authentication<br/>[AuthContext.jsx]"]
  node_desktop["Protected desktop<br/>[main.js]"]
end

subgraph group_backend["Backend services"]
  node_api["Express API<br/>[app.js]"]
  node_authroutes["Auth routes<br/>[auth.js]"]
  node_assetroutes["Asset routes<br/>[asset.js]"]
  node_licenseroutes["License routes<br/>[license.js]"]
  node_dashroutes["Dashboard routes<br/>[dashboard.js]"]
  node_notifyroutes["Notification routes<br/>[notification.js]"]
  node_assetprocessing["Asset processing<br/>[asset.js]"]
  node_streaming["Gated streaming<br/>[stream.js]"]
  node_authservice["Identity service<br/>[auth.js]"]
  node_userstore[("User records<br/>[User.js]")]
  node_assetstore[("Asset records<br/>[Asset.js]")]
  node_licensestore[("License records<br/>[License.js]")]
  node_notifications["Notifications"]
  node_encryption["File encryption"]
  node_ipfsservice["IPFS service<br/>[ipfsService.js]"]
  node_originalityservice["Originality dispatch"]
end

subgraph group_originality["Originality engines"]
  node_images["Image verification<br/>[main.py]"]
  node_imageanalysis["Image matching<br/>[originality.py]"]
  node_texts["Text verification<br/>[server.py]"]
  node_textanalysis["Text matching<br/>[originality.py]"]
  node_videos["Video verification<br/>[server.py]"]
  node_videoanalysis["Video matching<br/>[originality.py]"]
  node_audio["Audio verification<br/>[main.go]"]
  node_audioanalysis["Audio fingerprinting<br/>[spectrogram.go]"]
end

subgraph group_rights["Rights and storage"]
  node_mongo[("MongoDB")]
  node_ipfs[("IPFS storage")]
  node_contracts["DRM smart contracts"]
end

node_creator(("Creator"))
node_consumer(("Consumer"))
node_ethereum["Ethereum Sepolia"]

node_creator -->|"uses"| node_webapp
node_consumer -->|"uses"| node_webapp
node_webapp -->|"calls REST"| node_api
node_desktop -->|"requests streams"| node_api
node_webapp -->|"renders with"| node_authui
node_authui -->|"calls"| node_api
node_api -->|"mounts"| node_authroutes
node_api -->|"mounts"| node_assetroutes
node_api -->|"mounts"| node_licenseroutes
node_api -->|"mounts"| node_dashroutes
node_api -->|"mounts"| node_notifyroutes
node_api -.->|"handles assets"| node_assetprocessing
node_api -.->|"serves streams"| node_streaming
node_api -.->|"handles identity"| node_authservice
node_authservice -->|"reads and updates"| node_userstore
node_authservice -->|"creates login alert"| node_notifications
node_assetprocessing -.->|"checks originality"| node_originalityservice
node_assetprocessing -.->|"encrypts asset"| node_encryption
node_assetprocessing -.->|"pins asset"| node_ipfsservice
node_assetprocessing -.->|"stores metadata"| node_assetstore
node_originalityservice -->|"dispatches checks"| node_images
node_originalityservice -->|"dispatches checks"| node_texts
node_originalityservice -->|"dispatches checks"| node_videos
node_originalityservice -->|"dispatches checks"| node_audio
node_images -->|"calls"| node_imageanalysis
node_texts -->|"calls"| node_textanalysis
node_videos -->|"calls"| node_videoanalysis
node_videos -.->|"sends keyframes"| node_images
node_videos -.->|"sends audio track"| node_audio
node_audio -.->|"fingerprints audio"| node_audioanalysis
node_assetprocessing -.->|"registers rights"| node_contracts
node_licenseroutes -.->|"manages licenses"| node_licensestore
node_licenseroutes -.->|"checks licensing"| node_contracts
node_contracts -->|"executes on"| node_ethereum
node_ipfsservice -->|"uploads and fetches"| node_ipfs
node_api -.->|"persists application data"| node_mongo
node_streaming -.->|"fetches encrypted media"| node_ipfsservice
node_streaming -.->|"verifies license"| node_contracts

click node_webapp "https://github.com/saikrishna-bathina/blockchain-based-drm/blob/main/frontend/src/App.jsx"
click node_authui "https://github.com/saikrishna-bathina/blockchain-based-drm/blob/main/frontend/src/context/AuthContext.jsx"
click node_desktop "https://github.com/saikrishna-bathina/blockchain-based-drm/blob/main/desktop/main.js"
click node_api "https://github.com/saikrishna-bathina/blockchain-based-drm/blob/main/backend/src/app.js"
click node_authroutes "https://github.com/saikrishna-bathina/blockchain-based-drm/blob/main/backend/src/routes/auth.js"
click node_assetroutes "https://github.com/saikrishna-bathina/blockchain-based-drm/blob/main/backend/src/routes/asset.js"
click node_licenseroutes "https://github.com/saikrishna-bathina/blockchain-based-drm/blob/main/backend/src/routes/license.js"
click node_dashroutes "https://github.com/saikrishna-bathina/blockchain-based-drm/blob/main/backend/src/routes/dashboard.js"
click node_notifyroutes "https://github.com/saikrishna-bathina/blockchain-based-drm/blob/main/backend/src/routes/notification.js"
click node_assetprocessing "https://github.com/saikrishna-bathina/blockchain-based-drm/blob/main/backend/src/controllers/asset.js"
click node_streaming "https://github.com/saikrishna-bathina/blockchain-based-drm/blob/main/backend/src/controllers/stream.js"
click node_authservice "https://github.com/saikrishna-bathina/blockchain-based-drm/blob/main/backend/src/controllers/auth.js"
click node_userstore "https://github.com/saikrishna-bathina/blockchain-based-drm/blob/main/backend/src/models/User.js"
click node_assetstore "https://github.com/saikrishna-bathina/blockchain-based-drm/blob/main/backend/src/models/Asset.js"
click node_licensestore "https://github.com/saikrishna-bathina/blockchain-based-drm/blob/main/backend/src/models/License.js"
click node_notifications "https://github.com/saikrishna-bathina/blockchain-based-drm/blob/main/backend/src/services/notificationService.js"
click node_encryption "https://github.com/saikrishna-bathina/blockchain-based-drm/blob/main/backend/src/services/encryptionService.js"
click node_ipfsservice "https://github.com/saikrishna-bathina/blockchain-based-drm/blob/main/backend/src/services/ipfsService.js"
click node_originalityservice "https://github.com/saikrishna-bathina/blockchain-based-drm/blob/main/backend/src/services/originalityService.js"
click node_images "https://github.com/saikrishna-bathina/blockchain-based-drm/blob/main/originality-engine/imageFiles/main.py"
click node_imageanalysis "https://github.com/saikrishna-bathina/blockchain-based-drm/blob/main/originality-engine/imageFiles/originality.py"
click node_texts "https://github.com/saikrishna-bathina/blockchain-based-drm/blob/main/originality-engine/textFiles/server.py"
click node_textanalysis "https://github.com/saikrishna-bathina/blockchain-based-drm/blob/main/originality-engine/textFiles/originality.py"
click node_videos "https://github.com/saikrishna-bathina/blockchain-based-drm/blob/main/originality-engine/videoFiles/server.py"
click node_videoanalysis "https://github.com/saikrishna-bathina/blockchain-based-drm/blob/main/originality-engine/videoFiles/originality.py"
click node_audio "https://github.com/saikrishna-bathina/blockchain-based-drm/blob/main/originality-engine/audioFiles/main.go"
click node_audioanalysis "https://github.com/saikrishna-bathina/blockchain-based-drm/blob/main/originality-engine/audioFiles/shazam/spectrogram.go"

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_authui,node_desktop toneBlue
class node_api,node_authroutes,node_assetroutes,node_licenseroutes,node_dashroutes,node_notifyroutes,node_assetprocessing,node_streaming,node_authservice,node_userstore,node_assetstore,node_licensestore,node_notifications,node_encryption,node_ipfsservice,node_originalityservice toneAmber
class node_images,node_imageanalysis,node_texts,node_textanalysis,node_videos,node_videoanalysis,node_audio,node_audioanalysis toneMint
class node_mongo,node_ipfs,node_contracts toneRose
class node_creator,node_consumer,node_ethereum toneIndigo
```

## Components

### Client apps

- [DRM web app](https://github.com/saikrishna-bathina/blockchain-based-drm/blob/main/frontend/src/App.jsx): `frontend/src/App.jsx`
- [Web3 authentication](https://github.com/saikrishna-bathina/blockchain-based-drm/blob/main/frontend/src/context/AuthContext.jsx): `frontend/src/context/AuthContext.jsx`
- [Protected desktop](https://github.com/saikrishna-bathina/blockchain-based-drm/blob/main/desktop/main.js): `desktop/main.js`

### Backend services

- [Express API](https://github.com/saikrishna-bathina/blockchain-based-drm/blob/main/backend/src/app.js): `backend/src/app.js`
- [Auth routes](https://github.com/saikrishna-bathina/blockchain-based-drm/blob/main/backend/src/routes/auth.js): `backend/src/routes/auth.js`
- [Asset routes](https://github.com/saikrishna-bathina/blockchain-based-drm/blob/main/backend/src/routes/asset.js): `backend/src/routes/asset.js`
- [License routes](https://github.com/saikrishna-bathina/blockchain-based-drm/blob/main/backend/src/routes/license.js): `backend/src/routes/license.js`
- [Dashboard routes](https://github.com/saikrishna-bathina/blockchain-based-drm/blob/main/backend/src/routes/dashboard.js): `backend/src/routes/dashboard.js`
- [Notification routes](https://github.com/saikrishna-bathina/blockchain-based-drm/blob/main/backend/src/routes/notification.js): `backend/src/routes/notification.js`
- [Asset processing](https://github.com/saikrishna-bathina/blockchain-based-drm/blob/main/backend/src/controllers/asset.js): `backend/src/controllers/asset.js`
- [Gated streaming](https://github.com/saikrishna-bathina/blockchain-based-drm/blob/main/backend/src/controllers/stream.js): `backend/src/controllers/stream.js`
- [Identity service](https://github.com/saikrishna-bathina/blockchain-based-drm/blob/main/backend/src/controllers/auth.js): `backend/src/controllers/auth.js`
- [User records](https://github.com/saikrishna-bathina/blockchain-based-drm/blob/main/backend/src/models/User.js): `backend/src/models/User.js`
- [Asset records](https://github.com/saikrishna-bathina/blockchain-based-drm/blob/main/backend/src/models/Asset.js): `backend/src/models/Asset.js`
- [License records](https://github.com/saikrishna-bathina/blockchain-based-drm/blob/main/backend/src/models/License.js): `backend/src/models/License.js`
- [Notifications](https://github.com/saikrishna-bathina/blockchain-based-drm/blob/main/backend/src/services/notificationService.js): `backend/src/services/notificationService.js`
- [File encryption](https://github.com/saikrishna-bathina/blockchain-based-drm/blob/main/backend/src/services/encryptionService.js): `backend/src/services/encryptionService.js`
- [IPFS service](https://github.com/saikrishna-bathina/blockchain-based-drm/blob/main/backend/src/services/ipfsService.js): `backend/src/services/ipfsService.js`
- [Originality dispatch](https://github.com/saikrishna-bathina/blockchain-based-drm/blob/main/backend/src/services/originalityService.js): `backend/src/services/originalityService.js`

### Originality engines

- [Image verification](https://github.com/saikrishna-bathina/blockchain-based-drm/blob/main/originality-engine/imageFiles/main.py): `originality-engine/imageFiles/main.py`
- [Image matching](https://github.com/saikrishna-bathina/blockchain-based-drm/blob/main/originality-engine/imageFiles/originality.py): `originality-engine/imageFiles/originality.py`
- [Text verification](https://github.com/saikrishna-bathina/blockchain-based-drm/blob/main/originality-engine/textFiles/server.py): `originality-engine/textFiles/server.py`
- [Text matching](https://github.com/saikrishna-bathina/blockchain-based-drm/blob/main/originality-engine/textFiles/originality.py): `originality-engine/textFiles/originality.py`
- [Video verification](https://github.com/saikrishna-bathina/blockchain-based-drm/blob/main/originality-engine/videoFiles/server.py): `originality-engine/videoFiles/server.py`
- [Video matching](https://github.com/saikrishna-bathina/blockchain-based-drm/blob/main/originality-engine/videoFiles/originality.py): `originality-engine/videoFiles/originality.py`
- [Audio verification](https://github.com/saikrishna-bathina/blockchain-based-drm/blob/main/originality-engine/audioFiles/main.go): `originality-engine/audioFiles/main.go`
- [Audio fingerprinting](https://github.com/saikrishna-bathina/blockchain-based-drm/blob/main/originality-engine/audioFiles/shazam/spectrogram.go): `originality-engine/audioFiles/shazam/spectrogram.go`

### Rights and storage

- **MongoDB**
- **IPFS storage**
- **DRM smart contracts**

### Other components

- **Creator**
- **Consumer**
- **Ethereum Sepolia**

## Connections

- Creator → DRM web app: uses (evidence: `README.md`)
- Consumer → DRM web app: uses (evidence: `README.md`)
- DRM web app → Express API: calls REST (evidence: `README.md`)
- Protected desktop → Express API: requests streams (evidence: `README.md`)
- DRM web app → Web3 authentication: renders with (evidence: `frontend/src/main.jsx`)
- Web3 authentication → Express API: calls (evidence: `frontend/src/context/AuthContext.jsx`)
- Express API → Auth routes: mounts (evidence: `backend/src/app.js`)
- Express API → Asset routes: mounts (evidence: `backend/src/app.js`)
- Express API → License routes: mounts (evidence: `backend/src/app.js`)
- Express API → Dashboard routes: mounts (evidence: `backend/src/app.js`)
- Express API → Notification routes: mounts (evidence: `backend/src/app.js`)
- Express API → Asset processing: handles assets
- Express API → Gated streaming: serves streams (evidence: `README.md`)
- Express API → Identity service: handles identity (evidence: `README.md`)
- Identity service → User records: reads and updates (evidence: `backend/src/controllers/auth.js`)
- Identity service → Notifications: creates login alert (evidence: `backend/src/controllers/auth.js`)
- Asset processing → Originality dispatch: checks originality (evidence: `README.md`)
- Asset processing → File encryption: encrypts asset (evidence: `README.md`)
- Asset processing → IPFS service: pins asset (evidence: `README.md`)
- Asset processing → Asset records: stores metadata (evidence: `README.md`)
- Originality dispatch → Image verification: dispatches checks (evidence: `backend/src/services/originalityService.js`)
- Originality dispatch → Text verification: dispatches checks (evidence: `backend/src/services/originalityService.js`)
- Originality dispatch → Video verification: dispatches checks (evidence: `backend/src/services/originalityService.js`)
- Originality dispatch → Audio verification: dispatches checks (evidence: `backend/src/services/originalityService.js`)
- Image verification → Image matching: calls (evidence: `originality-engine/imageFiles/main.py`)
- Text verification → Text matching: calls (evidence: `originality-engine/textFiles/server.py`)
- Video verification → Video matching: calls (evidence: `originality-engine/videoFiles/server.py`)
- Video verification → Image verification: sends keyframes (evidence: `README.md`)
- Video verification → Audio verification: sends audio track (evidence: `README.md`)
- Audio verification → Audio fingerprinting: fingerprints audio (evidence: `README.md`)
- Asset processing → DRM smart contracts: registers rights (evidence: `README.md`)
- License routes → License records: manages licenses (evidence: `README.md`)
- License routes → DRM smart contracts: checks licensing (evidence: `README.md`)
- DRM smart contracts → Ethereum Sepolia: executes on (evidence: `README.md`)
- IPFS service → IPFS storage: uploads and fetches (evidence: `backend/src/services/ipfsService.js`)
- Express API → MongoDB: persists application data (evidence: `README.md`)
- Gated streaming → IPFS service: fetches encrypted media (evidence: `README.md`)
- Gated streaming → DRM smart contracts: verifies license (evidence: `README.md`)
