# gurian43/share-your-thing architecture

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

- Interactive diagram: https://gitdiagram.com/gurian43/share-your-thing
- Repository: https://github.com/gurian43/share-your-thing

## Overview

Share Your Thing is a full-stack file-sharing application. Users register and authenticate, upload files, manage sharing and access settings, and browse or download shared files; administrators manage site settings, users’ files, and reports. The frontend routes these experiences, while Express routes dispatch API requests to controllers that use MongoDB models and file encryption. The README also documents email notifications and Cloudflare Turnstile. Connections reflect the sampled source and index; unsampled page and controller internals are represented only where their roles are supported by the tree or documentation.

Main entry points: [`frontend/src/App.jsx`](https://github.com/gurian43/share-your-thing/blob/main/frontend/src/App.jsx) (Page routing), [`backend/controllers/file.controller.js`](https://github.com/gurian43/share-your-thing/blob/main/backend/controllers/file.controller.js) (File workflows), [`backend/controllers/user.controller.js`](https://github.com/gurian43/share-your-thing/blob/main/backend/controllers/user.controller.js) (User workflows), [`backend/controllers/admin.controller.js`](https://github.com/gurian43/share-your-thing/blob/main/backend/controllers/admin.controller.js) (Admin workflows)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_client["Web application"]
  node_frontend["Page routing<br/>[App.jsx]"]
  node_authui["Authentication state<br/>[AuthContext.jsx]"]
  node_register["Registration<br/>[RegisterPage.jsx]"]
  node_dashboard["File dashboard<br/>[DashboardPage.jsx]"]
  node_uploadui["Upload interface<br/>[UploadDialog.jsx]"]
  node_browse["Public browsing<br/>[BrowsePage.jsx]"]
  node_filepage["Shared file page<br/>[FilePage.jsx]"]
  node_profile["User profiles<br/>[ProfilePage.jsx]"]
  node_account["Account management<br/>[AccountPage.jsx]"]
  node_adminui["Admin console<br/>[AdminPage.jsx]"]
end

subgraph group_api["API and workflows"]
  node_server["HTTP server<br/>[server.js]"]
  node_userapi["User workflows<br/>[user.controller.js]"]
  node_fileapi["File workflows<br/>[file.controller.js]"]
  node_reports["Report handling"]
  node_adminapi["Admin workflows"]
end

subgraph group_data["Persistence and files"]
  node_database[("MongoDB<br/>[db.js]")]
  node_filemodel[("File records<br/>[file.model.js]")]
  node_usermodel[("User records<br/>[user.model.js]")]
  node_settings[("Site settings")]
  node_uploads["File storage<br/>[file.controller.js]"]
  node_encryption["File encryption"]
end

subgraph group_integrations["External services"]
  node_email["Email delivery<br/>[emailService.js]"]
  node_captcha["Bot verification<br/>[turnstile.js]"]
  node_smtp(("SMTP provider"))
  node_turnstile(("Cloudflare Turnstile"))
end

node_visitor(("Visitor or user"))

node_visitor -->|"uses"| node_frontend
node_frontend -->|"routes to"| node_register
node_frontend -->|"routes to"| node_dashboard
node_frontend -->|"routes to"| node_browse
node_frontend -->|"routes to"| node_filepage
node_frontend -->|"routes to"| node_profile
node_frontend -->|"routes to"| node_account
node_frontend -->|"routes to"| node_adminui
node_dashboard -->|"uses"| node_uploadui
node_authui -->|"requests identity"| node_userapi
node_server -->|"routes requests"| node_userapi
node_server -->|"routes requests"| node_fileapi
node_server -->|"routes requests"| node_adminapi
node_userapi -->|"reads and writes"| node_usermodel
node_userapi -->|"sends tokens"| node_email
node_userapi -->|"verifies signup"| node_captcha
node_fileapi -->|"reads and writes"| node_filemodel
node_fileapi -->|"reads"| node_usermodel
node_fileapi -->|"reads"| node_settings
node_fileapi -->|"encrypts and decrypts"| node_encryption
node_fileapi -->|"reads and writes"| node_uploads
node_reports -->|"reads"| node_filemodel
node_adminapi -->|"manages"| node_filemodel
node_adminapi -->|"reads"| node_usermodel
node_adminapi -->|"reads and writes"| node_settings
node_email -->|"sends mail"| node_smtp
node_captcha -.->|"verifies token"| node_turnstile

click node_frontend "https://github.com/gurian43/share-your-thing/blob/main/frontend/src/App.jsx"
click node_authui "https://github.com/gurian43/share-your-thing/blob/main/frontend/src/context/AuthContext.jsx"
click node_register "https://github.com/gurian43/share-your-thing/blob/main/frontend/src/pages/RegisterPage.jsx"
click node_dashboard "https://github.com/gurian43/share-your-thing/blob/main/frontend/src/pages/DashboardPage.jsx"
click node_uploadui "https://github.com/gurian43/share-your-thing/blob/main/frontend/src/components/dashboard/UploadDialog.jsx"
click node_browse "https://github.com/gurian43/share-your-thing/blob/main/frontend/src/pages/BrowsePage.jsx"
click node_filepage "https://github.com/gurian43/share-your-thing/blob/main/frontend/src/pages/FilePage.jsx"
click node_profile "https://github.com/gurian43/share-your-thing/blob/main/frontend/src/pages/ProfilePage.jsx"
click node_account "https://github.com/gurian43/share-your-thing/blob/main/frontend/src/pages/AccountPage.jsx"
click node_adminui "https://github.com/gurian43/share-your-thing/blob/main/frontend/src/pages/AdminPage.jsx"
click node_server "https://github.com/gurian43/share-your-thing/blob/main/backend/server.js"
click node_userapi "https://github.com/gurian43/share-your-thing/blob/main/backend/controllers/user.controller.js"
click node_fileapi "https://github.com/gurian43/share-your-thing/blob/main/backend/controllers/file.controller.js"
click node_reports "https://github.com/gurian43/share-your-thing/blob/main/backend/controllers/report.controller.js"
click node_adminapi "https://github.com/gurian43/share-your-thing/blob/main/backend/controllers/admin.controller.js"
click node_database "https://github.com/gurian43/share-your-thing/blob/main/backend/config/db.js"
click node_filemodel "https://github.com/gurian43/share-your-thing/blob/main/backend/models/file.model.js"
click node_usermodel "https://github.com/gurian43/share-your-thing/blob/main/backend/models/user.model.js"
click node_settings "https://github.com/gurian43/share-your-thing/blob/main/backend/models/siteSetting.model.js"
click node_uploads "https://github.com/gurian43/share-your-thing/blob/main/backend/controllers/file.controller.js"
click node_encryption "https://github.com/gurian43/share-your-thing/blob/main/backend/services/encryptionService.js"
click node_email "https://github.com/gurian43/share-your-thing/blob/main/backend/services/emailService.js"
click node_captcha "https://github.com/gurian43/share-your-thing/blob/main/backend/services/turnstile.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_frontend,node_authui,node_register,node_dashboard,node_uploadui,node_browse,node_filepage,node_profile,node_account,node_adminui,node_visitor toneBlue
class node_server,node_userapi,node_fileapi,node_reports,node_adminapi toneAmber
class node_database,node_filemodel,node_usermodel,node_settings,node_uploads,node_encryption toneMint
class node_email,node_captcha,node_smtp,node_turnstile toneRose
```

## Components

### Web application

- [Page routing](https://github.com/gurian43/share-your-thing/blob/main/frontend/src/App.jsx): `frontend/src/App.jsx`
- [Authentication state](https://github.com/gurian43/share-your-thing/blob/main/frontend/src/context/AuthContext.jsx): `frontend/src/context/AuthContext.jsx`
- [Registration](https://github.com/gurian43/share-your-thing/blob/main/frontend/src/pages/RegisterPage.jsx): `frontend/src/pages/RegisterPage.jsx`
- [File dashboard](https://github.com/gurian43/share-your-thing/blob/main/frontend/src/pages/DashboardPage.jsx): `frontend/src/pages/DashboardPage.jsx`
- [Upload interface](https://github.com/gurian43/share-your-thing/blob/main/frontend/src/components/dashboard/UploadDialog.jsx): `frontend/src/components/dashboard/UploadDialog.jsx`
- [Public browsing](https://github.com/gurian43/share-your-thing/blob/main/frontend/src/pages/BrowsePage.jsx): `frontend/src/pages/BrowsePage.jsx`
- [Shared file page](https://github.com/gurian43/share-your-thing/blob/main/frontend/src/pages/FilePage.jsx): `frontend/src/pages/FilePage.jsx`
- [User profiles](https://github.com/gurian43/share-your-thing/blob/main/frontend/src/pages/ProfilePage.jsx): `frontend/src/pages/ProfilePage.jsx`
- [Account management](https://github.com/gurian43/share-your-thing/blob/main/frontend/src/pages/AccountPage.jsx): `frontend/src/pages/AccountPage.jsx`
- [Admin console](https://github.com/gurian43/share-your-thing/blob/main/frontend/src/pages/AdminPage.jsx): `frontend/src/pages/AdminPage.jsx`

### API and workflows

- [HTTP server](https://github.com/gurian43/share-your-thing/blob/main/backend/server.js): `backend/server.js`
- [User workflows](https://github.com/gurian43/share-your-thing/blob/main/backend/controllers/user.controller.js): `backend/controllers/user.controller.js`
- [File workflows](https://github.com/gurian43/share-your-thing/blob/main/backend/controllers/file.controller.js): `backend/controllers/file.controller.js`
- [Report handling](https://github.com/gurian43/share-your-thing/blob/main/backend/controllers/report.controller.js): `backend/controllers/report.controller.js`
- [Admin workflows](https://github.com/gurian43/share-your-thing/blob/main/backend/controllers/admin.controller.js): `backend/controllers/admin.controller.js`

### Persistence and files

- [MongoDB](https://github.com/gurian43/share-your-thing/blob/main/backend/config/db.js): `backend/config/db.js`
- [File records](https://github.com/gurian43/share-your-thing/blob/main/backend/models/file.model.js): `backend/models/file.model.js`
- [User records](https://github.com/gurian43/share-your-thing/blob/main/backend/models/user.model.js): `backend/models/user.model.js`
- [Site settings](https://github.com/gurian43/share-your-thing/blob/main/backend/models/siteSetting.model.js): `backend/models/siteSetting.model.js`
- [File storage](https://github.com/gurian43/share-your-thing/blob/main/backend/controllers/file.controller.js): `backend/controllers/file.controller.js`
- [File encryption](https://github.com/gurian43/share-your-thing/blob/main/backend/services/encryptionService.js): `backend/services/encryptionService.js`

### External services

- [Email delivery](https://github.com/gurian43/share-your-thing/blob/main/backend/services/emailService.js): `backend/services/emailService.js`
- [Bot verification](https://github.com/gurian43/share-your-thing/blob/main/backend/services/turnstile.js): `backend/services/turnstile.js`
- **SMTP provider**
- **Cloudflare Turnstile**

### Other components

- **Visitor or user**

## Connections

- Visitor or user → Page routing: uses (evidence: `frontend/src/App.jsx`)
- Page routing → Registration: routes to (evidence: `frontend/src/App.jsx`)
- Page routing → File dashboard: routes to (evidence: `frontend/src/App.jsx`)
- Page routing → Public browsing: routes to (evidence: `frontend/src/App.jsx`)
- Page routing → Shared file page: routes to (evidence: `frontend/src/App.jsx`)
- Page routing → User profiles: routes to (evidence: `frontend/src/App.jsx`)
- Page routing → Account management: routes to (evidence: `frontend/src/App.jsx`)
- Page routing → Admin console: routes to (evidence: `frontend/src/App.jsx`)
- File dashboard → Upload interface: uses (evidence: `frontend/src/components/dashboard/UploadDialog.jsx`)
- Authentication state → User workflows: requests identity (evidence: `frontend/src/context/AuthContext.jsx`)
- HTTP server → User workflows: routes requests (evidence: `backend/server.js`)
- HTTP server → File workflows: routes requests (evidence: `backend/server.js`)
- HTTP server → Admin workflows: routes requests (evidence: `backend/server.js`)
- User workflows → User records: reads and writes (evidence: `backend/controllers/user.controller.js`)
- User workflows → Email delivery: sends tokens (evidence: `backend/controllers/user.controller.js`)
- User workflows → Bot verification: verifies signup (evidence: `backend/controllers/user.controller.js`)
- File workflows → File records: reads and writes (evidence: `backend/controllers/file.controller.js`)
- File workflows → User records: reads (evidence: `backend/controllers/file.controller.js`)
- File workflows → Site settings: reads (evidence: `backend/controllers/file.controller.js`)
- File workflows → File encryption: encrypts and decrypts (evidence: `backend/controllers/file.controller.js`)
- File workflows → File storage: reads and writes (evidence: `backend/controllers/file.controller.js`)
- Report handling → File records: reads (evidence: `backend/controllers/report.controller.js`)
- Admin workflows → File records: manages (evidence: `backend/controllers/admin.controller.js`)
- Admin workflows → User records: reads (evidence: `backend/controllers/admin.controller.js`)
- Admin workflows → Site settings: reads and writes (evidence: `backend/controllers/admin.controller.js`)
- Email delivery → SMTP provider: sends mail (evidence: `backend/services/emailService.js`)
- Bot verification → Cloudflare Turnstile: verifies token
