# tum-i4/kovacs architecture

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

- Interactive diagram: https://gitdiagram.com/tum-i4/kovacs
- Repository: https://github.com/tum-i4/kovacs

## Overview

##### Main System Components

a) Network Layer:
- Bootnode (entry point for network discovery)
- Node instances (distributed nodes in the network)
- MDNS for peer discovery (visible in node/p2p/mdns.go)

b) Core Services:
- Revolori Service (external identity management system)
- Ethereum Network (indicated by geth directory and blockchain storage)
- Nginx Proxy (for network access management)

c) Functional Components:
- Listener Service
- Requester Service
- Verifier Service
- User Management System
- Storage System (both Blockchain and SQLite)

##### Component Relationships

a) Data Flow:
- User Management → Revolori (authentication flow)
- Nodes ↔ Bootnode (network discovery)
- Nodes ↔ Nodes (P2P communication)
- Nodes → Storage (both blockchain and SQLite)
- Requester → Nodes (data requests)
- Listener → Storage (data persistence)

b) Security Layer:
- Encryption flows (based on node/encryption)
- Non-repudiation system (from node/nonRepudiation)
- Password management (from node/password)

##### Architectural Patterns to Highlight

- P2P Network Components (hexagons)
- Security Services (shields)
- External Services (clouds)
- Internal Services (rectangles)

##### Technical Details

Annotations for:
- Docker containerization
- Ethereum smart contract integration
- Authentication mechanisms
- Encryption standards (AES-GCM)
- Non-repudiation protocols

##### Service Layer (middle)
- Node Network
- Security Services
- Management Services
##### Storage Layer (bottom)
- Blockchain
- SQLite
##### External Services (side)
- Revolori
- Bootnode

##### Critical Aspects to Emphasize

- Security mechanisms (encryption, non-repudiation)
- Distributed nature of the system
- Data flow paths
- Storage redundancy
- Error handling paths
- Authentication flows

## Diagram (Mermaid)

```mermaid
flowchart TB
    subgraph "Network Layer"
        BN[Bootnode]
        MDNS[MDNS Discovery]
        NN[Node Network]
    end

    subgraph "External Services"
        REV[Revolori Service]
        ETH[Ethereum Network]
        NGX[Nginx Proxy]
    end

    subgraph "Core Services"
        LS[Listener Service]
        RS[Requester Service]
        VS[Verifier Service]
        UMS[User Management]
    end

    subgraph "Security Layer"
        ENC[Encryption System]
        NR[Non-repudiation System]
        PWD[Password Management]
        IDM[Identity Management]
    end

    subgraph "Communication Layer"
        P2P[P2P Communication]
        FMH[First Message Handler]
        ACK[Acknowledgement System]
        SH[Stream Handler]
    end

    subgraph "Storage Layer"
        BC[Blockchain Storage]
        SQL[SQLite Storage]
        QI[Query Interface]
    end

    subgraph "Utility Layer"
        LOG[Logging System]
        RNG[Random Generator]
        CONST[Constants]
    end

    %% Relationships
    BN --> NN
    MDNS --> NN
    NN --> P2P
    P2P --> FMH & ACK
    LS --> SH
    UMS --> REV
    RS --> NN
    VS --> BC
    P2P --> BC & SQL
    ENC --> P2P
    NR --> P2P
    PWD --> UMS
    IDM --> REV
    QI --> BC & SQL

    %% Click Events
    click BN "https://github.com/tum-i4/kovacs/tree/master/config/bootnode"
    click MDNS "https://github.com/tum-i4/kovacs/blob/master/node/p2p/mdns.go"
    click NN "https://github.com/tum-i4/kovacs/tree/master/node/p2p"
    click REV "https://github.com/tum-i4/kovacs/tree/master/node/revolori"
    click ETH "https://github.com/tum-i4/kovacs/tree/master/geth"
    click NGX "https://github.com/tum-i4/kovacs/tree/master/config/nginx_bootnode_config"
    click LS "https://github.com/tum-i4/kovacs/tree/master/listener"
    click RS "https://github.com/tum-i4/kovacs/tree/master/requester"
    click VS "https://github.com/tum-i4/kovacs/tree/master/verifier"
    click UMS "https://github.com/tum-i4/kovacs/tree/master/user-management"
    click ENC "https://github.com/tum-i4/kovacs/tree/master/node/encryption"
    click NR "https://github.com/tum-i4/kovacs/tree/master/node/nonRepudiation"
    click PWD "https://github.com/tum-i4/kovacs/tree/master/node/password"
    click IDM "https://github.com/tum-i4/kovacs/tree/master/node/revolori"
    click P2P "https://github.com/tum-i4/kovacs/tree/master/node/p2p"
    click FMH "https://github.com/tum-i4/kovacs/blob/master/node/p2p/firstMessage.go"
    click ACK "https://github.com/tum-i4/kovacs/blob/master/node/p2p/acknowledgement.go"
    click SH "https://github.com/tum-i4/kovacs/blob/master/listener/streamHandler.go"
    click BC "https://github.com/tum-i4/kovacs/blob/master/node/storage/exportToBlockchain.go"
    click SQL "https://github.com/tum-i4/kovacs/blob/master/node/storage/exportToSQLite.go"
    click QI "https://github.com/tum-i4/kovacs/tree/master/query"
    click LOG "https://github.com/tum-i4/kovacs/tree/master/node/logging"
    click RNG "https://github.com/tum-i4/kovacs/tree/master/node/random"
    click CONST "https://github.com/tum-i4/kovacs/tree/master/node/constants"

    %% Styling
    classDef network fill:#f9f,stroke:#333,stroke-width:2px
    classDef external fill:#bbf,stroke:#333,stroke-width:2px
    classDef core fill:#bfb,stroke:#333,stroke-width:2px
    classDef security fill:#fbb,stroke:#333,stroke-width:2px
    classDef communication fill:#ffb,stroke:#333,stroke-width:2px
    classDef storage fill:#bff,stroke:#333,stroke-width:2px
    classDef utility fill:#ddd,stroke:#333,stroke-width:2px

    class BN,MDNS,NN network
    class REV,ETH,NGX external
    class LS,RS,VS,UMS core
    class ENC,NR,PWD,IDM security
    class P2P,FMH,ACK,SH communication
    class BC,SQL,QI storage
    class LOG,RNG,CONST utility
```
