How nijamgouri60/cloudvault_filesharing works
CloudVault is a browser-based secure file-sharing platform. Users authenticate, upload files in resumable chunks, manage access or public links, and view or download files; admins monitor activity, while readers can ask questions about supported documents. The backend connects HTTP routes to file services and MongoDB/GridFS, and bridges internal events to browser dashboards over Socket.io. The upload service, authentication, and AI paths are supported by sampled source; other feature links reflect README documentation, since their route implementations were not sampled.
Main entry points: worker.js HTTP and socket worker · fileService.js Chunk and file service · index.html CloudVault UI · auth.js JWT authentication
Components 29
Browser experience
- CloudVault UI
frontend/index.html - File workspace
frontend/js/app.js - Upload client
frontend/js/upload.js - Public share page
frontend/js/share.js - Admin dashboard
frontend/js/dashboard.js
HTTP API
- HTTP and socket worker
backend/worker.js - Auth routes
backend/routes/auth.js - Upload routes
backend/routes/upload.js - File routes
backend/routes/files.js - Share-link routes
backend/routes/shareLinks.js - View and download
backend/routes/view.js - Admin routes
backend/routes/admin.js - Document AI route
backend/routes/ai.js
File lifecycle
- Chunk and file service
backend/services/fileService.js - Upload sessions
backend/models/UploadSession.js - File metadata
backend/models/FileMeta.js - MongoDB and GridFS
backend/config/db.js - Stale session cleanup
backend/services/cleanupService.js
Identity and sharing
- JWT authentication
backend/middleware/auth.js - File access checks
backend/middleware/rbac.js - User records
backend/models/User.js - File permissions
backend/models/Permission.js - Share link records
backend/models/ShareLink.js
Events and operations
- Event bus
backend/services/eventBus.js - Live event delivery
backend/services/socketService.js - Activity records
backend/models/EventLog.js
Other components
- User
- Admin
- Local Ollama model
Connections 43
- User → CloudVault UI: uses
- Admin → CloudVault UI: uses
- CloudVault UI → File workspace: loads
- CloudVault UI → Upload client: loads
- CloudVault UI → Public share page: loads
- CloudVault UI → Admin dashboard: loads
- File workspace → HTTP and socket worker: calls API
- Upload client → HTTP and socket worker: uploads chunks
- Public share page → HTTP and socket worker: requests link
- Admin dashboard → HTTP and socket worker: requests status
- HTTP and socket worker → Auth routes: mounts
- HTTP and socket worker → Upload routes: mounts
- HTTP and socket worker → File routes: mounts
- HTTP and socket worker → Share-link routes: mounts
- HTTP and socket worker → View and download: mounts
- HTTP and socket worker → Admin routes: mounts
- HTTP and socket worker → Document AI route: mounts
- Auth routes → User records: reads/writes
- Auth routes → JWT authentication: issues JWT
- Upload routes → JWT authentication: checks token
- File routes → JWT authentication: checks token
- Share-link routes → JWT authentication: checks token
- View and download → JWT authentication: checks token
- Document AI route → JWT authentication: checks token
- Document AI route → File access checks: checks file access
- File routes → File permissions: manages access
- Share-link routes → Share link records: manages links
- Upload routes → Chunk and file service: handles uploads
- Chunk and file service → Upload sessions: tracks chunks
- Chunk and file service → File metadata: writes metadata
- Chunk and file service → MongoDB and GridFS: streams files
- View and download → Chunk and file service: streams content
- Document AI route → Chunk and file service: reads document
- Document AI route → Local Ollama model: asks questions
- Chunk and file service → Event bus: publishes events
- Stale session cleanup → Upload sessions: expires stale
- Stale session cleanup → Chunk and file service: removes chunks
- Stale session cleanup → Event bus: publishes expiry
- HTTP and socket worker → Stale session cleanup: starts sweep
- HTTP and socket worker → Live event delivery: attaches
- Live event delivery → Event bus: forwards events
- Live event delivery → Admin dashboard: pushes updates
- Admin routes → Activity records: reads activity