# iain-crowe/lanchat architecture

> Architecture diagram of the GitHub repository iain-crowe/lanchat, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2025-01-24). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/iain-crowe/lanchat
- Repository: https://github.com/iain-crowe/lanchat

## Overview

##### Main Components

A. Client Component:
- Client.py module
- CLI interface (current) with a note about future GUI
- Connection handling to server
- Logging functionality integration

B. Server Component:
- Server.py module
- Connection management
- Client message broadcasting capability
- Logging functionality integration

C. Shared Components:
- Logger module (logger.py)
- Network protocol layer
- Environment configuration

**[Client Layer]**

- CLI Interface
- (Future GUI noted)

- Client Network Handler
- Socket Connection

**[Network Layer]**

**[Server Layer]**

- Connection Manager
- Client Sessions

- Message Broadcaster

##### Important Details to Highlight

A. Network Protocol:
- TCP/IP connection
- Port 8080 usage
- IP configuration (0.0.0.0)

B. Data Flow:
- Client message sending
- Server broadcast mechanism
- Logging flow

C. Configuration:
- Environment variables
- Server settings

##### Technical Details

- Socket communication layer
- Real-time messaging paths
- Error handling flow
- Configuration loading process

## Diagram (Mermaid)

```mermaid
graph TB
    subgraph Client
        CLI[CLI Interface]
        ClientHandler[Client Network Handler]
        ClientLogger[Client Logger]
        ClientConfig[Client Config]
        
        CLI --> ClientHandler
        ClientHandler --> ClientLogger
        ClientConfig --> ClientHandler
    end

    subgraph Network
        Protocol[TCP/IP Protocol]
        Port["Port: 8080"]
        IP["IP: 0.0.0.0"]
        
        Protocol --> Port
        Protocol --> IP
    end

    subgraph Server
        ConnManager[Connection Manager]
        Broadcaster[Message Broadcaster]
        ServerLogger[Server Logger]
        ServerConfig[Server Config]
        
        ConnManager --> Broadcaster
        ConnManager --> ServerLogger
        ServerConfig --> ConnManager
    end

    ClientHandler <--> Protocol
    Protocol <--> ConnManager

    %% Component Mappings
    click ClientHandler "https://github.com/Iain-Crowe/LANChat/blob/main/src/client.py"
    click ConnManager "https://github.com/Iain-Crowe/LANChat/blob/main/src/server.py"
    click ClientLogger "https://github.com/Iain-Crowe/LANChat/blob/main/src/logger.py"
    click ServerLogger "https://github.com/Iain-Crowe/LANChat/blob/main/src/logger.py"
    click ClientConfig "https://github.com/Iain-Crowe/LANChat/blob/main/requirements.txt"
    click ServerConfig "https://github.com/Iain-Crowe/LANChat/blob/main/requirements.txt"

    %% Styling
    classDef client fill:#a8d1ff,stroke:#333,stroke-width:2px
    classDef server fill:#90EE90,stroke:#333,stroke-width:2px
    classDef network fill:#d3d3d3,stroke:#333,stroke-width:2px
    classDef logger fill:#ffeb99,stroke:#333,stroke-width:2px
    classDef config fill:#DDA0DD,stroke:#333,stroke-width:2px

    class CLI,ClientHandler client
    class ConnManager,Broadcaster server
    class Protocol,Port,IP network
    class ClientLogger,ServerLogger logger
    class ClientConfig,ServerConfig config

    %% Legend
    subgraph Legend
        Client_L[Client Components]:::client
        Server_L[Server Components]:::server
        Network_L[Network Layer]:::network
        Logger_L[Logging System]:::logger
        Config_L[Configuration]:::config
    end

    %% Notes
    note["Python 3.9+ Required<br/>Future GUI Planned"]
    style note fill:#fff,stroke:#333,stroke-width:1px
```
