How mrinmoypatra-pravaah/file-sharing-app works
1. This repo is a Firebase-backed file sharing application split into two major runtimes: a React single-page app in src/, and Firebase Cloud Functions in functions/. The frontend is built with Vite and deployed via Firebase Hosting.
2. The frontend is the primary user interface layer. src/main.jsx bootstraps the app, src/App.jsx likely defines the route structure, and src/pages/ contains the main screens: login, registration, dashboard, and a shared-file view.
3. Authentication is handled on the client with a dedicated Redux feature slice in src/features/auth/authSlice.js. The presence of ProtectedRoute.jsx indicates route-level access control, so authenticated and unauthenticated flows are separated at the routing boundary.
4. File state is also centralized in Redux via src/features/files/filesSlice.js. This suggests the app keeps upload/list/share metadata in client state, with components reading and dispatching from that store rather than managing file data locally in each view.
5. The dashboard area is composed from small UI components: FileUpload.jsx for sending files, FileList.jsx for browsing owned files, and ReceivedFiles.jsx for files shared with the user. Navbar.jsx provides global navigation and likely auth-aware actions such as sign out.
6. Firebase is the central backend platform. src/firebase.js is the client-side integration point, and the repo includes firestore.rules, firestore.indexes.json, and storage.rules, which means the app uses Firestore for metadata, Cloud Storage for file blobs, and security rules to enforce access control.
7. Data flow is likely split between metadata and binary content: file records, ownership, sharing state, and user associations live in Firestore, while the actual uploaded file content lives in Firebase Storage. The UI then combines both to render lists, shared access, and download/open actions.
8. The functions/ directory is a serverless backend boundary. Its index.js is the entry point for Firebase Cloud Functions, and functions/README.md plus .env.example suggest environment-based configuration. These functions probably handle backend-side file-sharing logic, notifications, or Firestore/Storage triggers that should not run on the client.
9. SharedFile.jsx represents an important public or semi-public access path. That page likely handles viewing or downloading a file via a share link or access token, separated from the authenticated dashboard flow.
10. Deployment and infrastructure are Firebase-native: firebase.json, .firebaserc, Hosting cache files, and the rules/index config show a typical Firebase app shape where the SPA is served from Hosting, client state talks directly to Firebase services, and Functions provide server-side extensions.
11. The project also includes standard frontend build tooling: Vite, Tailwind CSS (tailwind.config.js), PostCSS, and CSS entry points in src/App.css and src/index.css. These affect presentation and build output but not the core backend architecture.
12. For an architecture diagram, the key boundaries are: browser UI and Redux state, Firebase Auth/Firestore/Storage, and Cloud Functions. The main data path is user action in React → Redux/UI update → Firebase reads/writes → security rules enforcement → optional serverless function processing → updated file lists/shared-file views.
Main entry points: App.jsx App shell · Dashboard.jsx Dashboard · firebase.js Firebase client · filesSlice.js Files state
Components 21
Frontend
React SPA, routes, UI, and client state
- App boot · Bootstraps the React application
src/main.jsx - App shell · Top-level app composition and route structure
src/App.jsx - Login · Sign-in screen
src/pages/Login.jsx - Register · Account creation screen
src/pages/Register.jsx - Dashboard · Authenticated file management view
src/pages/Dashboard.jsx - Shared file · File access view for shared links or tokens
src/pages/SharedFile.jsx - Protected route · Route-level authentication gate
src/components/ProtectedRoute.jsx - Navbar · Global navigation and session actions
src/components/Navbar.jsx - Upload · File upload interaction
src/components/FileUpload.jsx - File list · Owned file browsing and actions
src/components/FileList.jsx - Received · Files shared with the signed-in user
src/components/ReceivedFiles.jsx - Auth state · Client authentication state and actions
src/features/auth/authSlice.js - Files state · Client file metadata and sharing state
src/features/files/filesSlice.js
Firebase backend
Firestore, Storage, Auth integration, and Cloud Functions
- Firebase client · Client-side Firebase initialization and service access
src/firebase.js - Functions · Serverless backend entry point
functions/index.js - Firestore rules · Access control for metadata reads and writes
firestore.rules - Storage rules · Access control for file blob uploads and downloads
storage.rules
Infra/build
Hosting, rules, and build configuration
- Hosting · Firebase Hosting and deployment wiring
firebase.json - Indexes · Firestore index definitions
firestore.indexes.json - Vite build · Frontend bundling and dev server configuration
vite.config.js - Tailwind · Utility CSS configuration
tailwind.config.js
Connections 21
- App boot → App shell: mounts · Bootstraps the app shell
- App shell → Login: routes · Unauthenticated entry flow
- App shell → Register: routes · Account creation flow
- App shell → Protected route: guards · Wraps private routes
- Protected route → Dashboard: allows · Authenticated dashboard entry
- App shell → Shared file: routes · Public shared-file access path
- Dashboard → Navbar: uses · Global navigation within the private area
- Dashboard → Upload: composes · Upload workflow
- Dashboard → File list: composes · Owned files workflow
- Dashboard → Received: composes · Shared-in files workflow
- App shell → Auth state: reads/writes · Coordinates authentication state
- Dashboard → Files state: reads/writes · Coordinates file metadata state
- Auth state → Firebase client: auth · Uses Firebase auth services
- Files state → Firebase client: data · Uses Firestore and Storage through the client SDK
- Firebase client → Firestore rules: governed by · Metadata access is enforced by rules
- Firebase client → Storage rules: governed by · Blob access is enforced by rules
- Functions → Firebase client: extends · Serverless backend complements the client app
- Hosting → App shell: serves · Hosting delivers the SPA
- Vite build → App boot: builds · Frontend bundling entry point
- Tailwind → App shell: styles · Presentation layer styling
- Indexes → Files state: supports · Optimizes file metadata queries