# orbrener1/drive-part-5 architecture

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

- Interactive diagram: https://gitdiagram.com/orbrener1/drive-part-5
- Repository: https://github.com/orbrener1/drive-part-5

## Overview

Drive Me Nuts is a multi-client file-storage application: web and mobile users authenticate and manage files through the Node.js REST API, which coordinates application metadata and permissions with physical file operations on the C++ storage server. The main workflow covers browsing, creating, viewing, moving, searching, sharing, and managing files, with supporting starred, recent, and bin views. The README establishes the major system boundaries; source evidence is strongest for the Node.js file service and C++ request dispatch, so unsampled client and backend subsystems are shown at directory-level where appropriate.

Main entry points: [`NodeJS-server/src/services/filesService.js`](https://github.com/orbrener1/drive-part-5/blob/main/NodeJS-server/src/services/filesService.js) (File Domain Service), [`NodeJS-server/src/mongoRoutes/files.js`](https://github.com/orbrener1/drive-part-5/blob/main/NodeJS-server/src/mongoRoutes/files.js) (File and Search Routes), [`react-front/src/router.js`](https://github.com/orbrener1/drive-part-5/blob/main/react-front/src/router.js) (Web Routes), [`NodeJS-server/src/mongoControllers/FilesController.js`](https://github.com/orbrener1/drive-part-5/blob/main/NodeJS-server/src/mongoControllers/FilesController.js) (File Operations)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_web["React Web Client"]
  node_web_routes["Web Routes<br/>[router.js]"]
  node_web_auth["Web Authentication<br/>[AuthContext.jsx]"]
  node_web_files["Web File Workflows<br/>[FilesPage.jsx]"]
  node_web_api["Web API Client<br/>[apiClient.js]"]
end

subgraph group_mobile["React Native Client"]
  node_mobile_screens["Mobile Screens"]
  node_mobile_actions["Mobile File Actions<br/>[useFileActions.js]"]
  node_mobile_auth["Mobile Authentication<br/>[AuthContext.jsx]"]
  node_mobile_api["Mobile API<br/>[filesApi.js]"]
end

subgraph group_backend["Node.js Backend"]
  node_http_api["REST API<br/>[app.js]"]
  node_api_routes["File and Search Routes<br/>[files.js]"]
  node_auth_middleware["Token Authentication<br/>[authService.js]"]
  node_file_controller["File Operations<br/>[FilesController.js]"]
  node_file_service["File Domain Service<br/>[filesService.js]"]
  node_metadata_repo["File Metadata Repository"]
  node_sharing["Permissions and Sharing"]
  node_search["Search"]
  node_user_services["User Services<br/>[userService.js]"]
  node_file_state["Bin, Recent, Stars"]
  node_cpp_client["Storage Protocol Client"]
end

subgraph group_storage["C++ Storage Server"]
  node_cpp_handler["Socket Command Handler"]
  node_command_set["Storage Commands"]
  node_local_storage[("Local File Storage")]
  node_compression["Binary Compression"]
end

node_browser_user(("Browser User"))
node_mobile_user(("Mobile User"))

node_browser_user -->|"uses"| node_web_routes
node_web_routes -->|"checks session"| node_web_auth
node_web_routes -->|"routes to"| node_web_files
node_web_files -.->|"requests data"| node_web_api
node_web_auth -->|"auth requests"| node_web_api
node_web_api -->|"calls REST API"| node_http_api
node_mobile_user -->|"uses"| node_mobile_screens
node_mobile_screens -.->|"uses actions"| node_mobile_actions
node_mobile_actions -->|"calls"| node_mobile_api
node_mobile_auth -.->|"auth requests"| node_mobile_api
node_mobile_api -->|"calls REST API"| node_http_api
node_http_api -->|"mounts routes"| node_api_routes
node_api_routes -->|"protects routes"| node_auth_middleware
node_api_routes -->|"dispatches requests"| node_file_controller
node_file_controller -->|"calls"| node_file_service
node_file_service -->|"reads and writes"| node_metadata_repo
node_file_service -->|"requests file I/O"| node_cpp_client
node_file_controller -.->|"permission endpoints"| node_sharing
node_sharing -->|"checks access"| node_file_service
node_sharing -->|"resolves users"| node_user_services
node_api_routes -->|"routes search"| node_search
node_search -.->|"searches files"| node_file_service
node_file_service -->|"manages file state"| node_file_state
node_cpp_client -.->|"sends commands"| node_cpp_handler
node_cpp_handler -->|"dispatches commands"| node_command_set
node_command_set -.->|"performs file I/O"| node_local_storage
node_local_storage -.->|"uses strategy"| node_compression

click node_web_routes "https://github.com/orbrener1/drive-part-5/blob/main/react-front/src/router.js"
click node_web_auth "https://github.com/orbrener1/drive-part-5/blob/main/react-front/src/context/AuthContext.jsx"
click node_web_files "https://github.com/orbrener1/drive-part-5/blob/main/react-front/src/pages/FilesPage/FilesPage.jsx"
click node_web_api "https://github.com/orbrener1/drive-part-5/blob/main/react-front/src/api/apiClient.js"
click node_mobile_screens "https://github.com/orbrener1/drive-part-5/tree/main/react-native-app/src/screens"
click node_mobile_actions "https://github.com/orbrener1/drive-part-5/blob/main/react-native-app/src/hooks/useFileActions.js"
click node_mobile_auth "https://github.com/orbrener1/drive-part-5/blob/main/react-native-app/src/context/AuthContext.jsx"
click node_mobile_api "https://github.com/orbrener1/drive-part-5/blob/main/react-native-app/src/api/filesApi.js"
click node_http_api "https://github.com/orbrener1/drive-part-5/blob/main/NodeJS-server/src/app.js"
click node_api_routes "https://github.com/orbrener1/drive-part-5/blob/main/NodeJS-server/src/mongoRoutes/files.js"
click node_auth_middleware "https://github.com/orbrener1/drive-part-5/blob/main/NodeJS-server/src/mongoServices/authService.js"
click node_file_controller "https://github.com/orbrener1/drive-part-5/blob/main/NodeJS-server/src/mongoControllers/FilesController.js"
click node_file_service "https://github.com/orbrener1/drive-part-5/blob/main/NodeJS-server/src/services/filesService.js"
click node_metadata_repo "https://github.com/orbrener1/drive-part-5/blob/main/NodeJS-server/src/mongoRepository/mongoFileRepository.js"
click node_sharing "https://github.com/orbrener1/drive-part-5/blob/main/NodeJS-server/src/mongoControllers/permissionsController.js"
click node_search "https://github.com/orbrener1/drive-part-5/blob/main/NodeJS-server/src/mongoControllers/searchController.js"
click node_user_services "https://github.com/orbrener1/drive-part-5/blob/main/NodeJS-server/src/mongoServices/userService.js"
click node_file_state "https://github.com/orbrener1/drive-part-5/tree/main/NodeJS-server/src/mongoServices"
click node_cpp_client "https://github.com/orbrener1/drive-part-5/blob/main/NodeJS-server/src/services/cppClientService.js"
click node_cpp_handler "https://github.com/orbrener1/drive-part-5/blob/main/cpp-server/src/server/SocketClientHandler.cpp"
click node_command_set "https://github.com/orbrener1/drive-part-5/tree/main/cpp-server/src/commands"
click node_local_storage "https://github.com/orbrener1/drive-part-5/blob/main/cpp-server/src/storage/LocalFileManager.cpp"
click node_compression "https://github.com/orbrener1/drive-part-5/tree/main/cpp-server/src/compression"

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_web_routes,node_web_auth,node_web_files,node_web_api,node_browser_user,node_mobile_user toneBlue
class node_mobile_screens,node_mobile_actions,node_mobile_auth,node_mobile_api toneAmber
class node_http_api,node_api_routes,node_auth_middleware,node_file_controller,node_file_service,node_metadata_repo,node_sharing,node_search,node_user_services,node_file_state,node_cpp_client toneMint
class node_cpp_handler,node_command_set,node_local_storage,node_compression toneRose
```

## Components

### React Web Client

- [Web Routes](https://github.com/orbrener1/drive-part-5/blob/main/react-front/src/router.js): `react-front/src/router.js`
- [Web Authentication](https://github.com/orbrener1/drive-part-5/blob/main/react-front/src/context/AuthContext.jsx): `react-front/src/context/AuthContext.jsx`
- [Web File Workflows](https://github.com/orbrener1/drive-part-5/blob/main/react-front/src/pages/FilesPage/FilesPage.jsx): `react-front/src/pages/FilesPage/FilesPage.jsx`
- [Web API Client](https://github.com/orbrener1/drive-part-5/blob/main/react-front/src/api/apiClient.js): `react-front/src/api/apiClient.js`

### React Native Client

- [Mobile Screens](https://github.com/orbrener1/drive-part-5/tree/main/react-native-app/src/screens): `react-native-app/src/screens`
- [Mobile File Actions](https://github.com/orbrener1/drive-part-5/blob/main/react-native-app/src/hooks/useFileActions.js): `react-native-app/src/hooks/useFileActions.js`
- [Mobile Authentication](https://github.com/orbrener1/drive-part-5/blob/main/react-native-app/src/context/AuthContext.jsx): `react-native-app/src/context/AuthContext.jsx`
- [Mobile API](https://github.com/orbrener1/drive-part-5/blob/main/react-native-app/src/api/filesApi.js): `react-native-app/src/api/filesApi.js`

### Node.js Backend

- [REST API](https://github.com/orbrener1/drive-part-5/blob/main/NodeJS-server/src/app.js): `NodeJS-server/src/app.js`
- [File and Search Routes](https://github.com/orbrener1/drive-part-5/blob/main/NodeJS-server/src/mongoRoutes/files.js): `NodeJS-server/src/mongoRoutes/files.js`
- [Token Authentication](https://github.com/orbrener1/drive-part-5/blob/main/NodeJS-server/src/mongoServices/authService.js): `NodeJS-server/src/mongoServices/authService.js`
- [File Operations](https://github.com/orbrener1/drive-part-5/blob/main/NodeJS-server/src/mongoControllers/FilesController.js): `NodeJS-server/src/mongoControllers/FilesController.js`
- [File Domain Service](https://github.com/orbrener1/drive-part-5/blob/main/NodeJS-server/src/services/filesService.js): `NodeJS-server/src/services/filesService.js`
- [File Metadata Repository](https://github.com/orbrener1/drive-part-5/blob/main/NodeJS-server/src/mongoRepository/mongoFileRepository.js): `NodeJS-server/src/mongoRepository/mongoFileRepository.js`
- [Permissions and Sharing](https://github.com/orbrener1/drive-part-5/blob/main/NodeJS-server/src/mongoControllers/permissionsController.js): `NodeJS-server/src/mongoControllers/permissionsController.js`
- [Search](https://github.com/orbrener1/drive-part-5/blob/main/NodeJS-server/src/mongoControllers/searchController.js): `NodeJS-server/src/mongoControllers/searchController.js`
- [User Services](https://github.com/orbrener1/drive-part-5/blob/main/NodeJS-server/src/mongoServices/userService.js): `NodeJS-server/src/mongoServices/userService.js`
- [Bin, Recent, Stars](https://github.com/orbrener1/drive-part-5/tree/main/NodeJS-server/src/mongoServices): `NodeJS-server/src/mongoServices`
- [Storage Protocol Client](https://github.com/orbrener1/drive-part-5/blob/main/NodeJS-server/src/services/cppClientService.js): `NodeJS-server/src/services/cppClientService.js`

### C++ Storage Server

- [Socket Command Handler](https://github.com/orbrener1/drive-part-5/blob/main/cpp-server/src/server/SocketClientHandler.cpp): `cpp-server/src/server/SocketClientHandler.cpp`
- [Storage Commands](https://github.com/orbrener1/drive-part-5/tree/main/cpp-server/src/commands): `cpp-server/src/commands`
- [Local File Storage](https://github.com/orbrener1/drive-part-5/blob/main/cpp-server/src/storage/LocalFileManager.cpp): `cpp-server/src/storage/LocalFileManager.cpp`
- [Binary Compression](https://github.com/orbrener1/drive-part-5/tree/main/cpp-server/src/compression): `cpp-server/src/compression`

### Other components

- **Browser User**
- **Mobile User**

## Connections

- Browser User → Web Routes: uses (evidence: `README.md`)
- Web Routes → Web Authentication: checks session (evidence: `react-front/src/router.js`)
- Web Routes → Web File Workflows: routes to (evidence: `react-front/src/router.js`)
- Web File Workflows → Web API Client: requests data
- Web Authentication → Web API Client: auth requests (evidence: `react-front/src/context/AuthContext.jsx`)
- Web API Client → REST API: calls REST API (evidence: `README.md`)
- Mobile User → Mobile Screens: uses (evidence: `README.md`)
- Mobile Screens → Mobile File Actions: uses actions
- Mobile File Actions → Mobile API: calls (evidence: `react-native-app/src/hooks/useFileActions.js`)
- Mobile Authentication → Mobile API: auth requests
- Mobile API → REST API: calls REST API (evidence: `README.md`)
- REST API → File and Search Routes: mounts routes (evidence: `NodeJS-server/src/app.js`)
- File and Search Routes → Token Authentication: protects routes (evidence: `NodeJS-server/src/mongoRoutes/files.js`)
- File and Search Routes → File Operations: dispatches requests (evidence: `NodeJS-server/src/mongoRoutes/files.js`)
- File Operations → File Domain Service: calls (evidence: `NodeJS-server/src/mongoControllers/FilesController.js`)
- File Domain Service → File Metadata Repository: reads and writes (evidence: `NodeJS-server/src/services/filesService.js`)
- File Domain Service → Storage Protocol Client: requests file I/O (evidence: `NodeJS-server/src/services/filesService.js`)
- File Operations → Permissions and Sharing: permission endpoints
- Permissions and Sharing → File Domain Service: checks access (evidence: `NodeJS-server/src/mongoControllers/permissionsController.js`)
- Permissions and Sharing → User Services: resolves users (evidence: `NodeJS-server/src/mongoControllers/permissionsController.js`)
- File and Search Routes → Search: routes search
- Search → File Domain Service: searches files
- File Domain Service → Bin, Recent, Stars: manages file state (evidence: `NodeJS-server/src/services/filesService.js`)
- Storage Protocol Client → Socket Command Handler: sends commands
- Socket Command Handler → Storage Commands: dispatches commands (evidence: `cpp-server/src/server/SocketClientHandler.cpp`)
- Storage Commands → Local File Storage: performs file I/O
- Local File Storage → Binary Compression: uses strategy
