# shivanshidhyani/cloud-drive architecture

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

- Interactive diagram: https://gitdiagram.com/shivanshidhyani/cloud-drive
- Repository: https://github.com/shivanshidhyani/cloud-drive

## Overview

CloudNest is a cloud-drive application: users sign up or log in, then manage files in a protected dashboard, upload bytes directly to S3, and retrieve or share downloads. The backend authenticates requests and coordinates file metadata, signed URLs, and storage operations; shared links provide a public download path. The graph preserves the major UI and API modules named in the source index. The README is empty, and unsampled share-route behavior is represented only where its indexed references support it.

Main entry points: [`backend/server.js`](https://github.com/shivanshidhyani/cloud-drive/blob/main/backend/server.js) (API server), [`frontend/src/api/files.js`](https://github.com/shivanshidhyani/cloud-drive/blob/main/frontend/src/api/files.js) (File API client), [`frontend/src/App.jsx`](https://github.com/shivanshidhyani/cloud-drive/blob/main/frontend/src/App.jsx) (Route application), [`frontend/src/pages/Dashboard.jsx`](https://github.com/shivanshidhyani/cloud-drive/blob/main/frontend/src/pages/Dashboard.jsx) (Dashboard)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_frontend["Frontend experience"]
  node_app["Route application<br/>[App.jsx]"]
  node_authpages["Login and signup"]
  node_authlayout["Auth layout<br/>[AuthLayout.jsx]"]
  node_authcontext["Auth state<br/>[AuthContext.jsx]"]
  node_dashboard["Dashboard<br/>[Dashboard.jsx]"]
  node_filecard["File card<br/>[FileCard.jsx]"]
  node_uploadzone["Upload zone<br/>[UploadZone.jsx]"]
  node_sidebar["Sidebar<br/>[Sidebar.jsx]"]
  node_storagering["Storage ring<br/>[StorageRing.jsx]"]
  node_sharedpage["Shared file page<br/>[SharedFile.jsx]"]
  node_filesapi["File API client<br/>[files.js]"]
  node_httpclient["HTTP client<br/>[client.js]"]
end

subgraph group_backend["Backend API"]
  node_backendserver["API server<br/>[server.js]"]
  node_authroutes["Auth routes<br/>[auth.js]"]
  node_fileroutes["File routes<br/>[files.js]"]
  node_shareroutes["Share routes<br/>[share.js]"]
  node_authmiddleware["JWT middleware<br/>[auth.js]"]
end

subgraph group_data["Data and storage"]
  node_userrecords[("User records<br/>[User.js]")]
  node_filerecords[("File metadata<br/>[File.js]")]
  node_dbconfig["Database connection<br/>[db.js]"]
  node_s3helper["S3 operations<br/>[s3.js]"]
end

node_user(("User"))
node_mongo[("MongoDB")]
node_s3[("AWS S3")]

node_user -->|"uses"| node_app
node_app -->|"routes to"| node_authpages
node_app -->|"routes to"| node_dashboard
node_app -->|"routes to"| node_sharedpage
node_authpages -->|"renders"| node_authlayout
node_authpages -->|"uses"| node_authcontext
node_authcontext -.->|"auth requests"| node_backendserver
node_backendserver -->|"mounts"| node_authroutes
node_backendserver -->|"mounts"| node_fileroutes
node_backendserver -->|"mounts"| node_shareroutes
node_backendserver -->|"connects"| node_dbconfig
node_authroutes -->|"reads and writes"| node_userrecords
node_fileroutes -->|"requires"| node_authmiddleware
node_fileroutes -->|"reads and writes"| node_filerecords
node_fileroutes -->|"requests storage operations"| node_s3helper
node_shareroutes -->|"references"| node_filerecords
node_shareroutes -->|"references"| node_s3helper
node_dbconfig -.->|"connects"| node_mongo
node_userrecords -.->|"persists in"| node_mongo
node_filerecords -.->|"persists in"| node_mongo
node_s3helper -->|"operates on"| node_s3
node_dashboard -->|"renders"| node_sidebar
node_dashboard -->|"renders"| node_uploadzone
node_dashboard -->|"renders"| node_filecard
node_sidebar -->|"renders"| node_storagering
node_uploadzone -->|"requests uploads"| node_filesapi
node_filecard -->|"requests file actions"| node_filesapi
node_sharedpage -->|"requests shared download"| node_filesapi
node_filesapi -->|"sends API requests"| node_httpclient
node_filesapi -->|"uploads bytes directly"| node_s3
node_httpclient -.->|"calls API"| node_backendserver

click node_app "https://github.com/shivanshidhyani/cloud-drive/blob/main/frontend/src/App.jsx"
click node_authpages "https://github.com/shivanshidhyani/cloud-drive/tree/main/frontend/src/pages"
click node_authlayout "https://github.com/shivanshidhyani/cloud-drive/blob/main/frontend/src/components/AuthLayout.jsx"
click node_authcontext "https://github.com/shivanshidhyani/cloud-drive/blob/main/frontend/src/context/AuthContext.jsx"
click node_dashboard "https://github.com/shivanshidhyani/cloud-drive/blob/main/frontend/src/pages/Dashboard.jsx"
click node_filecard "https://github.com/shivanshidhyani/cloud-drive/blob/main/frontend/src/components/FileCard.jsx"
click node_uploadzone "https://github.com/shivanshidhyani/cloud-drive/blob/main/frontend/src/components/UploadZone.jsx"
click node_sidebar "https://github.com/shivanshidhyani/cloud-drive/blob/main/frontend/src/components/Sidebar.jsx"
click node_storagering "https://github.com/shivanshidhyani/cloud-drive/blob/main/frontend/src/components/StorageRing.jsx"
click node_sharedpage "https://github.com/shivanshidhyani/cloud-drive/blob/main/frontend/src/pages/SharedFile.jsx"
click node_filesapi "https://github.com/shivanshidhyani/cloud-drive/blob/main/frontend/src/api/files.js"
click node_httpclient "https://github.com/shivanshidhyani/cloud-drive/blob/main/frontend/src/api/client.js"
click node_backendserver "https://github.com/shivanshidhyani/cloud-drive/blob/main/backend/server.js"
click node_authroutes "https://github.com/shivanshidhyani/cloud-drive/blob/main/backend/routes/auth.js"
click node_fileroutes "https://github.com/shivanshidhyani/cloud-drive/blob/main/backend/routes/files.js"
click node_shareroutes "https://github.com/shivanshidhyani/cloud-drive/blob/main/backend/routes/share.js"
click node_authmiddleware "https://github.com/shivanshidhyani/cloud-drive/blob/main/backend/middleware/auth.js"
click node_userrecords "https://github.com/shivanshidhyani/cloud-drive/blob/main/backend/models/User.js"
click node_filerecords "https://github.com/shivanshidhyani/cloud-drive/blob/main/backend/models/File.js"
click node_dbconfig "https://github.com/shivanshidhyani/cloud-drive/blob/main/backend/config/db.js"
click node_s3helper "https://github.com/shivanshidhyani/cloud-drive/blob/main/backend/utils/s3.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_authpages,node_authlayout,node_authcontext,node_dashboard,node_filecard,node_uploadzone,node_sidebar,node_storagering,node_sharedpage,node_filesapi,node_httpclient,node_user toneBlue
class node_backendserver,node_authroutes,node_fileroutes,node_shareroutes,node_authmiddleware,node_mongo,node_s3 toneAmber
class node_userrecords,node_filerecords,node_dbconfig,node_s3helper toneMint
```

## Components

### Frontend experience

- [Route application](https://github.com/shivanshidhyani/cloud-drive/blob/main/frontend/src/App.jsx): `frontend/src/App.jsx`
- [Login and signup](https://github.com/shivanshidhyani/cloud-drive/tree/main/frontend/src/pages): `frontend/src/pages`
- [Auth layout](https://github.com/shivanshidhyani/cloud-drive/blob/main/frontend/src/components/AuthLayout.jsx): `frontend/src/components/AuthLayout.jsx`
- [Auth state](https://github.com/shivanshidhyani/cloud-drive/blob/main/frontend/src/context/AuthContext.jsx): `frontend/src/context/AuthContext.jsx`
- [Dashboard](https://github.com/shivanshidhyani/cloud-drive/blob/main/frontend/src/pages/Dashboard.jsx): `frontend/src/pages/Dashboard.jsx`
- [File card](https://github.com/shivanshidhyani/cloud-drive/blob/main/frontend/src/components/FileCard.jsx): `frontend/src/components/FileCard.jsx`
- [Upload zone](https://github.com/shivanshidhyani/cloud-drive/blob/main/frontend/src/components/UploadZone.jsx): `frontend/src/components/UploadZone.jsx`
- [Sidebar](https://github.com/shivanshidhyani/cloud-drive/blob/main/frontend/src/components/Sidebar.jsx): `frontend/src/components/Sidebar.jsx`
- [Storage ring](https://github.com/shivanshidhyani/cloud-drive/blob/main/frontend/src/components/StorageRing.jsx): `frontend/src/components/StorageRing.jsx`
- [Shared file page](https://github.com/shivanshidhyani/cloud-drive/blob/main/frontend/src/pages/SharedFile.jsx): `frontend/src/pages/SharedFile.jsx`
- [File API client](https://github.com/shivanshidhyani/cloud-drive/blob/main/frontend/src/api/files.js): `frontend/src/api/files.js`
- [HTTP client](https://github.com/shivanshidhyani/cloud-drive/blob/main/frontend/src/api/client.js): `frontend/src/api/client.js`

### Backend API

- [API server](https://github.com/shivanshidhyani/cloud-drive/blob/main/backend/server.js): `backend/server.js`
- [Auth routes](https://github.com/shivanshidhyani/cloud-drive/blob/main/backend/routes/auth.js): `backend/routes/auth.js`
- [File routes](https://github.com/shivanshidhyani/cloud-drive/blob/main/backend/routes/files.js): `backend/routes/files.js`
- [Share routes](https://github.com/shivanshidhyani/cloud-drive/blob/main/backend/routes/share.js): `backend/routes/share.js`
- [JWT middleware](https://github.com/shivanshidhyani/cloud-drive/blob/main/backend/middleware/auth.js): `backend/middleware/auth.js`

### Data and storage

- [User records](https://github.com/shivanshidhyani/cloud-drive/blob/main/backend/models/User.js): `backend/models/User.js`
- [File metadata](https://github.com/shivanshidhyani/cloud-drive/blob/main/backend/models/File.js): `backend/models/File.js`
- [Database connection](https://github.com/shivanshidhyani/cloud-drive/blob/main/backend/config/db.js): `backend/config/db.js`
- [S3 operations](https://github.com/shivanshidhyani/cloud-drive/blob/main/backend/utils/s3.js): `backend/utils/s3.js`

### Other components

- **User**
- **MongoDB**
- **AWS S3**

## Connections

- User → Route application: uses (evidence: `frontend/src/App.jsx`)
- Route application → Login and signup: routes to (evidence: `frontend/src/App.jsx`)
- Route application → Dashboard: routes to (evidence: `frontend/src/App.jsx`)
- Route application → Shared file page: routes to (evidence: `frontend/src/App.jsx`)
- Login and signup → Auth layout: renders (evidence: `frontend/src/pages/Login.jsx`)
- Login and signup → Auth state: uses (evidence: `frontend/src/pages/Login.jsx`)
- Auth state → API server: auth requests
- API server → Auth routes: mounts (evidence: `backend/server.js`)
- API server → File routes: mounts (evidence: `backend/server.js`)
- API server → Share routes: mounts (evidence: `backend/server.js`)
- API server → Database connection: connects (evidence: `backend/server.js`)
- Auth routes → User records: reads and writes (evidence: `backend/routes/auth.js`)
- File routes → JWT middleware: requires (evidence: `backend/routes/files.js`)
- File routes → File metadata: reads and writes (evidence: `backend/routes/files.js`)
- File routes → S3 operations: requests storage operations (evidence: `backend/routes/files.js`)
- Share routes → File metadata: references (evidence: `backend/routes/share.js`)
- Share routes → S3 operations: references (evidence: `backend/routes/share.js`)
- Database connection → MongoDB: connects
- User records → MongoDB: persists in
- File metadata → MongoDB: persists in
- S3 operations → AWS S3: operates on (evidence: `backend/utils/s3.js`)
- Dashboard → Sidebar: renders (evidence: `frontend/src/pages/Dashboard.jsx`)
- Dashboard → Upload zone: renders (evidence: `frontend/src/pages/Dashboard.jsx`)
- Dashboard → File card: renders (evidence: `frontend/src/pages/Dashboard.jsx`)
- Sidebar → Storage ring: renders (evidence: `frontend/src/components/Sidebar.jsx`)
- Upload zone → File API client: requests uploads (evidence: `frontend/src/components/UploadZone.jsx`)
- File card → File API client: requests file actions (evidence: `frontend/src/components/FileCard.jsx`)
- Shared file page → File API client: requests shared download (evidence: `frontend/src/pages/SharedFile.jsx`)
- File API client → HTTP client: sends API requests (evidence: `frontend/src/api/files.js`)
- File API client → AWS S3: uploads bytes directly (evidence: `frontend/src/api/files.js`)
- HTTP client → API server: calls API
