# sovchat/sov-serverside architecture

> Architecture diagram of the GitHub repository sovchat/sov-serverside, 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/sovchat/sov-serverside
- Repository: https://github.com/sovchat/sov-serverside

## Overview

Sov Server is a headless, single-group messaging backend. Clients call its HTTP API to apply for membership, exchange encrypted messages and files, and manage group access; administrators approve or reject applicants. The server authenticates requests, enforces membership and administrator checks, and delegates persistence to a mutex-protected filesystem store. The README documents the API capabilities, while the sampled source confirms representative handler-to-store calls and startup wiring; some individual routes and storage methods are not fully shown.

Main entry points: [`storage/storage.go`](https://github.com/sovchat/sov-serverside/blob/main/storage/storage.go) (Filesystem Store), [`handlers/handlers.go`](https://github.com/sovchat/sov-serverside/blob/main/handlers/handlers.go) (HTTP API), [`main.go`](https://github.com/sovchat/sov-serverside/blob/main/main.go) (HTTP Server)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_runtime["Server Runtime"]
  node_server["HTTP Server<br/>[main.go]"]
  node_api["HTTP API<br/>[handlers.go]"]
  node_health["Health API<br/>[handlers.go]"]
end

subgraph group_access["Identity And Membership"]
  node_auth["Authentication<br/>[handlers.go]"]
  node_member_ops["Membership API<br/>[handlers.go]"]
  node_member_store["Membership State<br/>[storage.go]"]
  node_password_store["Password State<br/>[storage.go]"]
end

subgraph group_messaging["Encrypted Messaging"]
  node_chat_api["Chat API<br/>[handlers.go]"]
  node_file_api["File API<br/>[handlers.go]"]
end

subgraph group_persistence["Filesystem Persistence"]
  node_store["Filesystem Store<br/>[storage.go]"]
  node_member_files[("Group Records<br/>[storage.go]")]
  node_chat_logs[("Chat Logs<br/>[storage.go]")]
  node_encrypted_files[("Encrypted Files<br/>[storage.go]")]
end

node_clients(("Frontend Clients"))

node_clients -->|"HTTP requests"| node_server
node_server -->|"registers routes"| node_api
node_server -->|"initializes store"| node_store
node_api -->|"dispatches"| node_health
node_api -->|"dispatches"| node_member_ops
node_api -->|"dispatches"| node_chat_api
node_api -->|"dispatches"| node_file_api
node_health -->|"reads status"| node_store
node_member_ops -->|"authenticates"| node_auth
node_auth -->|"verifies passwords"| node_password_store
node_member_ops -->|"manages membership"| node_store
node_chat_api -->|"authenticates"| node_auth
node_chat_api -->|"reads and writes messages"| node_store
node_file_api -->|"authenticates"| node_auth
node_file_api -->|"reads and writes files"| node_store
node_store -->|"reads and writes"| node_member_files
node_store -->|"reads and writes"| node_password_store
node_store -->|"appends and reads"| node_chat_logs
node_store -->|"stores and retrieves"| node_encrypted_files

click node_server "https://github.com/sovchat/sov-serverside/blob/main/main.go"
click node_api "https://github.com/sovchat/sov-serverside/blob/main/handlers/handlers.go"
click node_auth "https://github.com/sovchat/sov-serverside/blob/main/handlers/handlers.go"
click node_member_ops "https://github.com/sovchat/sov-serverside/blob/main/handlers/handlers.go"
click node_member_store "https://github.com/sovchat/sov-serverside/blob/main/storage/storage.go"
click node_password_store "https://github.com/sovchat/sov-serverside/blob/main/storage/storage.go"
click node_health "https://github.com/sovchat/sov-serverside/blob/main/handlers/handlers.go"
click node_chat_api "https://github.com/sovchat/sov-serverside/blob/main/handlers/handlers.go"
click node_file_api "https://github.com/sovchat/sov-serverside/blob/main/handlers/handlers.go"
click node_store "https://github.com/sovchat/sov-serverside/blob/main/storage/storage.go"
click node_member_files "https://github.com/sovchat/sov-serverside/blob/main/storage/storage.go"
click node_chat_logs "https://github.com/sovchat/sov-serverside/blob/main/storage/storage.go"
click node_encrypted_files "https://github.com/sovchat/sov-serverside/blob/main/storage/storage.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_server,node_api,node_health,node_clients toneBlue
class node_auth,node_member_ops,node_member_store,node_password_store toneAmber
class node_chat_api,node_file_api toneMint
class node_store,node_member_files,node_chat_logs,node_encrypted_files toneRose
```

## Components

### Server Runtime

- [HTTP Server](https://github.com/sovchat/sov-serverside/blob/main/main.go): `main.go`
- [HTTP API](https://github.com/sovchat/sov-serverside/blob/main/handlers/handlers.go): `handlers/handlers.go`
- [Health API](https://github.com/sovchat/sov-serverside/blob/main/handlers/handlers.go): `handlers/handlers.go`

### Identity And Membership

- [Authentication](https://github.com/sovchat/sov-serverside/blob/main/handlers/handlers.go): `handlers/handlers.go`
- [Membership API](https://github.com/sovchat/sov-serverside/blob/main/handlers/handlers.go): `handlers/handlers.go`
- [Membership State](https://github.com/sovchat/sov-serverside/blob/main/storage/storage.go): `storage/storage.go`
- [Password State](https://github.com/sovchat/sov-serverside/blob/main/storage/storage.go): `storage/storage.go`

### Encrypted Messaging

- [Chat API](https://github.com/sovchat/sov-serverside/blob/main/handlers/handlers.go): `handlers/handlers.go`
- [File API](https://github.com/sovchat/sov-serverside/blob/main/handlers/handlers.go): `handlers/handlers.go`

### Filesystem Persistence

- [Filesystem Store](https://github.com/sovchat/sov-serverside/blob/main/storage/storage.go): `storage/storage.go`
- [Group Records](https://github.com/sovchat/sov-serverside/blob/main/storage/storage.go): `storage/storage.go`
- [Chat Logs](https://github.com/sovchat/sov-serverside/blob/main/storage/storage.go): `storage/storage.go`
- [Encrypted Files](https://github.com/sovchat/sov-serverside/blob/main/storage/storage.go): `storage/storage.go`

### Other components

- **Frontend Clients**

## Connections

- Frontend Clients → HTTP Server: HTTP requests
- HTTP Server → HTTP API: registers routes
- HTTP Server → Filesystem Store: initializes store
- HTTP API → Health API: dispatches
- HTTP API → Membership API: dispatches
- HTTP API → Chat API: dispatches
- HTTP API → File API: dispatches
- Health API → Filesystem Store: reads status
- Membership API → Authentication: authenticates
- Authentication → Password State: verifies passwords
- Membership API → Filesystem Store: manages membership
- Chat API → Authentication: authenticates
- Chat API → Filesystem Store: reads and writes messages
- File API → Authentication: authenticates
- File API → Filesystem Store: reads and writes files
- Filesystem Store → Group Records: reads and writes
- Filesystem Store → Password State: reads and writes
- Filesystem Store → Chat Logs: appends and reads
- Filesystem Store → Encrypted Files: stores and retrieves
