# joselyn-uide/chat-empresarial-pi architecture

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

- Interactive diagram: https://gitdiagram.com/joselyn-uide/chat-empresarial-pi
- Repository: https://github.com/joselyn-uide/chat-empresarial-pi

## Overview

This repository is a corporate, text-only TCP chat system, with a Go client/server, a documented FastAPI authentication service, and a Packet Tracer network design. The main workflow is console input and validation, client connection and message handling, server-side broadcast to other connected users, and session history viewing or JSON export. The sampled Go code supports the client, server, validation, and history relationships shown. Authentication and network details are documented capabilities, but their implementation or integration wiring was not sampled, so those links are marked unverified.

Main entry points: [`app-go/internal/handlers/cliente.go`](https://github.com/joselyn-uide/chat-empresarial-pi/blob/main/app-go/internal/handlers/cliente.go) (TCP client handler), [`app-go/cmd/client/main.go`](https://github.com/joselyn-uide/chat-empresarial-pi/blob/main/app-go/cmd/client/main.go) (Console client), [`app-go/cmd/server/main.go`](https://github.com/joselyn-uide/chat-empresarial-pi/blob/main/app-go/cmd/server/main.go) (TCP chat server), [`app-go/internal/storage/historial.go`](https://github.com/joselyn-uide/chat-empresarial-pi/blob/main/app-go/internal/storage/historial.go) (Session history)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_chat["Chat runtime"]
  node_client_handler["TCP client handler<br/>[cliente.go]"]
  node_message["Message model<br/>[message.go]"]
  node_server["TCP chat server<br/>[main.go]"]
end

subgraph group_client["Client workflow"]
  node_console["Console client<br/>[main.go]"]
  node_validation["Input validation<br/>[validaciones.go]"]
  node_user["User model<br/>[user.go]"]
end

subgraph group_history["Session history"]
  node_history_store[("Session history<br/>[historial.go]")]
  node_history_json["JSON export<br/>[historial.go]"]
end

subgraph group_security["Authentication"]
  node_auth_service["FastAPI authentication"]
end

subgraph group_network["Network infrastructure"]
  node_segmented_network["Segmented network design"]
  node_network_docs["Network addressing<br/>[README.md]"]
end

node_employee(("Employee"))
node_other_users(("Other chat users"))

node_employee -->|"uses menu"| node_console
node_console -->|"validates inputs"| node_validation
node_console -->|"creates user"| node_user
node_console -->|"creates history"| node_history_store
node_console -->|"creates client"| node_client_handler
node_client_handler -->|"validates messages"| node_validation
node_client_handler -->|"constructs messages"| node_message
node_client_handler -->|"records messages"| node_history_store
node_console -->|"views history"| node_history_store
node_console -->|"requests export"| node_history_json
node_history_json -->|"serializes history"| node_history_store
node_employee -->|"sends text"| node_client_handler
node_client_handler -->|"TCP messages"| node_server
node_server -->|"broadcasts messages"| node_other_users
node_other_users -->|"sends text"| node_server
node_server -->|"replies over TCP"| node_client_handler
node_client_handler -.->|"authentication integration"| node_auth_service
node_segmented_network -.->|"documents addressing"| node_network_docs

click node_console "https://github.com/joselyn-uide/chat-empresarial-pi/blob/main/app-go/cmd/client/main.go"
click node_validation "https://github.com/joselyn-uide/chat-empresarial-pi/blob/main/app-go/internal/services/validaciones.go"
click node_user "https://github.com/joselyn-uide/chat-empresarial-pi/blob/main/app-go/internal/models/user.go"
click node_client_handler "https://github.com/joselyn-uide/chat-empresarial-pi/blob/main/app-go/internal/handlers/cliente.go"
click node_message "https://github.com/joselyn-uide/chat-empresarial-pi/blob/main/app-go/internal/models/message.go"
click node_server "https://github.com/joselyn-uide/chat-empresarial-pi/blob/main/app-go/cmd/server/main.go"
click node_history_store "https://github.com/joselyn-uide/chat-empresarial-pi/blob/main/app-go/internal/storage/historial.go"
click node_history_json "https://github.com/joselyn-uide/chat-empresarial-pi/blob/main/app-go/internal/storage/historial.go"
click node_auth_service "https://github.com/joselyn-uide/chat-empresarial-pi/tree/main/auth-service/app"
click node_segmented_network "https://github.com/joselyn-uide/chat-empresarial-pi/blob/main/network/F2_chat_empresarial_PI%20-%20copia.pkt"
click node_network_docs "https://github.com/joselyn-uide/chat-empresarial-pi/blob/main/network/addressing/README.md"

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_handler,node_message,node_server,node_other_users toneBlue
class node_console,node_validation,node_user toneAmber
class node_history_store,node_history_json toneMint
class node_auth_service toneRose
class node_segmented_network,node_network_docs,node_employee toneIndigo
```

## Components

### Chat runtime

- [TCP client handler](https://github.com/joselyn-uide/chat-empresarial-pi/blob/main/app-go/internal/handlers/cliente.go): `app-go/internal/handlers/cliente.go`
- [Message model](https://github.com/joselyn-uide/chat-empresarial-pi/blob/main/app-go/internal/models/message.go): `app-go/internal/models/message.go`
- [TCP chat server](https://github.com/joselyn-uide/chat-empresarial-pi/blob/main/app-go/cmd/server/main.go): `app-go/cmd/server/main.go`

### Client workflow

- [Console client](https://github.com/joselyn-uide/chat-empresarial-pi/blob/main/app-go/cmd/client/main.go): `app-go/cmd/client/main.go`
- [Input validation](https://github.com/joselyn-uide/chat-empresarial-pi/blob/main/app-go/internal/services/validaciones.go): `app-go/internal/services/validaciones.go`
- [User model](https://github.com/joselyn-uide/chat-empresarial-pi/blob/main/app-go/internal/models/user.go): `app-go/internal/models/user.go`

### Session history

- [Session history](https://github.com/joselyn-uide/chat-empresarial-pi/blob/main/app-go/internal/storage/historial.go): `app-go/internal/storage/historial.go`
- [JSON export](https://github.com/joselyn-uide/chat-empresarial-pi/blob/main/app-go/internal/storage/historial.go): `app-go/internal/storage/historial.go`

### Authentication

- [FastAPI authentication](https://github.com/joselyn-uide/chat-empresarial-pi/tree/main/auth-service/app): `auth-service/app`

### Network infrastructure

- [Segmented network design](https://github.com/joselyn-uide/chat-empresarial-pi/blob/main/network/F2_chat_empresarial_PI%20-%20copia.pkt): `network/F2_chat_empresarial_PI - copia.pkt`
- [Network addressing](https://github.com/joselyn-uide/chat-empresarial-pi/blob/main/network/addressing/README.md): `network/addressing/README.md`

### Other components

- **Employee**
- **Other chat users**

## Connections

- Employee → Console client: uses menu (evidence: `app-go/cmd/client/main.go`)
- Console client → Input validation: validates inputs (evidence: `app-go/cmd/client/main.go`)
- Console client → User model: creates user (evidence: `app-go/cmd/client/main.go`)
- Console client → Session history: creates history (evidence: `app-go/cmd/client/main.go`)
- Console client → TCP client handler: creates client (evidence: `app-go/cmd/client/main.go`)
- TCP client handler → Input validation: validates messages (evidence: `app-go/internal/handlers/cliente.go`)
- TCP client handler → Message model: constructs messages (evidence: `app-go/internal/handlers/cliente.go`)
- TCP client handler → Session history: records messages (evidence: `app-go/internal/handlers/cliente.go`)
- Console client → Session history: views history (evidence: `app-go/cmd/client/main.go`)
- Console client → JSON export: requests export (evidence: `app-go/cmd/client/main.go`)
- JSON export → Session history: serializes history (evidence: `app-go/internal/storage/historial.go`)
- Employee → TCP client handler: sends text
- TCP client handler → TCP chat server: TCP messages (evidence: `README.md`)
- TCP chat server → Other chat users: broadcasts messages (evidence: `app-go/cmd/server/main.go`)
- Other chat users → TCP chat server: sends text (evidence: `README.md`)
- TCP chat server → TCP client handler: replies over TCP (evidence: `README.md`)
- TCP client handler → FastAPI authentication: authentication integration
- Segmented network design → Network addressing: documents addressing
