# kausher76/nervesolutionassignement architecture

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

- Interactive diagram: https://gitdiagram.com/kausher76/nervesolutionassignement
- Repository: https://github.com/kausher76/nervesolutionassignement

## Overview

This is a small encrypted TCP request/response application. The user configures and enters requests in the client; it encrypts each request, connects to the server, and displays decrypted replies. The server loads a JSON collection, handles clients concurrently, looks up each Set/key pair, and returns either encrypted timestamps or EMPTY. Shared prompt and AES-GCM code support both applications. The main flows are shown; client/server transport is documented in the README, while the handler and storage behavior are visible in the server source.

Main entry points: [`TCPClient/Program.cs`](https://github.com/kausher76/nervesolutionassignement/blob/main/TCPClient/Program.cs) (Client), [`TCPServer/Program.cs`](https://github.com/kausher76/nervesolutionassignement/blob/main/TCPServer/Program.cs) (Listener), [`Shared/Crypto.cs`](https://github.com/kausher76/nervesolutionassignement/blob/main/Shared/Crypto.cs) (AES-GCM crypto), [`TCPServer/data.json`](https://github.com/kausher76/nervesolutionassignement/blob/main/TCPServer/data.json) (Set collection)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_client["TCP client"]
  node_client_app["Client<br/>[Program.cs]"]
end

subgraph group_server["TCP server"]
  node_server_listener["Listener<br/>[Program.cs]"]
  node_request_handler["Request handler<br/>[Program.cs]"]
  node_collection[("Set collection<br/>[data.json]")]
end

subgraph group_shared["Shared utilities"]
  node_prompt["Console prompts<br/>[Prompt.cs]"]
  node_crypto["AES-GCM crypto<br/>[Crypto.cs]"]
end

node_user(("User"))

node_user -->|"enters requests"| node_client_app
node_client_app -->|"gets settings"| node_prompt
node_client_app -->|"encrypts requests"| node_crypto
node_client_app -->|"sends encrypted request"| node_server_listener
node_server_listener -->|"dispatches clients"| node_request_handler
node_server_listener -->|"gets settings"| node_prompt
node_server_listener -->|"derives key"| node_crypto
node_server_listener -->|"loads JSON"| node_collection
node_request_handler -->|"decrypts and encrypts"| node_crypto
node_request_handler -->|"looks up keys"| node_collection
node_request_handler -->|"returns encrypted replies"| node_client_app
node_client_app -->|"displays replies"| node_user

click node_client_app "https://github.com/kausher76/nervesolutionassignement/blob/main/TCPClient/Program.cs"
click node_server_listener "https://github.com/kausher76/nervesolutionassignement/blob/main/TCPServer/Program.cs"
click node_request_handler "https://github.com/kausher76/nervesolutionassignement/blob/main/TCPServer/Program.cs"
click node_collection "https://github.com/kausher76/nervesolutionassignement/blob/main/TCPServer/data.json"
click node_prompt "https://github.com/kausher76/nervesolutionassignement/blob/main/Shared/Prompt.cs"
click node_crypto "https://github.com/kausher76/nervesolutionassignement/blob/main/Shared/Crypto.cs"

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_client_app,node_user toneBlue
class node_server_listener,node_request_handler,node_collection toneAmber
class node_prompt,node_crypto toneMint
```

## Components

### TCP client

- [Client](https://github.com/kausher76/nervesolutionassignement/blob/main/TCPClient/Program.cs): `TCPClient/Program.cs`

### TCP server

- [Listener](https://github.com/kausher76/nervesolutionassignement/blob/main/TCPServer/Program.cs): `TCPServer/Program.cs`
- [Request handler](https://github.com/kausher76/nervesolutionassignement/blob/main/TCPServer/Program.cs): `TCPServer/Program.cs`
- [Set collection](https://github.com/kausher76/nervesolutionassignement/blob/main/TCPServer/data.json): `TCPServer/data.json`

### Shared utilities

- [Console prompts](https://github.com/kausher76/nervesolutionassignement/blob/main/Shared/Prompt.cs): `Shared/Prompt.cs`
- [AES-GCM crypto](https://github.com/kausher76/nervesolutionassignement/blob/main/Shared/Crypto.cs): `Shared/Crypto.cs`

### Other components

- **User**

## Connections

- User → Client: enters requests (evidence: `README.md`)
- Client → Console prompts: gets settings (evidence: `TCPClient/Program.cs`)
- Client → AES-GCM crypto: encrypts requests (evidence: `TCPClient/Program.cs`)
- Client → Listener: sends encrypted request (evidence: `README.md`)
- Listener → Request handler: dispatches clients (evidence: `TCPServer/Program.cs`)
- Listener → Console prompts: gets settings (evidence: `TCPServer/Program.cs`)
- Listener → AES-GCM crypto: derives key (evidence: `TCPServer/Program.cs`)
- Listener → Set collection: loads JSON (evidence: `TCPServer/Program.cs`)
- Request handler → AES-GCM crypto: decrypts and encrypts (evidence: `TCPServer/Program.cs`)
- Request handler → Set collection: looks up keys (evidence: `TCPServer/Program.cs`)
- Request handler → Client: returns encrypted replies (evidence: `README.md`)
- Client → User: displays replies (evidence: `TCPClient/Program.cs`)
