# slywalker2006/dsh-passwords architecture

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

- Interactive diagram: https://gitdiagram.com/slywalker2006/dsh-passwords
- Repository: https://github.com/slywalker2006/dsh-passwords

## Overview

dsh-passwords is a server-side authentication and authorization gateway that adds secure multi-user access to DeepSeek Harness (DSH). The main workflow is browser request → setup/login → authenticated gateway session → permission-filtered HTTP/WebSocket proxy to DSH. Separate domain capabilities cover workspace/session grants and quotas, chat and media, administration, and encrypted audit/storage. The browser plugin exposes account, permissions, update, and chat interfaces; ACME supplies automatic HTTPS. Some subsystem links reflect README-documented capabilities because their implementation was not sampled.

Main entry points: [`src/gateway.ts`](https://github.com/slywalker2006/dsh-passwords/blob/main/src/gateway.ts) (Auth gateway), [`src/db.ts`](https://github.com/slywalker2006/dsh-passwords/blob/main/src/db.ts) (Platform database), [`src/proxy.ts`](https://github.com/slywalker2006/dsh-passwords/blob/main/src/proxy.ts) (HTTP/WS proxy), [`src/client/index.tsx`](https://github.com/slywalker2006/dsh-passwords/blob/main/src/client/index.tsx) (DSH plugin UI)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_gateway["Gateway and identity"]
  node_gateway["Auth gateway<br/>[gateway.ts]"]
  node_auth["Authentication<br/>[auth.ts]"]
  node_config["Platform config<br/>[config.ts]"]
  node_proxy["HTTP/WS proxy<br/>[proxy.ts]"]
end

subgraph group_access["Authorization and storage"]
  node_permissions["Access policy<br/>[permissions.ts]"]
  node_database[("Platform database<br/>[db.ts]")]
  node_encryption["Field encryption<br/>[encrypt.ts]"]
end

subgraph group_features["User capabilities"]
  node_admin["Account management<br/>[admin.ts]"]
  node_messages["Chat messages<br/>[messages.ts]"]
  node_media["Chat media<br/>[media.ts]"]
end

subgraph group_client["DSH client"]
  node_client["DSH plugin UI<br/>[index.tsx]"]
  node_settings["Settings card<br/>[card.tsx]"]
  node_chatui["Chat interface<br/>[chat.tsx]"]
  node_picker["Workspace deletion UI<br/>[picker-delete.ts]"]
end

subgraph group_ops["TLS and updates"]
  node_acme["ACME certificates<br/>[acme.ts]"]
  node_update["Update engine<br/>[update.ts]"]
  node_patch["DSH patching<br/>[patch.ts]"]
end

node_user(("Browser user"))
node_dsh["DSH service"]
node_letsencrypt["Let's Encrypt"]
node_githubnpm["GitHub and npm"]

node_user -->|"requests"| node_gateway
node_gateway -->|"loads settings"| node_config
node_gateway -->|"authenticates"| node_auth
node_auth -->|"reads/writes"| node_database
node_gateway -->|"checks access"| node_permissions
node_gateway -->|"reads/writes"| node_database
node_database -->|"encrypts fields"| node_encryption
node_gateway -->|"dispatches"| node_proxy
node_proxy -->|"filters access"| node_permissions
node_proxy -->|"proxies HTTP/WS"| node_dsh
node_proxy -->|"records grants"| node_database
node_gateway -->|"serves management"| node_admin
node_admin -->|"updates accounts"| node_database
node_gateway -->|"serves chat APIs"| node_messages
node_messages -->|"stores messages"| node_database
node_gateway -->|"serves media APIs"| node_media
node_media -->|"tracks media"| node_database
node_client -->|"registers card"| node_settings
node_client -->|"registers overlay"| node_chatui
node_client -->|"starts enhancement"| node_picker
node_settings -->|"calls APIs"| node_gateway
node_chatui -->|"calls APIs"| node_gateway
node_picker -->|"deletes directory"| node_gateway
node_gateway -->|"manages TLS"| node_acme
node_acme -.->|"requests certificates"| node_letsencrypt
node_gateway -->|"exposes update API"| node_update
node_settings -->|"requests patch reload"| node_gateway
node_gateway -->|"reloads patch"| node_patch
node_update -.->|"checks/downloads"| node_githubnpm

click node_gateway "https://github.com/slywalker2006/dsh-passwords/blob/main/src/gateway.ts"
click node_auth "https://github.com/slywalker2006/dsh-passwords/blob/main/src/auth.ts"
click node_config "https://github.com/slywalker2006/dsh-passwords/blob/main/src/config.ts"
click node_proxy "https://github.com/slywalker2006/dsh-passwords/blob/main/src/proxy.ts"
click node_permissions "https://github.com/slywalker2006/dsh-passwords/blob/main/src/permissions.ts"
click node_database "https://github.com/slywalker2006/dsh-passwords/blob/main/src/db.ts"
click node_encryption "https://github.com/slywalker2006/dsh-passwords/blob/main/src/encrypt.ts"
click node_admin "https://github.com/slywalker2006/dsh-passwords/blob/main/src/admin.ts"
click node_messages "https://github.com/slywalker2006/dsh-passwords/blob/main/src/messages.ts"
click node_media "https://github.com/slywalker2006/dsh-passwords/blob/main/src/media.ts"
click node_client "https://github.com/slywalker2006/dsh-passwords/blob/main/src/client/index.tsx"
click node_settings "https://github.com/slywalker2006/dsh-passwords/blob/main/src/client/card.tsx"
click node_chatui "https://github.com/slywalker2006/dsh-passwords/blob/main/src/client/chat.tsx"
click node_picker "https://github.com/slywalker2006/dsh-passwords/blob/main/src/client/picker-delete.ts"
click node_acme "https://github.com/slywalker2006/dsh-passwords/blob/main/src/acme.ts"
click node_update "https://github.com/slywalker2006/dsh-passwords/blob/main/src/update.ts"
click node_patch "https://github.com/slywalker2006/dsh-passwords/blob/main/src/patch.ts"

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_gateway,node_auth,node_config,node_proxy,node_user toneBlue
class node_permissions,node_database,node_encryption toneAmber
class node_admin,node_messages,node_media toneMint
class node_client,node_settings,node_chatui,node_picker toneRose
class node_acme,node_update,node_patch,node_dsh,node_letsencrypt,node_githubnpm toneIndigo
```

## Components

### Gateway and identity

- [Auth gateway](https://github.com/slywalker2006/dsh-passwords/blob/main/src/gateway.ts): `src/gateway.ts`
- [Authentication](https://github.com/slywalker2006/dsh-passwords/blob/main/src/auth.ts): `src/auth.ts`
- [Platform config](https://github.com/slywalker2006/dsh-passwords/blob/main/src/config.ts): `src/config.ts`
- [HTTP/WS proxy](https://github.com/slywalker2006/dsh-passwords/blob/main/src/proxy.ts): `src/proxy.ts`

### Authorization and storage

- [Access policy](https://github.com/slywalker2006/dsh-passwords/blob/main/src/permissions.ts): `src/permissions.ts`
- [Platform database](https://github.com/slywalker2006/dsh-passwords/blob/main/src/db.ts): `src/db.ts`
- [Field encryption](https://github.com/slywalker2006/dsh-passwords/blob/main/src/encrypt.ts): `src/encrypt.ts`

### User capabilities

- [Account management](https://github.com/slywalker2006/dsh-passwords/blob/main/src/admin.ts): `src/admin.ts`
- [Chat messages](https://github.com/slywalker2006/dsh-passwords/blob/main/src/messages.ts): `src/messages.ts`
- [Chat media](https://github.com/slywalker2006/dsh-passwords/blob/main/src/media.ts): `src/media.ts`

### DSH client

- [DSH plugin UI](https://github.com/slywalker2006/dsh-passwords/blob/main/src/client/index.tsx): `src/client/index.tsx`
- [Settings card](https://github.com/slywalker2006/dsh-passwords/blob/main/src/client/card.tsx): `src/client/card.tsx`
- [Chat interface](https://github.com/slywalker2006/dsh-passwords/blob/main/src/client/chat.tsx): `src/client/chat.tsx`
- [Workspace deletion UI](https://github.com/slywalker2006/dsh-passwords/blob/main/src/client/picker-delete.ts): `src/client/picker-delete.ts`

### TLS and updates

- [ACME certificates](https://github.com/slywalker2006/dsh-passwords/blob/main/src/acme.ts): `src/acme.ts`
- [Update engine](https://github.com/slywalker2006/dsh-passwords/blob/main/src/update.ts): `src/update.ts`
- [DSH patching](https://github.com/slywalker2006/dsh-passwords/blob/main/src/patch.ts): `src/patch.ts`

### Other components

- **Browser user**
- **DSH service**
- **Let's Encrypt**
- **GitHub and npm**

## Connections

- Browser user → Auth gateway: requests
- Auth gateway → Platform config: loads settings
- Auth gateway → Authentication: authenticates
- Authentication → Platform database: reads/writes
- Auth gateway → Access policy: checks access
- Auth gateway → Platform database: reads/writes
- Platform database → Field encryption: encrypts fields
- Auth gateway → HTTP/WS proxy: dispatches
- HTTP/WS proxy → Access policy: filters access
- HTTP/WS proxy → DSH service: proxies HTTP/WS
- HTTP/WS proxy → Platform database: records grants
- Auth gateway → Account management: serves management
- Account management → Platform database: updates accounts
- Auth gateway → Chat messages: serves chat APIs
- Chat messages → Platform database: stores messages
- Auth gateway → Chat media: serves media APIs
- Chat media → Platform database: tracks media
- DSH plugin UI → Settings card: registers card
- DSH plugin UI → Chat interface: registers overlay
- DSH plugin UI → Workspace deletion UI: starts enhancement
- Settings card → Auth gateway: calls APIs
- Chat interface → Auth gateway: calls APIs
- Workspace deletion UI → Auth gateway: deletes directory
- Auth gateway → ACME certificates: manages TLS
- ACME certificates → Let's Encrypt: requests certificates
- Auth gateway → Update engine: exposes update API
- Settings card → Auth gateway: requests patch reload
- Auth gateway → DSH patching: reloads patch
- Update engine → GitHub and npm: checks/downloads
