# domingues/vortex architecture

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

- Interactive diagram: https://gitdiagram.com/domingues/vortex
- Repository: https://github.com/domingues/vortex

## Overview

Key Components to Include:

##### Client Layer
- Sub-components:
- Key Management (RSA keys)
- Message Encryption/Decryption
- User Interface
- Transport Adapter

##### Transport Layer (show both options)
- PostgreSQL Transport
- PostgreSQL Database (with messages table)
- WebSocket Transport
- WebSocket Server (websocket-server.py)

##### File System Components
- Configuration Files:
- known_users (public keys storage)
- known_rooms (room definitions)
- id_rsa.pub (user's public key)
- id_rsa (user's private key)

##### Connection Types
- Double lines: Configuration/setup relationships

Specific Instructions:

##### Client Layer
- [Vortex Client]
- [Key Management]
- [E2EE Module]
- [UI Component]
- [Transport Adapter]

- [Transport Adapter]
- [PostgreSQL Connection] --> [PostgreSQL Database]
- [WebSocket Connection] --> [WebSocket Server]

##### File System Integration
- [Configuration Files]
- known_users
- known_rooms
- id_rsa.pub
- id_rsa

##### Data Flow
- Client → Encryption → Transport → Storage
- Storage → Transport → Decryption → Client

Important Elements to Highlight:

##### Transport Agnosticism
- How the client can switch between PostgreSQL and WebSocket
- Use a switch/multiplexer symbol between transport options

##### Security Components
- E2EE encryption/decryption points
- Management flow
- Where public/private keys are used

##### Room Management
- How room configurations are loaded and managed
- Multi-user message distribution

Additional Notes:

- Key exchange process
- Message sending flow
- Message receiving flow

Remember to indicate that this is a proof of concept and include a note about the unaudited status of the security implementation.

## Diagram (Mermaid)

```mermaid
graph TB
    %% Client Layer
    subgraph ClientLayer["Client Layer"]
        Client["Vortex Client"]
        KeyMgmt["Key Management"]:::security
        E2EE["E2EE Module"]:::security
        UI["User Interface"]
        TransportAdapter["Transport Adapter"]
    end

    %% Transport Layer
    subgraph TransportLayer["Transport Layer"]
        direction TB
        subgraph PostgresTransport["PostgreSQL Transport"]
            PGConn["PostgreSQL Connection"]
            PGDb[(PostgreSQL Database)]
        end
        
        subgraph WSTransport["WebSocket Transport"]
            WSConn["WebSocket Connection"]
            WSServer["WebSocket Server"]
        end
    end

    %% Storage Layer
    subgraph StorageLayer["File System Storage"]
        Config["Configuration Files"]
        KnownUsers["known_users"]:::security
        KnownRooms["known_rooms"]
        PubKey["id_rsa.pub"]:::security
        PrivKey["id_rsa"]:::security
    end

    %% Relationships
    Client --> KeyMgmt
    Client --> E2EE
    Client --> UI
    Client --> TransportAdapter
    
    TransportAdapter --> PGConn
    TransportAdapter --> WSConn
    PGConn --> PGDb
    WSConn --> WSServer
    
    KeyMgmt --> KnownUsers
    KeyMgmt --> PubKey
    KeyMgmt --> PrivKey
    Client --> KnownRooms
    
    %% Data Flow
    E2EE -. "Encrypted Data" .-> TransportAdapter
    TransportAdapter -. "Encrypted Data" .-> E2EE

    %% Styling
    classDef default fill:#f9f9f9,stroke:#333,stroke-width:2px
    classDef security fill:#ff9999,stroke:#333,stroke-width:2px
    classDef transport fill:#99ff99,stroke:#333,stroke-width:2px
    classDef storage fill:#ffff99,stroke:#333,stroke-width:2px

    %% Click Events
    click Client "https://github.com/domingues/vortex/blob/master/vortex.py"
    click WSServer "https://github.com/domingues/vortex/blob/master/websocket-server.py"
    click PGDb "https://github.com/domingues/vortex/blob/master/postgres-setup.sql"

    %% Legend
    subgraph Legend
        L1["Client Components"]
        L2["Security Components"]:::security
        L3["Transport Components"]:::transport
        L4["Storage Components"]:::storage
    end
```
