# portfoliobts/masages architecture

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

- Interactive diagram: https://gitdiagram.com/portfoliobts/masages
- Repository: https://github.com/portfoliobts/masages

## Overview

Nyxo is an anonymous, browser-based messenger with end-to-end encrypted group messaging, temporary accounts, invitations, file sharing, and disappearing messages. Users enter through a proof-of-work-protected account flow, then use the browser client over HTTP and Socket.IO to manage chats and exchange messages or files; server-side services persist and deliver data while the client handles group encryption. The README also documents key transparency and client-code verification. The excerpts show selected server wiring and module references, but not most route-to-service or client-to-server calls, so those links are omitted or marked unverified.

Main entry points: [`public/js/18-init.js`](https://github.com/portfoliobts/masages/blob/main/public/js/18-init.js) (Messenger interface), [`src/http/routes/index.js`](https://github.com/portfoliobts/masages/blob/main/src/http/routes/index.js) (API routes), [`src/http/app.js`](https://github.com/portfoliobts/masages/blob/main/src/http/app.js) (HTTP application), [`src/services/accounts.js`](https://github.com/portfoliobts/masages/blob/main/src/services/accounts.js) (Anonymous accounts)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_client["Browser client"]
  node_browser["Messenger interface<br/>[18-init.js]"]
  node_client_e2ee["Client encryption<br/>[03-e2ee-client.js]"]
  node_client_rooms["Room membership<br/>[04-e2ee-rooms.js]"]
  node_client_uploads["File handling<br/>[05-attachments.js]"]
  node_client_search["Local search<br/>[text-search.js]"]
  node_client_kt["Transparency checks<br/>[kt-client.js]"]
end

subgraph group_server["HTTP and realtime"]
  node_http_app["HTTP application<br/>[app.js]"]
  node_api_routes["API routes<br/>[index.js]"]
  node_socket_handlers["Socket handlers<br/>[socket-handlers.js]"]
  node_tor["Optional Tor ingress<br/>[tor-support.js]"]
end

subgraph group_domain["Messaging services"]
  node_account["Anonymous accounts<br/>[accounts.js]"]
  node_rooms["Rooms and membership<br/>[rooms.js]"]
  node_messages["Message service<br/>[messages.js]"]
  node_uploads["Upload service<br/>[uploads.js]"]
  node_expiry["Expiry service<br/>[expiry.js]"]
end

subgraph group_security["Security and trust"]
  node_key_store["Identity keys<br/>[key-store.js]"]
  node_kt_service["Key transparency<br/>[kt-service.js]"]
  node_kt_log["Transparency log<br/>[kt-log.js]"]
  node_manifest["Client manifest<br/>[client-manifest.js]"]
  node_client_verify["Client verification<br/>[client-verify.js]"]
end

subgraph group_storage["Persistence and jobs"]
  node_db[("PostgreSQL<br/>[pool.js]")]
  node_session_store[("Session storage<br/>[session-store.js]")]
  node_jobs["Background jobs<br/>[index.js]"]
  node_scheduler["Job scheduler<br/>[index.js]"]
end

node_user(("Messenger user"))
node_onion_user(("Tor Browser user"))

node_user -->|"uses"| node_browser
node_browser -.->|"encrypts with"| node_client_e2ee
node_browser -.->|"manages rooms"| node_client_rooms
node_browser -.->|"handles files"| node_client_uploads
node_browser -.->|"searches locally"| node_client_search
node_browser -.->|"uses API"| node_http_app
node_browser -.->|"connects by socket"| node_socket_handlers
node_http_app -->|"registers routes"| node_api_routes
node_http_app -->|"loads sessions"| node_session_store
node_http_app -->|"registers manifest route"| node_manifest
node_api_routes -.->|"routes account flow"| node_account
node_api_routes -.->|"routes room actions"| node_rooms
node_api_routes -.->|"routes messages"| node_messages
node_api_routes -.->|"routes uploads"| node_uploads
node_account -->|"calls"| node_rooms
node_account -->|"calls"| node_messages
node_account -->|"uses keys"| node_key_store
node_messages -.->|"writes and reads"| node_db
node_client_e2ee -.->|"checks log"| node_client_kt
node_client_kt -.->|"requests proofs"| node_kt_service
node_kt_service -->|"builds log indexes"| node_kt_log
node_kt_service -->|"reads keys"| node_key_store
node_kt_service -->|"queries"| node_db
node_manifest -->|"describes client files"| node_client_verify
node_client_verify -.->|"verifies assets"| node_browser
node_session_store -.->|"stores sessions"| node_db
node_jobs -->|"registers jobs"| node_scheduler
node_scheduler -.->|"purges expired accounts"| node_account
node_onion_user -->|"connects through Tor"| node_tor
node_tor -->|"forwards ingress"| node_http_app

click node_browser "https://github.com/portfoliobts/masages/blob/main/public/js/18-init.js"
click node_client_e2ee "https://github.com/portfoliobts/masages/blob/main/public/js/03-e2ee-client.js"
click node_client_rooms "https://github.com/portfoliobts/masages/blob/main/public/js/04-e2ee-rooms.js"
click node_client_uploads "https://github.com/portfoliobts/masages/blob/main/public/js/05-attachments.js"
click node_client_search "https://github.com/portfoliobts/masages/blob/main/public/lib/text-search.js"
click node_client_kt "https://github.com/portfoliobts/masages/blob/main/public/lib/kt-client.js"
click node_http_app "https://github.com/portfoliobts/masages/blob/main/src/http/app.js"
click node_api_routes "https://github.com/portfoliobts/masages/blob/main/src/http/routes/index.js"
click node_socket_handlers "https://github.com/portfoliobts/masages/blob/main/src/realtime/socket-handlers.js"
click node_account "https://github.com/portfoliobts/masages/blob/main/src/services/accounts.js"
click node_rooms "https://github.com/portfoliobts/masages/blob/main/src/services/rooms.js"
click node_messages "https://github.com/portfoliobts/masages/blob/main/src/services/messages.js"
click node_uploads "https://github.com/portfoliobts/masages/blob/main/src/services/uploads.js"
click node_expiry "https://github.com/portfoliobts/masages/blob/main/src/services/expiry.js"
click node_key_store "https://github.com/portfoliobts/masages/blob/main/lib/key-store.js"
click node_kt_service "https://github.com/portfoliobts/masages/blob/main/lib/kt-service.js"
click node_kt_log "https://github.com/portfoliobts/masages/blob/main/lib/kt-log.js"
click node_manifest "https://github.com/portfoliobts/masages/blob/main/lib/client-manifest.js"
click node_client_verify "https://github.com/portfoliobts/masages/blob/main/public/lib/client-verify.js"
click node_db "https://github.com/portfoliobts/masages/blob/main/src/db/pool.js"
click node_session_store "https://github.com/portfoliobts/masages/blob/main/lib/session-store.js"
click node_jobs "https://github.com/portfoliobts/masages/blob/main/src/jobs/index.js"
click node_scheduler "https://github.com/portfoliobts/masages/blob/main/lib/jobs/index.js"
click node_tor "https://github.com/portfoliobts/masages/blob/main/lib/tor-support.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_browser,node_client_e2ee,node_client_rooms,node_client_uploads,node_client_search,node_client_kt,node_user,node_onion_user toneBlue
class node_http_app,node_api_routes,node_socket_handlers,node_tor toneAmber
class node_account,node_rooms,node_messages,node_uploads,node_expiry toneMint
class node_key_store,node_kt_service,node_kt_log,node_manifest,node_client_verify toneRose
class node_db,node_session_store,node_jobs,node_scheduler toneIndigo
```

## Components

### Browser client

- [Messenger interface](https://github.com/portfoliobts/masages/blob/main/public/js/18-init.js): `public/js/18-init.js`
- [Client encryption](https://github.com/portfoliobts/masages/blob/main/public/js/03-e2ee-client.js): `public/js/03-e2ee-client.js`
- [Room membership](https://github.com/portfoliobts/masages/blob/main/public/js/04-e2ee-rooms.js): `public/js/04-e2ee-rooms.js`
- [File handling](https://github.com/portfoliobts/masages/blob/main/public/js/05-attachments.js): `public/js/05-attachments.js`
- [Local search](https://github.com/portfoliobts/masages/blob/main/public/lib/text-search.js): `public/lib/text-search.js`
- [Transparency checks](https://github.com/portfoliobts/masages/blob/main/public/lib/kt-client.js): `public/lib/kt-client.js`

### HTTP and realtime

- [HTTP application](https://github.com/portfoliobts/masages/blob/main/src/http/app.js): `src/http/app.js`
- [API routes](https://github.com/portfoliobts/masages/blob/main/src/http/routes/index.js): `src/http/routes/index.js`
- [Socket handlers](https://github.com/portfoliobts/masages/blob/main/src/realtime/socket-handlers.js): `src/realtime/socket-handlers.js`
- [Optional Tor ingress](https://github.com/portfoliobts/masages/blob/main/lib/tor-support.js): `lib/tor-support.js`

### Messaging services

- [Anonymous accounts](https://github.com/portfoliobts/masages/blob/main/src/services/accounts.js): `src/services/accounts.js`
- [Rooms and membership](https://github.com/portfoliobts/masages/blob/main/src/services/rooms.js): `src/services/rooms.js`
- [Message service](https://github.com/portfoliobts/masages/blob/main/src/services/messages.js): `src/services/messages.js`
- [Upload service](https://github.com/portfoliobts/masages/blob/main/src/services/uploads.js): `src/services/uploads.js`
- [Expiry service](https://github.com/portfoliobts/masages/blob/main/src/services/expiry.js): `src/services/expiry.js`

### Security and trust

- [Identity keys](https://github.com/portfoliobts/masages/blob/main/lib/key-store.js): `lib/key-store.js`
- [Key transparency](https://github.com/portfoliobts/masages/blob/main/lib/kt-service.js): `lib/kt-service.js`
- [Transparency log](https://github.com/portfoliobts/masages/blob/main/lib/kt-log.js): `lib/kt-log.js`
- [Client manifest](https://github.com/portfoliobts/masages/blob/main/lib/client-manifest.js): `lib/client-manifest.js`
- [Client verification](https://github.com/portfoliobts/masages/blob/main/public/lib/client-verify.js): `public/lib/client-verify.js`

### Persistence and jobs

- [PostgreSQL](https://github.com/portfoliobts/masages/blob/main/src/db/pool.js): `src/db/pool.js`
- [Session storage](https://github.com/portfoliobts/masages/blob/main/lib/session-store.js): `lib/session-store.js`
- [Background jobs](https://github.com/portfoliobts/masages/blob/main/src/jobs/index.js): `src/jobs/index.js`
- [Job scheduler](https://github.com/portfoliobts/masages/blob/main/lib/jobs/index.js): `lib/jobs/index.js`

### Other components

- **Messenger user**
- **Tor Browser user**

## Connections

- Messenger user → Messenger interface: uses
- Messenger interface → Client encryption: encrypts with
- Messenger interface → Room membership: manages rooms
- Messenger interface → File handling: handles files
- Messenger interface → Local search: searches locally
- Messenger interface → HTTP application: uses API
- Messenger interface → Socket handlers: connects by socket
- HTTP application → API routes: registers routes (evidence: `src/http/app.js`)
- HTTP application → Session storage: loads sessions (evidence: `src/http/app.js`)
- HTTP application → Client manifest: registers manifest route
- API routes → Anonymous accounts: routes account flow
- API routes → Rooms and membership: routes room actions
- API routes → Message service: routes messages
- API routes → Upload service: routes uploads
- Anonymous accounts → Rooms and membership: calls (evidence: `src/services/accounts.js`)
- Anonymous accounts → Message service: calls (evidence: `src/services/accounts.js`)
- Anonymous accounts → Identity keys: uses keys (evidence: `src/services/accounts.js`)
- Message service → PostgreSQL: writes and reads
- Client encryption → Transparency checks: checks log
- Transparency checks → Key transparency: requests proofs
- Key transparency → Transparency log: builds log indexes (evidence: `lib/kt-service.js`)
- Key transparency → Identity keys: reads keys (evidence: `lib/kt-service.js`)
- Key transparency → PostgreSQL: queries (evidence: `lib/kt-service.js`)
- Client manifest → Client verification: describes client files (evidence: `lib/client-manifest.js`)
- Client verification → Messenger interface: verifies assets
- Session storage → PostgreSQL: stores sessions
- Background jobs → Job scheduler: registers jobs (evidence: `src/jobs/index.js`)
- Job scheduler → Anonymous accounts: purges expired accounts
- Tor Browser user → Optional Tor ingress: connects through Tor
- Optional Tor ingress → HTTP application: forwards ingress (evidence: `lib/tor-support.js`)
