# piyushchy/namestorage architecture

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

- Interactive diagram: https://gitdiagram.com/piyushchy/namestorage
- Repository: https://github.com/piyushchy/namestorage

## Overview

namestorage is a personal web drive: a browser authenticates with Google, negotiates a WebRTC connection through a signaling service, then lists and transfers files directly with an agent on the user’s laptop. The agent confines access to one configured folder and supports listing, downloads, uploads, and folder creation; README also documents deletion. The CLI configures and monitors the laptop services. Browser implementation and some CLI details are not sampled, so those relationships rely on README statements; no unsampled source was inspected.

Main entry points: [`docs/app.js`](https://github.com/piyushchy/namestorage/blob/main/docs/app.js) (Web file manager), [`namestorage/signaling.py`](https://github.com/piyushchy/namestorage/blob/main/namestorage/signaling.py) (Signaling hub), [`namestorage/agent.py`](https://github.com/piyushchy/namestorage/blob/main/namestorage/agent.py) (Laptop agent), [`namestorage/cli.py`](https://github.com/piyushchy/namestorage/blob/main/namestorage/cli.py) (Setup and health CLI)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_browser["Browser drive"]
  node_browser["Web file manager<br/>[app.js]"]
  node_siteconfig["Browser config<br/>[config.js]"]
end

subgraph group_connection["Connection security"]
  node_signaling["Signaling hub<br/>[signaling.py]"]
  node_tickets["Signed tickets<br/>[ticket.py]"]
end

subgraph group_storage["Laptop storage"]
  node_agent["Laptop agent<br/>[agent.py]"]
  node_pathguard["Path validation<br/>[paths.py]"]
  node_rootfiles[("Root-folder files")]
  node_listing["File listing<br/>[agent.py]"]
  node_download["File download<br/>[agent.py]"]
  node_upload["Upload and mkdir<br/>[agent.py]"]
  node_delete["File deletion<br/>[agent.py]"]
end

subgraph group_operations["Laptop operations"]
  node_cli["Setup and health CLI<br/>[cli.py]"]
  node_systemd["System services"]
end

node_user(("Drive user"))
node_google(("Google sign-in"))
node_funnel["Tailscale Funnel"]

node_user -->|"uses"| node_browser
node_browser -->|"signs in"| node_google
node_google -->|"returns token"| node_browser
node_siteconfig -->|"configures"| node_browser
node_browser -->|"sends offer"| node_signaling
node_signaling -->|"mints ticket"| node_tickets
node_signaling -->|"relays offer"| node_agent
node_agent -->|"verifies ticket"| node_tickets
node_agent -->|"returns answer"| node_signaling
node_signaling -->|"relays answer"| node_browser
node_browser -->|"opens data channel"| node_agent
node_agent -->|"validates paths"| node_pathguard
node_listing -->|"reads entries"| node_rootfiles
node_download -->|"streams files"| node_rootfiles
node_upload -->|"writes files"| node_rootfiles
node_delete -->|"removes files"| node_rootfiles
node_cli -->|"manages services"| node_systemd
node_cli -->|"starts Funnel"| node_funnel
node_funnel -->|"publishes endpoint"| node_signaling

click node_browser "https://github.com/piyushchy/namestorage/blob/main/docs/app.js"
click node_siteconfig "https://github.com/piyushchy/namestorage/blob/main/docs/config.js"
click node_signaling "https://github.com/piyushchy/namestorage/blob/main/namestorage/signaling.py"
click node_tickets "https://github.com/piyushchy/namestorage/blob/main/namestorage/ticket.py"
click node_agent "https://github.com/piyushchy/namestorage/blob/main/namestorage/agent.py"
click node_pathguard "https://github.com/piyushchy/namestorage/blob/main/namestorage/paths.py"
click node_listing "https://github.com/piyushchy/namestorage/blob/main/namestorage/agent.py"
click node_download "https://github.com/piyushchy/namestorage/blob/main/namestorage/agent.py"
click node_upload "https://github.com/piyushchy/namestorage/blob/main/namestorage/agent.py"
click node_delete "https://github.com/piyushchy/namestorage/blob/main/namestorage/agent.py"
click node_cli "https://github.com/piyushchy/namestorage/blob/main/namestorage/cli.py"

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_browser,node_siteconfig,node_user toneBlue
class node_signaling,node_tickets toneAmber
class node_agent,node_pathguard,node_rootfiles,node_listing,node_download,node_upload,node_delete toneMint
class node_cli,node_systemd toneRose
class node_google,node_funnel toneIndigo
```

## Components

### Browser drive

- [Web file manager](https://github.com/piyushchy/namestorage/blob/main/docs/app.js): `docs/app.js`
- [Browser config](https://github.com/piyushchy/namestorage/blob/main/docs/config.js): `docs/config.js`

### Connection security

- [Signaling hub](https://github.com/piyushchy/namestorage/blob/main/namestorage/signaling.py): `namestorage/signaling.py`
- [Signed tickets](https://github.com/piyushchy/namestorage/blob/main/namestorage/ticket.py): `namestorage/ticket.py`

### Laptop storage

- [Laptop agent](https://github.com/piyushchy/namestorage/blob/main/namestorage/agent.py): `namestorage/agent.py`
- [Path validation](https://github.com/piyushchy/namestorage/blob/main/namestorage/paths.py): `namestorage/paths.py`
- **Root-folder files**
- [File listing](https://github.com/piyushchy/namestorage/blob/main/namestorage/agent.py): `namestorage/agent.py`
- [File download](https://github.com/piyushchy/namestorage/blob/main/namestorage/agent.py): `namestorage/agent.py`
- [Upload and mkdir](https://github.com/piyushchy/namestorage/blob/main/namestorage/agent.py): `namestorage/agent.py`
- [File deletion](https://github.com/piyushchy/namestorage/blob/main/namestorage/agent.py): `namestorage/agent.py`

### Laptop operations

- [Setup and health CLI](https://github.com/piyushchy/namestorage/blob/main/namestorage/cli.py): `namestorage/cli.py`
- **System services**

### Other components

- **Drive user**
- **Google sign-in**
- **Tailscale Funnel**

## Connections

- Drive user → Web file manager: uses (evidence: `README.md`)
- Web file manager → Google sign-in: signs in (evidence: `README.md`)
- Google sign-in → Web file manager: returns token (evidence: `README.md`)
- Browser config → Web file manager: configures (evidence: `README.md`)
- Web file manager → Signaling hub: sends offer (evidence: `README.md`)
- Signaling hub → Signed tickets: mints ticket (evidence: `namestorage/signaling.py`)
- Signaling hub → Laptop agent: relays offer (evidence: `namestorage/signaling.py`)
- Laptop agent → Signed tickets: verifies ticket (evidence: `namestorage/agent.py`)
- Laptop agent → Signaling hub: returns answer (evidence: `README.md`)
- Signaling hub → Web file manager: relays answer (evidence: `namestorage/signaling.py`)
- Web file manager → Laptop agent: opens data channel (evidence: `README.md`)
- Laptop agent → Path validation: validates paths (evidence: `namestorage/agent.py`)
- File listing → Root-folder files: reads entries (evidence: `README.md`)
- File download → Root-folder files: streams files (evidence: `README.md`)
- Upload and mkdir → Root-folder files: writes files (evidence: `README.md`)
- File deletion → Root-folder files: removes files (evidence: `README.md`)
- Setup and health CLI → System services: manages services (evidence: `namestorage/cli.py`)
- Setup and health CLI → Tailscale Funnel: starts Funnel (evidence: `namestorage/cli.py`)
- Tailscale Funnel → Signaling hub: publishes endpoint (evidence: `README.md`)
