# dovletemin/paylash_v2 architecture

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

- Interactive diagram: https://gitdiagram.com/dovletemin/paylash_v2
- Repository: https://github.com/dovletemin/paylash_v2

## Overview

Paýlaş is a self-hosted cloud file workspace for an architecture studio. The main workflow is an employee using the web app to browse a personal, common, or project space, upload or open a file, and retrieve or share it; office editing uses Collabora through WOPI. Separate branches cover chat, administration, WebDAV, and optional web push. Backend feature details beyond the sampled files are represented at their documented subsystem paths; exact handler-to-storage wiring is only shown where supported.

Main entry points: [`internal/db`](https://github.com/dovletemin/paylash_v2/tree/main/internal/db) (Data access), [`internal/api`](https://github.com/dovletemin/paylash_v2/tree/main/internal/api) (API handlers), [`web/js/api.js`](https://github.com/dovletemin/paylash_v2/blob/main/web/js/api.js) (API client), [`internal/storage/minio.go`](https://github.com/dovletemin/paylash_v2/blob/main/internal/storage/minio.go) (Object storage client)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_client["Web client"]
  node_browser["Web browser"]
  node_app["App router<br/>[app.js]"]
  node_clientapi["API client<br/>[api.js]"]
  node_fileui["Files UI<br/>[files.js]"]
  node_chatui["Chat client<br/>[chat.js]"]
end

subgraph group_backend["Application backend"]
  node_server["HTTP server<br/>[server.go]"]
  node_api["API handlers"]
  node_auth["Authentication<br/>[auth.go]"]
  node_db["Data access"]
end

subgraph group_files["Files and storage"]
  node_storage["Object storage client<br/>[minio.go]"]
  node_uploads["Resumable uploads<br/>[uploads.go]"]
  node_versions["File history and trash<br/>[versions.go]"]
  node_shares["File sharing<br/>[shares.go]"]
  node_preview["Preview and annotations<br/>[preview.js]"]
  node_dav["WebDAV access<br/>[handler.go]"]
end

subgraph group_collab["Collaboration"]
  node_wopi["WOPI integration<br/>[handler.go]"]
  node_chat["Realtime chat<br/>[chat.go]"]
  node_push["Web push<br/>[webpush.go]"]
end

subgraph group_ops["Administration"]
  node_admin["Admin panel<br/>[admin.go]"]
end

node_employee(("Employee"))
node_pg[("PostgreSQL")]
node_minio[("MinIO object store")]
node_collabora["Collabora Online"]
node_pushservice["Browser push service"]

node_employee -->|"uses"| node_browser
node_browser -->|"loads app"| node_app
node_app -->|"requests data"| node_clientapi
node_clientapi -->|"HTTP requests"| node_server
node_server -->|"dispatches"| node_api
node_api -->|"handles sign-in"| node_auth
node_auth -->|"reads sessions"| node_db
node_api -->|"reads and writes"| node_db
node_db -->|"queries"| node_pg
node_fileui -->|"requests files"| node_clientapi
node_api -->|"dispatches upload routes"| node_uploads
node_uploads -->|"uploads objects"| node_storage
node_storage -->|"reads and writes"| node_minio
node_api -->|"dispatches file routes"| node_versions
node_versions -->|"updates file records"| node_db
node_versions -->|"restores object versions"| node_storage
node_api -->|"dispatches share routes"| node_shares
node_shares -->|"stores share records"| node_db
node_preview -->|"loads previews"| node_clientapi
node_server -->|"routes WOPI requests"| node_wopi
node_wopi -->|"validates tokens"| node_db
node_wopi -->|"reads and saves files"| node_storage
node_collabora -->|"opens and saves"| node_wopi
node_chatui -->|"sends chat requests"| node_clientapi
node_api -->|"dispatches chat routes"| node_chat
node_chat -->|"stores messages"| node_db
node_admin -->|"manages accounts and projects"| node_db
node_server -->|"serves WebDAV"| node_dav
node_dav -->|"resolves files and users"| node_db
node_dav -->|"accesses file objects"| node_storage
node_chat -.->|"notifies recipients"| node_push
node_push -.->|"sends web push"| node_pushservice

click node_app "https://github.com/dovletemin/paylash_v2/blob/main/web/js/app.js"
click node_clientapi "https://github.com/dovletemin/paylash_v2/blob/main/web/js/api.js"
click node_fileui "https://github.com/dovletemin/paylash_v2/blob/main/web/js/files.js"
click node_server "https://github.com/dovletemin/paylash_v2/blob/main/internal/server/server.go"
click node_api "https://github.com/dovletemin/paylash_v2/tree/main/internal/api"
click node_auth "https://github.com/dovletemin/paylash_v2/blob/main/internal/api/auth.go"
click node_db "https://github.com/dovletemin/paylash_v2/tree/main/internal/db"
click node_storage "https://github.com/dovletemin/paylash_v2/blob/main/internal/storage/minio.go"
click node_uploads "https://github.com/dovletemin/paylash_v2/blob/main/internal/api/uploads.go"
click node_versions "https://github.com/dovletemin/paylash_v2/blob/main/internal/api/versions.go"
click node_shares "https://github.com/dovletemin/paylash_v2/blob/main/internal/api/shares.go"
click node_preview "https://github.com/dovletemin/paylash_v2/blob/main/web/js/preview.js"
click node_wopi "https://github.com/dovletemin/paylash_v2/blob/main/internal/wopi/handler.go"
click node_chat "https://github.com/dovletemin/paylash_v2/blob/main/internal/api/chat.go"
click node_chatui "https://github.com/dovletemin/paylash_v2/blob/main/web/js/chat.js"
click node_admin "https://github.com/dovletemin/paylash_v2/blob/main/internal/api/admin.go"
click node_dav "https://github.com/dovletemin/paylash_v2/blob/main/internal/dav/handler.go"
click node_push "https://github.com/dovletemin/paylash_v2/blob/main/internal/webpush/webpush.go"

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_app,node_clientapi,node_fileui,node_chatui,node_pushservice toneBlue
class node_server,node_api,node_auth,node_db,node_pg,node_minio toneAmber
class node_storage,node_uploads,node_versions,node_shares,node_preview,node_dav toneMint
class node_wopi,node_chat,node_push toneRose
class node_admin,node_employee,node_collabora toneIndigo
```

## Components

### Web client

- **Web browser**
- [App router](https://github.com/dovletemin/paylash_v2/blob/main/web/js/app.js): `web/js/app.js`
- [API client](https://github.com/dovletemin/paylash_v2/blob/main/web/js/api.js): `web/js/api.js`
- [Files UI](https://github.com/dovletemin/paylash_v2/blob/main/web/js/files.js): `web/js/files.js`
- [Chat client](https://github.com/dovletemin/paylash_v2/blob/main/web/js/chat.js): `web/js/chat.js`

### Application backend

- [HTTP server](https://github.com/dovletemin/paylash_v2/blob/main/internal/server/server.go): `internal/server/server.go`
- [API handlers](https://github.com/dovletemin/paylash_v2/tree/main/internal/api): `internal/api`
- [Authentication](https://github.com/dovletemin/paylash_v2/blob/main/internal/api/auth.go): `internal/api/auth.go`
- [Data access](https://github.com/dovletemin/paylash_v2/tree/main/internal/db): `internal/db`

### Files and storage

- [Object storage client](https://github.com/dovletemin/paylash_v2/blob/main/internal/storage/minio.go): `internal/storage/minio.go`
- [Resumable uploads](https://github.com/dovletemin/paylash_v2/blob/main/internal/api/uploads.go): `internal/api/uploads.go`
- [File history and trash](https://github.com/dovletemin/paylash_v2/blob/main/internal/api/versions.go): `internal/api/versions.go`
- [File sharing](https://github.com/dovletemin/paylash_v2/blob/main/internal/api/shares.go): `internal/api/shares.go`
- [Preview and annotations](https://github.com/dovletemin/paylash_v2/blob/main/web/js/preview.js): `web/js/preview.js`
- [WebDAV access](https://github.com/dovletemin/paylash_v2/blob/main/internal/dav/handler.go): `internal/dav/handler.go`

### Collaboration

- [WOPI integration](https://github.com/dovletemin/paylash_v2/blob/main/internal/wopi/handler.go): `internal/wopi/handler.go`
- [Realtime chat](https://github.com/dovletemin/paylash_v2/blob/main/internal/api/chat.go): `internal/api/chat.go`
- [Web push](https://github.com/dovletemin/paylash_v2/blob/main/internal/webpush/webpush.go): `internal/webpush/webpush.go`

### Administration

- [Admin panel](https://github.com/dovletemin/paylash_v2/blob/main/internal/api/admin.go): `internal/api/admin.go`

### Other components

- **Employee**
- **PostgreSQL**
- **MinIO object store**
- **Collabora Online**
- **Browser push service**

## Connections

- Employee → Web browser: uses
- Web browser → App router: loads app
- App router → API client: requests data
- API client → HTTP server: HTTP requests
- HTTP server → API handlers: dispatches
- API handlers → Authentication: handles sign-in
- Authentication → Data access: reads sessions
- API handlers → Data access: reads and writes
- Data access → PostgreSQL: queries
- Files UI → API client: requests files
- API handlers → Resumable uploads: dispatches upload routes
- Resumable uploads → Object storage client: uploads objects
- Object storage client → MinIO object store: reads and writes
- API handlers → File history and trash: dispatches file routes
- File history and trash → Data access: updates file records
- File history and trash → Object storage client: restores object versions
- API handlers → File sharing: dispatches share routes
- File sharing → Data access: stores share records
- Preview and annotations → API client: loads previews
- HTTP server → WOPI integration: routes WOPI requests
- WOPI integration → Data access: validates tokens
- WOPI integration → Object storage client: reads and saves files
- Collabora Online → WOPI integration: opens and saves
- Chat client → API client: sends chat requests
- API handlers → Realtime chat: dispatches chat routes
- Realtime chat → Data access: stores messages
- Admin panel → Data access: manages accounts and projects
- HTTP server → WebDAV access: serves WebDAV
- WebDAV access → Data access: resolves files and users
- WebDAV access → Object storage client: accesses file objects
- Realtime chat → Web push: notifies recipients
- Web push → Browser push service: sends web push
