# amarjeetmaurya/storageapp-js architecture

> Architecture diagram of the GitHub repository amarjeetmaurya/storageapp-js, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-10-06). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/amarjeetmaurya/storageapp-js
- Repository: https://github.com/amarjeetmaurya/storageapp-js

## Overview

This is a browser-based storage app with a React client and an Express server. Users enter through public or protected routes, authenticate, browse and manage directories, and upload, download, rename, or delete files; settings and user management are additional client capabilities. The server routes requests through controllers to MongoDB models and, for file operations, S3. The excerpts and source index support the shown server calls and route wiring; client-to-server API calls and several unsampled feature details are not shown, so those links are omitted.

Main entry points: [`Server/src/controllers/auth.controller.js`](https://github.com/amarjeetmaurya/storageapp-js/blob/master/Server/src/controllers/auth.controller.js) (Auth controller), [`Server/src/controllers/file.controller.js`](https://github.com/amarjeetmaurya/storageapp-js/blob/master/Server/src/controllers/file.controller.js) (File controller), [`Client/src/routes/protected.routes.jsx`](https://github.com/amarjeetmaurya/storageapp-js/blob/master/Client/src/routes/protected.routes.jsx) (Protected pages), [`Server/src/controllers/directory.controller.js`](https://github.com/amarjeetmaurya/storageapp-js/blob/master/Server/src/controllers/directory.controller.js) (Directory controller)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_client["Client application"]
  node_client_app["React app<br/>[main.jsx]"]
  node_client_routes["Route selection<br/>[router.jsx]"]
  node_public_pages["Public pages<br/>[public.routes.jsx]"]
  node_protected_pages["Protected pages"]
  node_dashboard["Dashboard layout"]
  node_directory_ui["Directory view<br/>[DirectoryView.jsx]"]
  node_settings_ui["Settings<br/>[SettingsPage.jsx]"]
  node_users_ui["User management<br/>[UserManagement.jsx]"]
end

subgraph group_auth["Authentication"]
  node_auth_ui["Login and signup<br/>[Login.jsx]"]
  node_auth_state["Auth context<br/>[AuthContent.jsx]"]
  node_auth_api["Auth API<br/>[authApi.js]"]
  node_auth_routes["Auth routes<br/>[auth.routes.js]"]
  node_auth_controller["Auth controller<br/>[auth.controller.js]"]
  node_auth_services["Auth services"]
  node_sessions[("Sessions<br/>[Session.js]")]
end

subgraph group_storage["Storage operations"]
  node_directory_controller["Directory controller"]
  node_file_controller["File controller<br/>[file.controller.js]"]
  node_directory_routes["Directory routes"]
  node_file_routes["File routes<br/>[file.routes.js]"]
  node_s3[("S3 object storage<br/>[s3.js]")]
end

subgraph group_data["Persistence and services"]
  node_directories[("Directory records<br/>[Directory.js]")]
  node_files[("File records<br/>[File.js]")]
  node_users[("User records<br/>[User.js]")]
  node_pending_signup[("Pending signups<br/>[PendingSignup.js]")]
  node_server_app["Express app<br/>[app.js]"]
end

node_user(("Storage user"))

node_user -.->|"uses"| node_client_app
node_client_app -->|"renders"| node_client_routes
node_client_routes -->|"routes to"| node_public_pages
node_client_routes -->|"routes to"| node_protected_pages
node_protected_pages -->|"wraps"| node_dashboard
node_protected_pages -->|"routes to"| node_directory_ui
node_protected_pages -->|"routes to"| node_settings_ui
node_protected_pages -->|"routes to"| node_users_ui
node_public_pages -->|"routes to"| node_auth_ui
node_client_app -->|"provides"| node_auth_state
node_auth_state -->|"imports"| node_auth_api
node_server_app -->|"mounts"| node_auth_routes
node_server_app -->|"mounts"| node_directory_routes
node_server_app -->|"mounts"| node_file_routes
node_auth_routes -->|"dispatches"| node_auth_controller
node_auth_controller -->|"calls"| node_auth_services
node_auth_controller -->|"creates sessions"| node_sessions
node_auth_controller -->|"queries"| node_users
node_auth_controller -->|"creates root"| node_directories
node_auth_controller -->|"stores pending"| node_pending_signup
node_directory_routes -->|"dispatches"| node_directory_controller
node_file_routes -->|"dispatches"| node_file_controller
node_directory_controller -->|"reads and writes"| node_directories
node_directory_controller -->|"reads and deletes"| node_files
node_directory_controller -->|"updates sizes"| node_file_controller
node_directory_controller -->|"deletes objects"| node_s3
node_file_controller -->|"reads and updates"| node_directories
node_file_controller -->|"reads and writes"| node_files
node_file_controller -->|"checks quota"| node_users
node_file_controller -->|"uploads and fetches"| node_s3

click node_client_app "https://github.com/amarjeetmaurya/storageapp-js/blob/master/Client/src/main.jsx"
click node_client_routes "https://github.com/amarjeetmaurya/storageapp-js/blob/master/Client/src/routes/router.jsx"
click node_public_pages "https://github.com/amarjeetmaurya/storageapp-js/blob/master/Client/src/routes/public.routes.jsx"
click node_protected_pages "https://github.com/amarjeetmaurya/storageapp-js/blob/master/Client/src/routes/protected.routes.jsx"
click node_dashboard "https://github.com/amarjeetmaurya/storageapp-js/blob/master/Client/src/layouts/DashboardLayout.jsx"
click node_directory_ui "https://github.com/amarjeetmaurya/storageapp-js/blob/master/Client/src/pages/DirectoryView.jsx"
click node_settings_ui "https://github.com/amarjeetmaurya/storageapp-js/blob/master/Client/src/pages/SettingsPage.jsx"
click node_users_ui "https://github.com/amarjeetmaurya/storageapp-js/blob/master/Client/src/pages/UserManagement.jsx"
click node_auth_ui "https://github.com/amarjeetmaurya/storageapp-js/blob/master/Client/src/pages/AuthPage/Login.jsx"
click node_auth_state "https://github.com/amarjeetmaurya/storageapp-js/blob/master/Client/src/contexts/AuthContent.jsx"
click node_auth_api "https://github.com/amarjeetmaurya/storageapp-js/blob/master/Client/src/api/authApi.js"
click node_auth_routes "https://github.com/amarjeetmaurya/storageapp-js/blob/master/Server/src/routes/auth.routes.js"
click node_auth_controller "https://github.com/amarjeetmaurya/storageapp-js/blob/master/Server/src/controllers/auth.controller.js"
click node_auth_services "https://github.com/amarjeetmaurya/storageapp-js/tree/master/Server/src/services"
click node_sessions "https://github.com/amarjeetmaurya/storageapp-js/blob/master/Server/src/models/Session.js"
click node_directory_controller "https://github.com/amarjeetmaurya/storageapp-js/blob/master/Server/src/controllers/directory.controller.js"
click node_file_controller "https://github.com/amarjeetmaurya/storageapp-js/blob/master/Server/src/controllers/file.controller.js"
click node_directory_routes "https://github.com/amarjeetmaurya/storageapp-js/blob/master/Server/src/routes/directory.routes.js"
click node_file_routes "https://github.com/amarjeetmaurya/storageapp-js/blob/master/Server/src/routes/file.routes.js"
click node_s3 "https://github.com/amarjeetmaurya/storageapp-js/blob/master/Server/src/config/s3.js"
click node_directories "https://github.com/amarjeetmaurya/storageapp-js/blob/master/Server/src/models/Directory.js"
click node_files "https://github.com/amarjeetmaurya/storageapp-js/blob/master/Server/src/models/File.js"
click node_users "https://github.com/amarjeetmaurya/storageapp-js/blob/master/Server/src/models/User.js"
click node_pending_signup "https://github.com/amarjeetmaurya/storageapp-js/blob/master/Server/src/models/PendingSignup.js"
click node_server_app "https://github.com/amarjeetmaurya/storageapp-js/blob/master/Server/src/app.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_client_app,node_client_routes,node_public_pages,node_protected_pages,node_dashboard,node_directory_ui,node_settings_ui,node_users_ui toneBlue
class node_auth_ui,node_auth_state,node_auth_api,node_auth_routes,node_auth_controller,node_auth_services,node_sessions,node_user toneAmber
class node_directory_controller,node_file_controller,node_directory_routes,node_file_routes,node_s3 toneMint
class node_directories,node_files,node_users,node_pending_signup,node_server_app toneRose
```

## Components

### Client application

- [React app](https://github.com/amarjeetmaurya/storageapp-js/blob/master/Client/src/main.jsx): `Client/src/main.jsx`
- [Route selection](https://github.com/amarjeetmaurya/storageapp-js/blob/master/Client/src/routes/router.jsx): `Client/src/routes/router.jsx`
- [Public pages](https://github.com/amarjeetmaurya/storageapp-js/blob/master/Client/src/routes/public.routes.jsx): `Client/src/routes/public.routes.jsx`
- [Protected pages](https://github.com/amarjeetmaurya/storageapp-js/blob/master/Client/src/routes/protected.routes.jsx): `Client/src/routes/protected.routes.jsx`
- [Dashboard layout](https://github.com/amarjeetmaurya/storageapp-js/blob/master/Client/src/layouts/DashboardLayout.jsx): `Client/src/layouts/DashboardLayout.jsx`
- [Directory view](https://github.com/amarjeetmaurya/storageapp-js/blob/master/Client/src/pages/DirectoryView.jsx): `Client/src/pages/DirectoryView.jsx`
- [Settings](https://github.com/amarjeetmaurya/storageapp-js/blob/master/Client/src/pages/SettingsPage.jsx): `Client/src/pages/SettingsPage.jsx`
- [User management](https://github.com/amarjeetmaurya/storageapp-js/blob/master/Client/src/pages/UserManagement.jsx): `Client/src/pages/UserManagement.jsx`

### Authentication

- [Login and signup](https://github.com/amarjeetmaurya/storageapp-js/blob/master/Client/src/pages/AuthPage/Login.jsx): `Client/src/pages/AuthPage/Login.jsx`
- [Auth context](https://github.com/amarjeetmaurya/storageapp-js/blob/master/Client/src/contexts/AuthContent.jsx): `Client/src/contexts/AuthContent.jsx`
- [Auth API](https://github.com/amarjeetmaurya/storageapp-js/blob/master/Client/src/api/authApi.js): `Client/src/api/authApi.js`
- [Auth routes](https://github.com/amarjeetmaurya/storageapp-js/blob/master/Server/src/routes/auth.routes.js): `Server/src/routes/auth.routes.js`
- [Auth controller](https://github.com/amarjeetmaurya/storageapp-js/blob/master/Server/src/controllers/auth.controller.js): `Server/src/controllers/auth.controller.js`
- [Auth services](https://github.com/amarjeetmaurya/storageapp-js/tree/master/Server/src/services): `Server/src/services`
- [Sessions](https://github.com/amarjeetmaurya/storageapp-js/blob/master/Server/src/models/Session.js): `Server/src/models/Session.js`

### Storage operations

- [Directory controller](https://github.com/amarjeetmaurya/storageapp-js/blob/master/Server/src/controllers/directory.controller.js): `Server/src/controllers/directory.controller.js`
- [File controller](https://github.com/amarjeetmaurya/storageapp-js/blob/master/Server/src/controllers/file.controller.js): `Server/src/controllers/file.controller.js`
- [Directory routes](https://github.com/amarjeetmaurya/storageapp-js/blob/master/Server/src/routes/directory.routes.js): `Server/src/routes/directory.routes.js`
- [File routes](https://github.com/amarjeetmaurya/storageapp-js/blob/master/Server/src/routes/file.routes.js): `Server/src/routes/file.routes.js`
- [S3 object storage](https://github.com/amarjeetmaurya/storageapp-js/blob/master/Server/src/config/s3.js): `Server/src/config/s3.js`

### Persistence and services

- [Directory records](https://github.com/amarjeetmaurya/storageapp-js/blob/master/Server/src/models/Directory.js): `Server/src/models/Directory.js`
- [File records](https://github.com/amarjeetmaurya/storageapp-js/blob/master/Server/src/models/File.js): `Server/src/models/File.js`
- [User records](https://github.com/amarjeetmaurya/storageapp-js/blob/master/Server/src/models/User.js): `Server/src/models/User.js`
- [Pending signups](https://github.com/amarjeetmaurya/storageapp-js/blob/master/Server/src/models/PendingSignup.js): `Server/src/models/PendingSignup.js`
- [Express app](https://github.com/amarjeetmaurya/storageapp-js/blob/master/Server/src/app.js): `Server/src/app.js`

### Other components

- **Storage user**

## Connections

- Storage user → React app: uses
- React app → Route selection: renders
- Route selection → Public pages: routes to (evidence: `Client/src/routes/router.jsx`)
- Route selection → Protected pages: routes to (evidence: `Client/src/routes/router.jsx`)
- Protected pages → Dashboard layout: wraps (evidence: `Client/src/routes/protected.routes.jsx`)
- Protected pages → Directory view: routes to (evidence: `Client/src/routes/protected.routes.jsx`)
- Protected pages → Settings: routes to (evidence: `Client/src/routes/protected.routes.jsx`)
- Protected pages → User management: routes to (evidence: `Client/src/routes/protected.routes.jsx`)
- Public pages → Login and signup: routes to (evidence: `Client/src/routes/public.routes.jsx`)
- React app → Auth context: provides (evidence: `Client/src/main.jsx`)
- Auth context → Auth API: imports (evidence: `Client/src/contexts/AuthContent.jsx`)
- Express app → Auth routes: mounts (evidence: `Server/src/app.js`)
- Express app → Directory routes: mounts (evidence: `Server/src/app.js`)
- Express app → File routes: mounts (evidence: `Server/src/app.js`)
- Auth routes → Auth controller: dispatches (evidence: `Server/src/routes/auth.routes.js`)
- Auth controller → Auth services: calls (evidence: `Server/src/controllers/auth.controller.js`)
- Auth controller → Sessions: creates sessions (evidence: `Server/src/controllers/auth.controller.js`)
- Auth controller → User records: queries (evidence: `Server/src/controllers/auth.controller.js`)
- Auth controller → Directory records: creates root (evidence: `Server/src/controllers/auth.controller.js`)
- Auth controller → Pending signups: stores pending (evidence: `Server/src/controllers/auth.controller.js`)
- Directory routes → Directory controller: dispatches (evidence: `Server/src/routes/directory.routes.js`)
- File routes → File controller: dispatches (evidence: `Server/src/routes/file.routes.js`)
- Directory controller → Directory records: reads and writes (evidence: `Server/src/controllers/directory.controller.js`)
- Directory controller → File records: reads and deletes (evidence: `Server/src/controllers/directory.controller.js`)
- Directory controller → File controller: updates sizes (evidence: `Server/src/controllers/directory.controller.js`)
- Directory controller → S3 object storage: deletes objects (evidence: `Server/src/controllers/directory.controller.js`)
- File controller → Directory records: reads and updates (evidence: `Server/src/controllers/file.controller.js`)
- File controller → File records: reads and writes (evidence: `Server/src/controllers/file.controller.js`)
- File controller → User records: checks quota (evidence: `Server/src/controllers/file.controller.js`)
- File controller → S3 object storage: uploads and fetches (evidence: `Server/src/controllers/file.controller.js`)
