# rohitt-prog/cloudvault architecture

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

- Interactive diagram: https://gitdiagram.com/rohitt-prog/cloudvault
- Repository: https://github.com/rohitt-prog/cloudvault

## Overview

CloudShare is a multi-tenant cloud file manager with authenticated owners and public guest sharing. Owners register or sign in, upload and manage files, then create expiring share links; guests use a token to view metadata or download through a short-lived signed URL. The map separates client workflows, Supabase-backed identity and persistence, and the privileged sharing boundary. The README documents the broader security architecture; source excerpts verify key service calls and edge-function operations, while some UI wiring is not sampled.

Main entry points: [`frontend/src/features/sharing/services/share.service.ts`](https://github.com/rohitt-prog/cloudvault/blob/main/frontend/src/features/sharing/services/share.service.ts) (Sharing service), [`frontend/src/features/files/services/file.service.ts`](https://github.com/rohitt-prog/cloudvault/blob/main/frontend/src/features/files/services/file.service.ts) (File operations), [`backend/supabase/functions/access-shared-file/index.ts`](https://github.com/rohitt-prog/cloudvault/blob/main/backend/supabase/functions/access-shared-file/index.ts) (Guest access boundary), [`frontend/src/app/router.tsx`](https://github.com/rohitt-prog/cloudvault/blob/main/frontend/src/app/router.tsx) (Route handling)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_client["Web application"]
  node_app["Application entry<br/>[App.tsx]"]
  node_router["Route handling<br/>[router.tsx]"]
  node_dashboard["File dashboard<br/>[DashboardPage.tsx]"]
  node_sharedpage["Guest file page<br/>[SharedFilePage.tsx]"]
end

subgraph group_identity["Identity"]
  node_login["Login and registration<br/>[LoginForm.tsx]"]
  node_authprovider["Session context<br/>[AuthProvider.tsx]"]
  node_authservice["Authentication service<br/>[auth.service.ts]"]
end

subgraph group_files["File management"]
  node_fileui["File explorer and upload<br/>[FileUpload.tsx]"]
  node_filehook["File workflow state<br/>[useFiles.ts]"]
  node_fileservice["File operations<br/>[file.service.ts]"]
  node_filetypes["File validation and paths<br/>[types.ts]"]
end

subgraph group_sharing["Secure sharing"]
  node_sharingui["Share-link controls<br/>[ShareModal.tsx]"]
  node_sharehook["Sharing workflow state<br/>[useShare.ts]"]
  node_shareservice["Sharing service<br/>[share.service.ts]"]
  node_crypto["Token utilities<br/>[sharing-crypto.ts]"]
  node_createfn["Create share link<br/>[index.ts]"]
  node_accessfn["Guest access boundary<br/>[index.ts]"]
  node_security["Share security helpers<br/>[share-security.ts]"]
end

subgraph group_platform["Supabase platform"]
  node_auth["Supabase Auth"]
  node_dbtypes["Database schema types<br/>[database.ts]"]
  node_database[("PostgreSQL metadata")]
  node_storage[("Private file storage")]
  node_supabaseclient["Supabase client<br/>[supabase.ts]"]
end

node_owner(("File owner"))
node_guest(("Guest recipient"))

node_owner -->|"uses application"| node_app
node_guest -->|"opens shared route"| node_app
node_app -->|"renders routes"| node_router
node_router -->|"routes to dashboard"| node_dashboard
node_router -->|"routes to token page"| node_sharedpage
node_owner -->|"submits credentials"| node_login
node_login -.->|"uses session context"| node_authprovider
node_authprovider -.->|"manages session"| node_authservice
node_authservice -->|"authenticates"| node_auth
node_auth -->|"provisions profile"| node_database
node_dashboard -->|"presents file tools"| node_fileui
node_fileui -.->|"uses file workflows"| node_filehook
node_filehook -->|"invokes operations"| node_fileservice
node_fileservice -->|"validates and builds paths"| node_filetypes
node_fileservice -->|"uploads and downloads objects"| node_storage
node_fileservice -->|"writes file metadata"| node_database
node_dashboard -->|"offers link sharing"| node_sharingui
node_sharingui -.->|"uses share workflows"| node_sharehook
node_sharehook -.->|"delegates operations"| node_shareservice
node_shareservice -->|"validates tokens"| node_crypto
node_shareservice -->|"invokes link creation"| node_createfn
node_createfn -->|"validates and hashes token"| node_security
node_createfn -->|"checks owner and inserts link"| node_database
node_sharedpage -->|"requests metadata or download"| node_shareservice
node_shareservice -->|"invokes guest access"| node_accessfn
node_accessfn -->|"validates and hashes token"| node_security
node_accessfn -->|"looks up share record"| node_database
node_accessfn -->|"creates signed URL"| node_storage
node_sharedpage -->|"downloads via signed URL"| node_storage
node_fileservice -->|"uses client configuration"| node_supabaseclient
node_shareservice -->|"uses client configuration"| node_supabaseclient
node_dbtypes -->|"models table schema"| node_database

click node_app "https://github.com/rohitt-prog/cloudvault/blob/main/frontend/src/App.tsx"
click node_router "https://github.com/rohitt-prog/cloudvault/blob/main/frontend/src/app/router.tsx"
click node_dashboard "https://github.com/rohitt-prog/cloudvault/blob/main/frontend/src/pages/DashboardPage.tsx"
click node_sharedpage "https://github.com/rohitt-prog/cloudvault/blob/main/frontend/src/pages/SharedFilePage.tsx"
click node_login "https://github.com/rohitt-prog/cloudvault/blob/main/frontend/src/features/auth/components/LoginForm.tsx"
click node_authprovider "https://github.com/rohitt-prog/cloudvault/blob/main/frontend/src/features/auth/context/AuthProvider.tsx"
click node_authservice "https://github.com/rohitt-prog/cloudvault/blob/main/frontend/src/features/auth/services/auth.service.ts"
click node_fileui "https://github.com/rohitt-prog/cloudvault/blob/main/frontend/src/features/files/components/FileUpload.tsx"
click node_filehook "https://github.com/rohitt-prog/cloudvault/blob/main/frontend/src/features/files/hooks/useFiles.ts"
click node_fileservice "https://github.com/rohitt-prog/cloudvault/blob/main/frontend/src/features/files/services/file.service.ts"
click node_filetypes "https://github.com/rohitt-prog/cloudvault/blob/main/frontend/src/features/files/types.ts"
click node_sharingui "https://github.com/rohitt-prog/cloudvault/blob/main/frontend/src/features/sharing/components/ShareModal.tsx"
click node_sharehook "https://github.com/rohitt-prog/cloudvault/blob/main/frontend/src/features/sharing/hooks/useShare.ts"
click node_shareservice "https://github.com/rohitt-prog/cloudvault/blob/main/frontend/src/features/sharing/services/share.service.ts"
click node_crypto "https://github.com/rohitt-prog/cloudvault/blob/main/frontend/src/features/sharing/utils/sharing-crypto.ts"
click node_createfn "https://github.com/rohitt-prog/cloudvault/blob/main/backend/supabase/functions/create-share-link/index.ts"
click node_accessfn "https://github.com/rohitt-prog/cloudvault/blob/main/backend/supabase/functions/access-shared-file/index.ts"
click node_security "https://github.com/rohitt-prog/cloudvault/blob/main/backend/supabase/functions/_shared/share-security.ts"
click node_dbtypes "https://github.com/rohitt-prog/cloudvault/blob/main/frontend/src/types/database.ts"
click node_supabaseclient "https://github.com/rohitt-prog/cloudvault/blob/main/frontend/src/lib/supabase.ts"

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_router,node_dashboard,node_sharedpage toneBlue
class node_login,node_authprovider,node_authservice toneAmber
class node_fileui,node_filehook,node_fileservice,node_filetypes toneMint
class node_sharingui,node_sharehook,node_shareservice,node_crypto,node_createfn,node_accessfn,node_security toneRose
class node_auth,node_dbtypes,node_database,node_storage,node_supabaseclient,node_owner,node_guest toneIndigo
```

## Components

### Web application

- [Application entry](https://github.com/rohitt-prog/cloudvault/blob/main/frontend/src/App.tsx): `frontend/src/App.tsx`
- [Route handling](https://github.com/rohitt-prog/cloudvault/blob/main/frontend/src/app/router.tsx): `frontend/src/app/router.tsx`
- [File dashboard](https://github.com/rohitt-prog/cloudvault/blob/main/frontend/src/pages/DashboardPage.tsx): `frontend/src/pages/DashboardPage.tsx`
- [Guest file page](https://github.com/rohitt-prog/cloudvault/blob/main/frontend/src/pages/SharedFilePage.tsx): `frontend/src/pages/SharedFilePage.tsx`

### Identity

- [Login and registration](https://github.com/rohitt-prog/cloudvault/blob/main/frontend/src/features/auth/components/LoginForm.tsx): `frontend/src/features/auth/components/LoginForm.tsx`
- [Session context](https://github.com/rohitt-prog/cloudvault/blob/main/frontend/src/features/auth/context/AuthProvider.tsx): `frontend/src/features/auth/context/AuthProvider.tsx`
- [Authentication service](https://github.com/rohitt-prog/cloudvault/blob/main/frontend/src/features/auth/services/auth.service.ts): `frontend/src/features/auth/services/auth.service.ts`

### File management

- [File explorer and upload](https://github.com/rohitt-prog/cloudvault/blob/main/frontend/src/features/files/components/FileUpload.tsx): `frontend/src/features/files/components/FileUpload.tsx`
- [File workflow state](https://github.com/rohitt-prog/cloudvault/blob/main/frontend/src/features/files/hooks/useFiles.ts): `frontend/src/features/files/hooks/useFiles.ts`
- [File operations](https://github.com/rohitt-prog/cloudvault/blob/main/frontend/src/features/files/services/file.service.ts): `frontend/src/features/files/services/file.service.ts`
- [File validation and paths](https://github.com/rohitt-prog/cloudvault/blob/main/frontend/src/features/files/types.ts): `frontend/src/features/files/types.ts`

### Secure sharing

- [Share-link controls](https://github.com/rohitt-prog/cloudvault/blob/main/frontend/src/features/sharing/components/ShareModal.tsx): `frontend/src/features/sharing/components/ShareModal.tsx`
- [Sharing workflow state](https://github.com/rohitt-prog/cloudvault/blob/main/frontend/src/features/sharing/hooks/useShare.ts): `frontend/src/features/sharing/hooks/useShare.ts`
- [Sharing service](https://github.com/rohitt-prog/cloudvault/blob/main/frontend/src/features/sharing/services/share.service.ts): `frontend/src/features/sharing/services/share.service.ts`
- [Token utilities](https://github.com/rohitt-prog/cloudvault/blob/main/frontend/src/features/sharing/utils/sharing-crypto.ts): `frontend/src/features/sharing/utils/sharing-crypto.ts`
- [Create share link](https://github.com/rohitt-prog/cloudvault/blob/main/backend/supabase/functions/create-share-link/index.ts): `backend/supabase/functions/create-share-link/index.ts`
- [Guest access boundary](https://github.com/rohitt-prog/cloudvault/blob/main/backend/supabase/functions/access-shared-file/index.ts): `backend/supabase/functions/access-shared-file/index.ts`
- [Share security helpers](https://github.com/rohitt-prog/cloudvault/blob/main/backend/supabase/functions/_shared/share-security.ts): `backend/supabase/functions/_shared/share-security.ts`

### Supabase platform

- **Supabase Auth**
- [Database schema types](https://github.com/rohitt-prog/cloudvault/blob/main/frontend/src/types/database.ts): `frontend/src/types/database.ts`
- **PostgreSQL metadata**
- **Private file storage**
- [Supabase client](https://github.com/rohitt-prog/cloudvault/blob/main/frontend/src/lib/supabase.ts): `frontend/src/lib/supabase.ts`

### Other components

- **File owner**
- **Guest recipient**

## Connections

- File owner → Application entry: uses application
- Guest recipient → Application entry: opens shared route
- Application entry → Route handling: renders routes
- Route handling → File dashboard: routes to dashboard
- Route handling → Guest file page: routes to token page
- File owner → Login and registration: submits credentials
- Login and registration → Session context: uses session context
- Session context → Authentication service: manages session
- Authentication service → Supabase Auth: authenticates (evidence: `frontend/src/features/auth/services/auth.service.ts`)
- Supabase Auth → PostgreSQL metadata: provisions profile
- File dashboard → File explorer and upload: presents file tools
- File explorer and upload → File workflow state: uses file workflows
- File workflow state → File operations: invokes operations (evidence: `frontend/src/features/files/hooks/useFiles.ts`)
- File operations → File validation and paths: validates and builds paths (evidence: `frontend/src/features/files/services/file.service.ts`)
- File operations → Private file storage: uploads and downloads objects (evidence: `frontend/src/features/files/services/file.service.ts`)
- File operations → PostgreSQL metadata: writes file metadata (evidence: `frontend/src/features/files/services/file.service.ts`)
- File dashboard → Share-link controls: offers link sharing
- Share-link controls → Sharing workflow state: uses share workflows
- Sharing workflow state → Sharing service: delegates operations
- Sharing service → Token utilities: validates tokens (evidence: `frontend/src/features/sharing/services/share.service.ts`)
- Sharing service → Create share link: invokes link creation (evidence: `frontend/src/features/sharing/services/share.service.ts`)
- Create share link → Share security helpers: validates and hashes token (evidence: `backend/supabase/functions/create-share-link/index.ts`)
- Create share link → PostgreSQL metadata: checks owner and inserts link (evidence: `backend/supabase/functions/create-share-link/index.ts`)
- Guest file page → Sharing service: requests metadata or download
- Sharing service → Guest access boundary: invokes guest access (evidence: `frontend/src/features/sharing/services/share.service.ts`)
- Guest access boundary → Share security helpers: validates and hashes token (evidence: `backend/supabase/functions/access-shared-file/index.ts`)
- Guest access boundary → PostgreSQL metadata: looks up share record (evidence: `backend/supabase/functions/access-shared-file/index.ts`)
- Guest access boundary → Private file storage: creates signed URL (evidence: `backend/supabase/functions/access-shared-file/index.ts`)
- Guest file page → Private file storage: downloads via signed URL
- File operations → Supabase client: uses client configuration (evidence: `frontend/src/features/files/services/file.service.ts`)
- Sharing service → Supabase client: uses client configuration (evidence: `frontend/src/features/sharing/services/share.service.ts`)
- Database schema types → PostgreSQL metadata: models table schema (evidence: `frontend/src/types/database.ts`)
