# fairuzbaru43-blip/filemanager architecture

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

- Interactive diagram: https://gitdiagram.com/fairuzbaru43-blip/filemanager
- Repository: https://github.com/fairuzbaru43-blip/filemanager

## Overview

DriveBox is a shared, role-based file manager backed by Google Drive. Users sign in, browse folders and manage files through the web interface; API handlers enforce sessions and folder access before performing Drive operations. The README documents UI features beyond the sampled handlers. Dashed UI/API links indicate the workflow, but the browser request calls were not shown in the excerpts; other links are supported by excerpts, the SOURCE INDEX, or README. E.g. storage and session relationships are represented without assuming unsampled handler internals.

Main entry points: [`lib/auth.js`](https://github.com/fairuzbaru43-blip/filemanager/blob/main/lib/auth.js) (Session and password auth), [`public/app.js`](https://github.com/fairuzbaru43-blip/filemanager/blob/main/public/app.js) (File manager UI), [`lib/drive.js`](https://github.com/fairuzbaru43-blip/filemanager/blob/main/lib/drive.js) (Drive client and access checks), [`lib/drive-error-response.js`](https://github.com/fairuzbaru43-blip/filemanager/blob/main/lib/drive-error-response.js) (Drive error responses)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_web["Web interface"]
  node_webapp["File manager UI<br/>[app.js]"]
end

subgraph group_identity["Identity and sessions"]
  node_login["Login and throttling<br/>[login.js]"]
  node_session["Session and password auth<br/>[auth.js]"]
  node_authconfig["Auth configuration<br/>[configuration.js]"]
  node_redis[("Upstash Redis")]
  node_sessionapi["Session endpoints<br/>[logout.js]"]
  node_meapi["Current user endpoint<br/>[me.js]"]
end

subgraph group_files["File operations"]
  node_browse["Browse files<br/>[files.js]"]
  node_folders["Create folders<br/>[folders.js]"]
  node_upload["Upload files<br/>[upload.js]"]
  node_download["Download files<br/>[download.js]"]
  node_organize["Move and rename<br/>[move.js]"]
  node_copy["Copy items<br/>[copy.js]"]
  node_delete["Trash items<br/>[delete.js]"]
  node_visibility["Folder privacy<br/>[visibility.js]"]
end

subgraph group_drive["Drive access"]
  node_driveaccess["Drive client and access checks<br/>[drive.js]"]
  node_driveerrors["Drive error responses"]
  node_googledrive[("Google Drive")]
end

node_user(("Admin or user"))

node_user -->|"uses"| node_webapp
node_webapp -.->|"signs in"| node_login
node_webapp -.->|"browses"| node_browse
node_webapp -.->|"creates folders"| node_folders
node_webapp -.->|"uploads"| node_upload
node_webapp -.->|"downloads"| node_download
node_webapp -.->|"organizes"| node_organize
node_webapp -.->|"copies"| node_copy
node_webapp -.->|"trashes"| node_delete
node_webapp -.->|"sets privacy"| node_visibility
node_login -->|"verifies and sets"| node_session
node_login -->|"rate limits"| node_redis
node_session -->|"checks sessions"| node_redis
node_session -->|"validates configuration"| node_authconfig
node_sessionapi -->|"clears session"| node_session
node_meapi -->|"requires authentication"| node_session
node_browse -->|"requires authentication"| node_session
node_folders -->|"requires authentication"| node_session
node_upload -->|"requires authentication"| node_session
node_download -->|"requires authentication"| node_session
node_organize -->|"requires authentication"| node_session
node_copy -->|"requires authentication"| node_session
node_delete -->|"requires authentication"| node_session
node_visibility -->|"requires authentication"| node_session
node_browse -->|"checks folder access"| node_driveaccess
node_folders -->|"checks folder access"| node_driveaccess
node_upload -->|"checks parent access"| node_driveaccess
node_download -->|"checks item access"| node_driveaccess
node_organize -->|"checks item and destination"| node_driveaccess
node_copy -->|"checks item and destination"| node_driveaccess
node_delete -->|"checks item access"| node_driveaccess
node_visibility -->|"checks item access"| node_driveaccess
node_browse -->|"formats Drive errors"| node_driveerrors
node_folders -->|"formats Drive errors"| node_driveerrors
node_upload -->|"formats Drive errors"| node_driveerrors
node_download -->|"formats Drive errors"| node_driveerrors
node_organize -->|"formats Drive errors"| node_driveerrors
node_copy -->|"formats Drive errors"| node_driveerrors
node_delete -->|"formats Drive errors"| node_driveerrors
node_visibility -->|"formats Drive errors"| node_driveerrors
node_driveaccess -->|"reads and writes"| node_googledrive

click node_webapp "https://github.com/fairuzbaru43-blip/filemanager/blob/main/public/app.js"
click node_login "https://github.com/fairuzbaru43-blip/filemanager/blob/main/api/login.js"
click node_session "https://github.com/fairuzbaru43-blip/filemanager/blob/main/lib/auth.js"
click node_authconfig "https://github.com/fairuzbaru43-blip/filemanager/blob/main/lib/configuration.js"
click node_sessionapi "https://github.com/fairuzbaru43-blip/filemanager/blob/main/api/logout.js"
click node_meapi "https://github.com/fairuzbaru43-blip/filemanager/blob/main/api/me.js"
click node_browse "https://github.com/fairuzbaru43-blip/filemanager/blob/main/api/files.js"
click node_folders "https://github.com/fairuzbaru43-blip/filemanager/blob/main/api/folders.js"
click node_upload "https://github.com/fairuzbaru43-blip/filemanager/blob/main/api/upload.js"
click node_download "https://github.com/fairuzbaru43-blip/filemanager/blob/main/api/download.js"
click node_organize "https://github.com/fairuzbaru43-blip/filemanager/blob/main/api/move.js"
click node_copy "https://github.com/fairuzbaru43-blip/filemanager/blob/main/api/copy.js"
click node_delete "https://github.com/fairuzbaru43-blip/filemanager/blob/main/api/delete.js"
click node_visibility "https://github.com/fairuzbaru43-blip/filemanager/blob/main/api/visibility.js"
click node_driveaccess "https://github.com/fairuzbaru43-blip/filemanager/blob/main/lib/drive.js"
click node_driveerrors "https://github.com/fairuzbaru43-blip/filemanager/blob/main/lib/drive-error-response.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_webapp,node_user toneBlue
class node_login,node_session,node_authconfig,node_redis,node_sessionapi,node_meapi toneAmber
class node_browse,node_folders,node_upload,node_download,node_organize,node_copy,node_delete,node_visibility toneMint
class node_driveaccess,node_driveerrors,node_googledrive toneRose
```

## Components

### Web interface

- [File manager UI](https://github.com/fairuzbaru43-blip/filemanager/blob/main/public/app.js): `public/app.js`

### Identity and sessions

- [Login and throttling](https://github.com/fairuzbaru43-blip/filemanager/blob/main/api/login.js): `api/login.js`
- [Session and password auth](https://github.com/fairuzbaru43-blip/filemanager/blob/main/lib/auth.js): `lib/auth.js`
- [Auth configuration](https://github.com/fairuzbaru43-blip/filemanager/blob/main/lib/configuration.js): `lib/configuration.js`
- **Upstash Redis**
- [Session endpoints](https://github.com/fairuzbaru43-blip/filemanager/blob/main/api/logout.js): `api/logout.js`
- [Current user endpoint](https://github.com/fairuzbaru43-blip/filemanager/blob/main/api/me.js): `api/me.js`

### File operations

- [Browse files](https://github.com/fairuzbaru43-blip/filemanager/blob/main/api/files.js): `api/files.js`
- [Create folders](https://github.com/fairuzbaru43-blip/filemanager/blob/main/api/folders.js): `api/folders.js`
- [Upload files](https://github.com/fairuzbaru43-blip/filemanager/blob/main/api/upload.js): `api/upload.js`
- [Download files](https://github.com/fairuzbaru43-blip/filemanager/blob/main/api/download.js): `api/download.js`
- [Move and rename](https://github.com/fairuzbaru43-blip/filemanager/blob/main/api/move.js): `api/move.js`
- [Copy items](https://github.com/fairuzbaru43-blip/filemanager/blob/main/api/copy.js): `api/copy.js`
- [Trash items](https://github.com/fairuzbaru43-blip/filemanager/blob/main/api/delete.js): `api/delete.js`
- [Folder privacy](https://github.com/fairuzbaru43-blip/filemanager/blob/main/api/visibility.js): `api/visibility.js`

### Drive access

- [Drive client and access checks](https://github.com/fairuzbaru43-blip/filemanager/blob/main/lib/drive.js): `lib/drive.js`
- [Drive error responses](https://github.com/fairuzbaru43-blip/filemanager/blob/main/lib/drive-error-response.js): `lib/drive-error-response.js`
- **Google Drive**

### Other components

- **Admin or user**

## Connections

- Admin or user → File manager UI: uses (evidence: `README.md`)
- File manager UI → Login and throttling: signs in
- File manager UI → Browse files: browses
- File manager UI → Create folders: creates folders
- File manager UI → Upload files: uploads
- File manager UI → Download files: downloads
- File manager UI → Move and rename: organizes
- File manager UI → Copy items: copies
- File manager UI → Trash items: trashes
- File manager UI → Folder privacy: sets privacy
- Login and throttling → Session and password auth: verifies and sets (evidence: `api/login.js`)
- Login and throttling → Upstash Redis: rate limits (evidence: `api/login.js`)
- Session and password auth → Upstash Redis: checks sessions (evidence: `lib/auth.js`)
- Session and password auth → Auth configuration: validates configuration (evidence: `lib/auth.js`)
- Session endpoints → Session and password auth: clears session (evidence: `api/logout.js`)
- Current user endpoint → Session and password auth: requires authentication (evidence: `api/me.js`)
- Browse files → Session and password auth: requires authentication (evidence: `api/files.js`)
- Create folders → Session and password auth: requires authentication (evidence: `api/folders.js`)
- Upload files → Session and password auth: requires authentication (evidence: `api/upload.js`)
- Download files → Session and password auth: requires authentication (evidence: `api/download.js`)
- Move and rename → Session and password auth: requires authentication (evidence: `api/move.js`)
- Copy items → Session and password auth: requires authentication (evidence: `api/copy.js`)
- Trash items → Session and password auth: requires authentication (evidence: `api/delete.js`)
- Folder privacy → Session and password auth: requires authentication (evidence: `api/visibility.js`)
- Browse files → Drive client and access checks: checks folder access (evidence: `api/files.js`)
- Create folders → Drive client and access checks: checks folder access (evidence: `api/folders.js`)
- Upload files → Drive client and access checks: checks parent access (evidence: `api/upload.js`)
- Download files → Drive client and access checks: checks item access (evidence: `api/download.js`)
- Move and rename → Drive client and access checks: checks item and destination (evidence: `api/move.js`)
- Copy items → Drive client and access checks: checks item and destination (evidence: `api/copy.js`)
- Trash items → Drive client and access checks: checks item access (evidence: `api/delete.js`)
- Folder privacy → Drive client and access checks: checks item access (evidence: `api/visibility.js`)
- Browse files → Drive error responses: formats Drive errors (evidence: `api/files.js`)
- Create folders → Drive error responses: formats Drive errors (evidence: `api/folders.js`)
- Upload files → Drive error responses: formats Drive errors (evidence: `api/upload.js`)
- Download files → Drive error responses: formats Drive errors (evidence: `api/download.js`)
- Move and rename → Drive error responses: formats Drive errors (evidence: `api/move.js`)
- Copy items → Drive error responses: formats Drive errors (evidence: `api/copy.js`)
- Trash items → Drive error responses: formats Drive errors (evidence: `api/delete.js`)
- Folder privacy → Drive error responses: formats Drive errors (evidence: `api/visibility.js`)
- Drive client and access checks → Google Drive: reads and writes (evidence: `lib/drive.js`)
