# manishparab12/fileshare architecture

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

- Interactive diagram: https://gitdiagram.com/manishparab12/fileshare
- Repository: https://github.com/manishparab12/fileshare

## Overview

FileShare lets a sender select multiple files, upload them, and distribute a PIN, link, or QR code; recipients use the download page to retrieve shared files. The backend validates and stores file metadata and expiry information, uploads file content to Cloudinary, and serves PIN-based lookup and downloads. A scheduled cleanup removes expired cloud objects and records. The graph includes documented UI capabilities and unsampled core components, but their internal behavior and some frontend-to-backend download wiring are not shown in the excerpts.

Main entry points: [`frontend/src/App.jsx`](https://github.com/manishparab12/fileshare/blob/main/frontend/src/App.jsx) (Page router), [`backend/server.js`](https://github.com/manishparab12/fileshare/blob/main/backend/server.js) (HTTP server), [`backend/controllers/uploadController.js`](https://github.com/manishparab12/fileshare/blob/main/backend/controllers/uploadController.js) (Upload and lookup), [`backend/routes/uploadRoutes.js`](https://github.com/manishparab12/fileshare/blob/main/backend/routes/uploadRoutes.js) (File routes)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_web["Web experience"]
  node_app["Page router<br/>[App.jsx]"]
  node_nav["Navigation<br/>[Navbar.jsx]"]
  node_home["Home page<br/>[Home.jsx]"]
  node_uploadui["Upload and sharing UI<br/>[Upload.jsx]"]
  node_downloadui["Download page<br/>[Download.jsx]"]
  node_about["About page<br/>[About.jsx]"]
  node_faq["FAQ page<br/>[FAQ.jsx]"]
end

subgraph group_api["Sharing API"]
  node_server["HTTP server<br/>[server.js]"]
  node_routes["File routes<br/>[uploadRoutes.js]"]
  node_uploadmw["Multipart intake<br/>[upload.js]"]
  node_uploadctl["Upload and lookup"]
  node_downloadctl["Download handler"]
  node_errors["Error responses<br/>[errorHandler.js]"]
  node_fileutils["File metadata helpers<br/>[fileUtils.js]"]
end

subgraph group_storage["Persistence and media"]
  node_dbconfig["Database connection<br/>[db.js]"]
  node_records[("File records<br/>[File.js]")]
  node_cloudconfig["Cloudinary setup<br/>[cloudinary.js]"]
  node_cloudservice["Cloud media service"]
end

subgraph group_lifecycle["Expiry lifecycle"]
  node_cleanup["Expired-file cleanup"]
end

node_sender(("Sender or recipient"))
node_cloudinary[("Cloudinary")]
node_mongodb[("MongoDB")]

node_sender -->|"opens"| node_app
node_app -->|"renders"| node_nav
node_app -->|"routes to"| node_home
node_app -->|"routes to"| node_downloadui
node_app -->|"routes to"| node_uploadui
node_app -->|"routes to"| node_about
node_app -->|"routes to"| node_faq
node_sender -->|"selects files"| node_uploadui
node_uploadui -->|"posts files"| node_server
node_downloadui -.->|"requests downloads"| node_server
node_server -->|"connects"| node_dbconfig
node_server -->|"mounts routes"| node_routes
node_server -->|"handles errors"| node_errors
node_server -->|"starts"| node_cleanup
node_routes -->|"parses upload"| node_uploadmw
node_routes -->|"dispatches upload"| node_uploadctl
node_routes -->|"dispatches lookup"| node_uploadctl
node_routes -->|"dispatches download"| node_downloadctl
node_uploadctl -->|"uses helpers"| node_fileutils
node_uploadctl -->|"uploads media"| node_cloudservice
node_uploadctl -->|"rolls back media"| node_cloudservice
node_uploadctl -->|"writes and queries"| node_records
node_downloadctl -->|"queries active file"| node_records
node_downloadctl -->|"fetches media"| node_cloudinary
node_cloudservice -->|"uses configuration"| node_cloudconfig
node_cloudservice -->|"uploads and deletes"| node_cloudinary
node_dbconfig -->|"connects"| node_mongodb
node_cleanup -->|"finds and deletes expired"| node_records
node_cleanup -->|"deletes expired media"| node_cloudservice

click node_app "https://github.com/manishparab12/fileshare/blob/main/frontend/src/App.jsx"
click node_nav "https://github.com/manishparab12/fileshare/blob/main/frontend/src/Components/Navbar.jsx"
click node_home "https://github.com/manishparab12/fileshare/blob/main/frontend/src/Components/Home.jsx"
click node_uploadui "https://github.com/manishparab12/fileshare/blob/main/frontend/src/Components/Upload.jsx"
click node_downloadui "https://github.com/manishparab12/fileshare/blob/main/frontend/src/Components/Download.jsx"
click node_about "https://github.com/manishparab12/fileshare/blob/main/frontend/src/Components/About.jsx"
click node_faq "https://github.com/manishparab12/fileshare/blob/main/frontend/src/Components/FAQ.jsx"
click node_server "https://github.com/manishparab12/fileshare/blob/main/backend/server.js"
click node_routes "https://github.com/manishparab12/fileshare/blob/main/backend/routes/uploadRoutes.js"
click node_uploadmw "https://github.com/manishparab12/fileshare/blob/main/backend/middleware/upload.js"
click node_uploadctl "https://github.com/manishparab12/fileshare/blob/main/backend/controllers/uploadController.js"
click node_downloadctl "https://github.com/manishparab12/fileshare/blob/main/backend/controllers/downloadController.js"
click node_errors "https://github.com/manishparab12/fileshare/blob/main/backend/middleware/errorHandler.js"
click node_fileutils "https://github.com/manishparab12/fileshare/blob/main/backend/utils/fileUtils.js"
click node_dbconfig "https://github.com/manishparab12/fileshare/blob/main/backend/config/db.js"
click node_records "https://github.com/manishparab12/fileshare/blob/main/backend/models/File.js"
click node_cloudconfig "https://github.com/manishparab12/fileshare/blob/main/backend/config/cloudinary.js"
click node_cloudservice "https://github.com/manishparab12/fileshare/blob/main/backend/services/cloudinaryService.js"
click node_cleanup "https://github.com/manishparab12/fileshare/blob/main/backend/utils/cleanupExpiredFiles.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_app,node_nav,node_home,node_uploadui,node_downloadui,node_about,node_faq toneBlue
class node_server,node_routes,node_uploadmw,node_uploadctl,node_downloadctl,node_errors,node_fileutils,node_cloudinary,node_mongodb toneAmber
class node_dbconfig,node_records,node_cloudconfig,node_cloudservice toneMint
class node_cleanup toneRose
class node_sender toneIndigo
```

## Components

### Web experience

- [Page router](https://github.com/manishparab12/fileshare/blob/main/frontend/src/App.jsx): `frontend/src/App.jsx`
- [Navigation](https://github.com/manishparab12/fileshare/blob/main/frontend/src/Components/Navbar.jsx): `frontend/src/Components/Navbar.jsx`
- [Home page](https://github.com/manishparab12/fileshare/blob/main/frontend/src/Components/Home.jsx): `frontend/src/Components/Home.jsx`
- [Upload and sharing UI](https://github.com/manishparab12/fileshare/blob/main/frontend/src/Components/Upload.jsx): `frontend/src/Components/Upload.jsx`
- [Download page](https://github.com/manishparab12/fileshare/blob/main/frontend/src/Components/Download.jsx): `frontend/src/Components/Download.jsx`
- [About page](https://github.com/manishparab12/fileshare/blob/main/frontend/src/Components/About.jsx): `frontend/src/Components/About.jsx`
- [FAQ page](https://github.com/manishparab12/fileshare/blob/main/frontend/src/Components/FAQ.jsx): `frontend/src/Components/FAQ.jsx`

### Sharing API

- [HTTP server](https://github.com/manishparab12/fileshare/blob/main/backend/server.js): `backend/server.js`
- [File routes](https://github.com/manishparab12/fileshare/blob/main/backend/routes/uploadRoutes.js): `backend/routes/uploadRoutes.js`
- [Multipart intake](https://github.com/manishparab12/fileshare/blob/main/backend/middleware/upload.js): `backend/middleware/upload.js`
- [Upload and lookup](https://github.com/manishparab12/fileshare/blob/main/backend/controllers/uploadController.js): `backend/controllers/uploadController.js`
- [Download handler](https://github.com/manishparab12/fileshare/blob/main/backend/controllers/downloadController.js): `backend/controllers/downloadController.js`
- [Error responses](https://github.com/manishparab12/fileshare/blob/main/backend/middleware/errorHandler.js): `backend/middleware/errorHandler.js`
- [File metadata helpers](https://github.com/manishparab12/fileshare/blob/main/backend/utils/fileUtils.js): `backend/utils/fileUtils.js`

### Persistence and media

- [Database connection](https://github.com/manishparab12/fileshare/blob/main/backend/config/db.js): `backend/config/db.js`
- [File records](https://github.com/manishparab12/fileshare/blob/main/backend/models/File.js): `backend/models/File.js`
- [Cloudinary setup](https://github.com/manishparab12/fileshare/blob/main/backend/config/cloudinary.js): `backend/config/cloudinary.js`
- [Cloud media service](https://github.com/manishparab12/fileshare/blob/main/backend/services/cloudinaryService.js): `backend/services/cloudinaryService.js`

### Expiry lifecycle

- [Expired-file cleanup](https://github.com/manishparab12/fileshare/blob/main/backend/utils/cleanupExpiredFiles.js): `backend/utils/cleanupExpiredFiles.js`

### Other components

- **Sender or recipient**
- **Cloudinary**
- **MongoDB**

## Connections

- Sender or recipient → Page router: opens
- Page router → Navigation: renders (evidence: `frontend/src/App.jsx`)
- Page router → Home page: routes to (evidence: `frontend/src/App.jsx`)
- Page router → Download page: routes to (evidence: `frontend/src/App.jsx`)
- Page router → Upload and sharing UI: routes to (evidence: `frontend/src/App.jsx`)
- Page router → About page: routes to (evidence: `frontend/src/App.jsx`)
- Page router → FAQ page: routes to (evidence: `frontend/src/App.jsx`)
- Sender or recipient → Upload and sharing UI: selects files (evidence: `frontend/src/Components/Upload.jsx`)
- Upload and sharing UI → HTTP server: posts files (evidence: `frontend/src/Components/Upload.jsx`)
- Download page → HTTP server: requests downloads
- HTTP server → Database connection: connects (evidence: `backend/server.js`)
- HTTP server → File routes: mounts routes (evidence: `backend/server.js`)
- HTTP server → Error responses: handles errors (evidence: `backend/server.js`)
- HTTP server → Expired-file cleanup: starts (evidence: `backend/server.js`)
- File routes → Multipart intake: parses upload (evidence: `backend/routes/uploadRoutes.js`)
- File routes → Upload and lookup: dispatches upload (evidence: `backend/routes/uploadRoutes.js`)
- File routes → Upload and lookup: dispatches lookup (evidence: `backend/routes/uploadRoutes.js`)
- File routes → Download handler: dispatches download (evidence: `backend/routes/uploadRoutes.js`)
- Upload and lookup → File metadata helpers: uses helpers (evidence: `backend/controllers/uploadController.js`)
- Upload and lookup → Cloud media service: uploads media (evidence: `backend/controllers/uploadController.js`)
- Upload and lookup → Cloud media service: rolls back media (evidence: `backend/controllers/uploadController.js`)
- Upload and lookup → File records: writes and queries (evidence: `backend/controllers/uploadController.js`)
- Download handler → File records: queries active file (evidence: `backend/controllers/downloadController.js`)
- Download handler → Cloudinary: fetches media (evidence: `backend/controllers/downloadController.js`)
- Cloud media service → Cloudinary setup: uses configuration (evidence: `backend/services/cloudinaryService.js`)
- Cloud media service → Cloudinary: uploads and deletes (evidence: `backend/services/cloudinaryService.js`)
- Database connection → MongoDB: connects (evidence: `backend/config/db.js`)
- Expired-file cleanup → File records: finds and deletes expired (evidence: `backend/utils/cleanupExpiredFiles.js`)
- Expired-file cleanup → Cloud media service: deletes expired media (evidence: `backend/utils/cleanupExpiredFiles.js`)
