# mrinmoypatra-pravaah/file-sharing-app architecture

> Architecture diagram of the GitHub repository mrinmoypatra-pravaah/file-sharing-app, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-05-25). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/mrinmoypatra-pravaah/file-sharing-app
- Repository: https://github.com/mrinmoypatra-pravaah/file-sharing-app

## Overview

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: [`src/App.jsx`](https://github.com/mrinmoypatra-pravaah/file-sharing-app/blob/main/src/App.jsx) (App shell), [`src/pages/Dashboard.jsx`](https://github.com/mrinmoypatra-pravaah/file-sharing-app/blob/main/src/pages/Dashboard.jsx) (Dashboard), [`src/firebase.js`](https://github.com/mrinmoypatra-pravaah/file-sharing-app/blob/main/src/firebase.js) (Firebase client), [`src/features/files/filesSlice.js`](https://github.com/mrinmoypatra-pravaah/file-sharing-app/blob/main/src/features/files/filesSlice.js) (Files state)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_frontend["Frontend"]
  node_src_main(("App boot<br/>SPA entry<br/>[main.jsx]"))
  node_src_app["App shell<br/>routing shell<br/>[App.jsx]"]
  node_login_page["Login<br/>auth page<br/>[Login.jsx]"]
  node_register_page["Register<br/>auth page<br/>[Register.jsx]"]
  node_dashboard_page["Dashboard<br/>private page<br/>[Dashboard.jsx]"]
  node_shared_page["Shared file<br/>public page<br/>[SharedFile.jsx]"]
  node_protected_route{{"Protected route<br/>access guard<br/>[ProtectedRoute.jsx]"}}
  node_navbar["Navbar<br/>nav UI<br/>[Navbar.jsx]"]
  node_file_upload["Upload<br/>file UI<br/>[FileUpload.jsx]"]
  node_file_list["File list<br/>file UI<br/>[FileList.jsx]"]
  node_received_files["Received<br/>file UI<br/>[ReceivedFiles.jsx]"]
  node_auth_slice[("Auth state<br/>redux slice<br/>[authSlice.js]")]
  node_files_slice[("Files state<br/>redux slice<br/>[filesSlice.js]")]
end

subgraph group_backend["Firebase backend"]
  node_firebase_client["Firebase client<br/>sdk setup<br/>[firebase.js]"]
  node_functions_entry["Functions<br/>[index.js]"]
  node_firestore_rules["Firestore rules<br/>security rules<br/>[firestore.rules]"]
  node_storage_rules["Storage rules<br/>security rules<br/>[storage.rules]"]
end

subgraph group_infra["Infra/build"]
  node_hosting_config["Hosting<br/>deploy config<br/>[firebase.json]"]
  node_firestore_indexes["Indexes<br/>db config"]
  node_vite_config["Vite build<br/>build config<br/>[vite.config.js]"]
  node_tailwind_config["Tailwind<br/>style config<br/>[tailwind.config.js]"]
end

node_src_main -->|"mounts"| node_src_app
node_src_app -->|"routes"| node_login_page
node_src_app -->|"routes"| node_register_page
node_src_app -->|"guards"| node_protected_route
node_protected_route -->|"allows"| node_dashboard_page
node_src_app -->|"routes"| node_shared_page
node_dashboard_page -->|"uses"| node_navbar
node_dashboard_page -->|"composes"| node_file_upload
node_dashboard_page -->|"composes"| node_file_list
node_dashboard_page -->|"composes"| node_received_files
node_src_app -->|"reads/writes"| node_auth_slice
node_dashboard_page -->|"reads/writes"| node_files_slice
node_auth_slice -->|"auth"| node_firebase_client
node_files_slice -->|"data"| node_firebase_client
node_firebase_client -.->|"governed by"| node_firestore_rules
node_firebase_client -.->|"governed by"| node_storage_rules
node_functions_entry -->|"extends"| node_firebase_client
node_hosting_config -->|"serves"| node_src_app
node_vite_config -->|"builds"| node_src_main
node_tailwind_config -->|"styles"| node_src_app
node_firestore_indexes -.->|"supports"| node_files_slice

click node_src_main "https://github.com/mrinmoypatra-pravaah/file-sharing-app/blob/main/src/main.jsx"
click node_src_app "https://github.com/mrinmoypatra-pravaah/file-sharing-app/blob/main/src/App.jsx"
click node_login_page "https://github.com/mrinmoypatra-pravaah/file-sharing-app/blob/main/src/pages/Login.jsx"
click node_register_page "https://github.com/mrinmoypatra-pravaah/file-sharing-app/blob/main/src/pages/Register.jsx"
click node_dashboard_page "https://github.com/mrinmoypatra-pravaah/file-sharing-app/blob/main/src/pages/Dashboard.jsx"
click node_shared_page "https://github.com/mrinmoypatra-pravaah/file-sharing-app/blob/main/src/pages/SharedFile.jsx"
click node_protected_route "https://github.com/mrinmoypatra-pravaah/file-sharing-app/blob/main/src/components/ProtectedRoute.jsx"
click node_navbar "https://github.com/mrinmoypatra-pravaah/file-sharing-app/blob/main/src/components/Navbar.jsx"
click node_file_upload "https://github.com/mrinmoypatra-pravaah/file-sharing-app/blob/main/src/components/FileUpload.jsx"
click node_file_list "https://github.com/mrinmoypatra-pravaah/file-sharing-app/blob/main/src/components/FileList.jsx"
click node_received_files "https://github.com/mrinmoypatra-pravaah/file-sharing-app/blob/main/src/components/ReceivedFiles.jsx"
click node_auth_slice "https://github.com/mrinmoypatra-pravaah/file-sharing-app/blob/main/src/features/auth/authSlice.js"
click node_files_slice "https://github.com/mrinmoypatra-pravaah/file-sharing-app/blob/main/src/features/files/filesSlice.js"
click node_firebase_client "https://github.com/mrinmoypatra-pravaah/file-sharing-app/blob/main/src/firebase.js"
click node_functions_entry "https://github.com/mrinmoypatra-pravaah/file-sharing-app/blob/main/functions/index.js"
click node_firestore_rules "https://github.com/mrinmoypatra-pravaah/file-sharing-app/blob/main/firestore.rules"
click node_storage_rules "https://github.com/mrinmoypatra-pravaah/file-sharing-app/blob/main/storage.rules"
click node_hosting_config "https://github.com/mrinmoypatra-pravaah/file-sharing-app/blob/main/firebase.json"
click node_firestore_indexes "https://github.com/mrinmoypatra-pravaah/file-sharing-app/blob/main/firestore.indexes.json"
click node_vite_config "https://github.com/mrinmoypatra-pravaah/file-sharing-app/blob/main/vite.config.js"
click node_tailwind_config "https://github.com/mrinmoypatra-pravaah/file-sharing-app/blob/main/tailwind.config.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_src_main,node_src_app,node_login_page,node_register_page,node_dashboard_page,node_shared_page,node_protected_route,node_navbar,node_file_upload,node_file_list,node_received_files,node_auth_slice,node_files_slice toneBlue
class node_firebase_client,node_functions_entry,node_firestore_rules,node_storage_rules toneAmber
class node_hosting_config,node_firestore_indexes,node_vite_config,node_tailwind_config toneMint
```

## Components

### Frontend

React SPA, routes, UI, and client state

- [App boot](https://github.com/mrinmoypatra-pravaah/file-sharing-app/blob/main/src/main.jsx): SPA entry · Bootstraps the React application · `src/main.jsx`
- [App shell](https://github.com/mrinmoypatra-pravaah/file-sharing-app/blob/main/src/App.jsx): routing shell · Top-level app composition and route structure · `src/App.jsx`
- [Login](https://github.com/mrinmoypatra-pravaah/file-sharing-app/blob/main/src/pages/Login.jsx): auth page · Sign-in screen · `src/pages/Login.jsx`
- [Register](https://github.com/mrinmoypatra-pravaah/file-sharing-app/blob/main/src/pages/Register.jsx): auth page · Account creation screen · `src/pages/Register.jsx`
- [Dashboard](https://github.com/mrinmoypatra-pravaah/file-sharing-app/blob/main/src/pages/Dashboard.jsx): private page · Authenticated file management view · `src/pages/Dashboard.jsx`
- [Shared file](https://github.com/mrinmoypatra-pravaah/file-sharing-app/blob/main/src/pages/SharedFile.jsx): public page · File access view for shared links or tokens · `src/pages/SharedFile.jsx`
- [Protected route](https://github.com/mrinmoypatra-pravaah/file-sharing-app/blob/main/src/components/ProtectedRoute.jsx): access guard · Route-level authentication gate · `src/components/ProtectedRoute.jsx`
- [Navbar](https://github.com/mrinmoypatra-pravaah/file-sharing-app/blob/main/src/components/Navbar.jsx): nav UI · Global navigation and session actions · `src/components/Navbar.jsx`
- [Upload](https://github.com/mrinmoypatra-pravaah/file-sharing-app/blob/main/src/components/FileUpload.jsx): file UI · File upload interaction · `src/components/FileUpload.jsx`
- [File list](https://github.com/mrinmoypatra-pravaah/file-sharing-app/blob/main/src/components/FileList.jsx): file UI · Owned file browsing and actions · `src/components/FileList.jsx`
- [Received](https://github.com/mrinmoypatra-pravaah/file-sharing-app/blob/main/src/components/ReceivedFiles.jsx): file UI · Files shared with the signed-in user · `src/components/ReceivedFiles.jsx`
- [Auth state](https://github.com/mrinmoypatra-pravaah/file-sharing-app/blob/main/src/features/auth/authSlice.js): redux slice · Client authentication state and actions · `src/features/auth/authSlice.js`
- [Files state](https://github.com/mrinmoypatra-pravaah/file-sharing-app/blob/main/src/features/files/filesSlice.js): redux slice · Client file metadata and sharing state · `src/features/files/filesSlice.js`

### Firebase backend

Firestore, Storage, Auth integration, and Cloud Functions

- [Firebase client](https://github.com/mrinmoypatra-pravaah/file-sharing-app/blob/main/src/firebase.js): sdk setup · Client-side Firebase initialization and service access · `src/firebase.js`
- [Functions](https://github.com/mrinmoypatra-pravaah/file-sharing-app/blob/main/functions/index.js): cloud functions · Serverless backend entry point · `functions/index.js`
- [Firestore rules](https://github.com/mrinmoypatra-pravaah/file-sharing-app/blob/main/firestore.rules): security rules · Access control for metadata reads and writes · `firestore.rules`
- [Storage rules](https://github.com/mrinmoypatra-pravaah/file-sharing-app/blob/main/storage.rules): security rules · Access control for file blob uploads and downloads · `storage.rules`

### Infra/build

Hosting, rules, and build configuration

- [Hosting](https://github.com/mrinmoypatra-pravaah/file-sharing-app/blob/main/firebase.json): deploy config · Firebase Hosting and deployment wiring · `firebase.json`
- [Indexes](https://github.com/mrinmoypatra-pravaah/file-sharing-app/blob/main/firestore.indexes.json): db config · Firestore index definitions · `firestore.indexes.json`
- [Vite build](https://github.com/mrinmoypatra-pravaah/file-sharing-app/blob/main/vite.config.js): build config · Frontend bundling and dev server configuration · `vite.config.js`
- [Tailwind](https://github.com/mrinmoypatra-pravaah/file-sharing-app/blob/main/tailwind.config.js): style config · Utility CSS configuration · `tailwind.config.js`

## Connections

- 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
