# shraddhaa09/netshare architecture

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

- Interactive diagram: https://gitdiagram.com/shraddhaa09/netshare
- Repository: https://github.com/shraddhaa09/netshare

## Overview

NetShare is a multiclient TCP file-management service. A user enters commands in the client; it parses ordinary commands or delegates PUT/GET transfers, then sends requests to the server. The server assigns each connection to a handler, which dispatches commands and file transfers and returns results. FileManager provides guarded storage operations and checksums. The README documents the full LIST/EXISTS/SIZE/INFO/RENAME/DELETE/HELP/STATUS capability set; sampled processor code confirms several of these, but its excerpt is incomplete. Edges reflect shown calls or README-described runtime behavior.

Main entry points: [`client/Client.java`](https://github.com/shraddhaa09/netshare/blob/main/client/Client.java) (Client App), [`server/ClientHandler.java`](https://github.com/shraddhaa09/netshare/blob/main/server/ClientHandler.java) (Client Handler), [`server/CommandProcessor.java`](https://github.com/shraddhaa09/netshare/blob/main/server/CommandProcessor.java) (Command Processor), [`server/Server.java`](https://github.com/shraddhaa09/netshare/blob/main/server/Server.java) (TCP Server)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_client["Client"]
  node_clientapp["Client App<br/>[Client.java]"]
  node_parser["Command Parser<br/>[CommandParser.java]"]
  node_transfer["File Transfer"]
end

subgraph group_server["Server"]
  node_server["TCP Server<br/>[Server.java]"]
  node_handler["Client Handler<br/>[ClientHandler.java]"]
  node_processor["Command Processor"]
  node_config["Server Config<br/>[ServerConfig.java]"]
end

subgraph group_shared["Shared Protocol"]
  node_command["Command Model<br/>[Command.java]"]
  node_response["Response Model<br/>[Response.java]"]
  node_protocol["Protocol Constants<br/>[Protocol.java]"]
end

subgraph group_storage["Storage"]
  node_files["File Manager<br/>[FileManager.java]"]
  node_store[("Server Storage")]
end

node_user(("User"))

node_user -->|"enters commands"| node_clientapp
node_clientapp -->|"parses input"| node_parser
node_parser -->|"creates"| node_command
node_clientapp -->|"reads fields"| node_command
node_clientapp -->|"delegates transfers"| node_transfer
node_clientapp -->|"connects via TCP"| node_server
node_transfer -->|"exchanges file data"| node_server
node_server -->|"assigns connections"| node_handler
node_handler -->|"dispatches commands"| node_processor
node_handler -->|"reads and writes transfers"| node_files
node_processor -->|"runs file operations"| node_files
node_processor -->|"returns results"| node_response
node_handler -->|"constructs"| node_command
node_handler -->|"sends results"| node_response
node_clientapp -->|"uses constants"| node_protocol
node_transfer -->|"uses transfer statuses"| node_protocol
node_handler -->|"uses wire constants"| node_protocol
node_processor -->|"uses operation codes"| node_protocol
node_server -->|"reads settings"| node_config
node_files -->|"reads storage settings"| node_config
node_files -->|"manages files"| node_store

click node_clientapp "https://github.com/shraddhaa09/netshare/blob/main/client/Client.java"
click node_parser "https://github.com/shraddhaa09/netshare/blob/main/client/CommandParser.java"
click node_transfer "https://github.com/shraddhaa09/netshare/blob/main/client/FileTransferManager.java"
click node_server "https://github.com/shraddhaa09/netshare/blob/main/server/Server.java"
click node_handler "https://github.com/shraddhaa09/netshare/blob/main/server/ClientHandler.java"
click node_processor "https://github.com/shraddhaa09/netshare/blob/main/server/CommandProcessor.java"
click node_config "https://github.com/shraddhaa09/netshare/blob/main/server/ServerConfig.java"
click node_command "https://github.com/shraddhaa09/netshare/blob/main/common/Command.java"
click node_response "https://github.com/shraddhaa09/netshare/blob/main/common/Response.java"
click node_protocol "https://github.com/shraddhaa09/netshare/blob/main/common/Protocol.java"
click node_files "https://github.com/shraddhaa09/netshare/blob/main/server/FileManager.java"

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_clientapp,node_parser,node_transfer,node_user toneBlue
class node_server,node_handler,node_processor,node_config toneAmber
class node_command,node_response,node_protocol toneMint
class node_files,node_store toneRose
```

## Components

### Client

- [Client App](https://github.com/shraddhaa09/netshare/blob/main/client/Client.java): `client/Client.java`
- [Command Parser](https://github.com/shraddhaa09/netshare/blob/main/client/CommandParser.java): `client/CommandParser.java`
- [File Transfer](https://github.com/shraddhaa09/netshare/blob/main/client/FileTransferManager.java): `client/FileTransferManager.java`

### Server

- [TCP Server](https://github.com/shraddhaa09/netshare/blob/main/server/Server.java): `server/Server.java`
- [Client Handler](https://github.com/shraddhaa09/netshare/blob/main/server/ClientHandler.java): `server/ClientHandler.java`
- [Command Processor](https://github.com/shraddhaa09/netshare/blob/main/server/CommandProcessor.java): `server/CommandProcessor.java`
- [Server Config](https://github.com/shraddhaa09/netshare/blob/main/server/ServerConfig.java): `server/ServerConfig.java`

### Shared Protocol

- [Command Model](https://github.com/shraddhaa09/netshare/blob/main/common/Command.java): `common/Command.java`
- [Response Model](https://github.com/shraddhaa09/netshare/blob/main/common/Response.java): `common/Response.java`
- [Protocol Constants](https://github.com/shraddhaa09/netshare/blob/main/common/Protocol.java): `common/Protocol.java`

### Storage

- [File Manager](https://github.com/shraddhaa09/netshare/blob/main/server/FileManager.java): `server/FileManager.java`
- **Server Storage**

### Other components

- **User**

## Connections

- User → Client App: enters commands (evidence: `README.md`)
- Client App → Command Parser: parses input (evidence: `client/Client.java`)
- Command Parser → Command Model: creates (evidence: `client/CommandParser.java`)
- Client App → Command Model: reads fields (evidence: `client/Client.java`)
- Client App → File Transfer: delegates transfers (evidence: `client/Client.java`)
- Client App → TCP Server: connects via TCP (evidence: `client/Client.java`)
- File Transfer → TCP Server: exchanges file data (evidence: `client/FileTransferManager.java`)
- TCP Server → Client Handler: assigns connections (evidence: `server/Server.java`)
- Client Handler → Command Processor: dispatches commands (evidence: `server/ClientHandler.java`)
- Client Handler → File Manager: reads and writes transfers (evidence: `server/ClientHandler.java`)
- Command Processor → File Manager: runs file operations (evidence: `server/CommandProcessor.java`)
- Command Processor → Response Model: returns results (evidence: `server/CommandProcessor.java`)
- Client Handler → Command Model: constructs (evidence: `server/ClientHandler.java`)
- Client Handler → Response Model: sends results (evidence: `server/ClientHandler.java`)
- Client App → Protocol Constants: uses constants (evidence: `client/Client.java`)
- File Transfer → Protocol Constants: uses transfer statuses (evidence: `client/FileTransferManager.java`)
- Client Handler → Protocol Constants: uses wire constants (evidence: `server/ClientHandler.java`)
- Command Processor → Protocol Constants: uses operation codes (evidence: `server/CommandProcessor.java`)
- TCP Server → Server Config: reads settings (evidence: `server/Server.java`)
- File Manager → Server Config: reads storage settings (evidence: `server/FileManager.java`)
- File Manager → Server Storage: manages files (evidence: `server/FileManager.java`)
