# ty-dwyer/network_traffic architecture

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

- Interactive diagram: https://gitdiagram.com/ty-dwyer/network_traffic
- Repository: https://github.com/ty-dwyer/network_traffic

## Overview

This is a Spring Boot backend for network-traffic monitoring. The main workflow accepts a PCAP through the API, parses packet headers, then tracks devices, detects documented anomalies, persists results, and publishes live updates. Authentication is a separate user workflow: clients register or log in and use JWTs for protected endpoints. The README documents these component relationships; source excerpts were not provided, so the graph does not infer finer-grained calls or repository mappings.

Main entry points: [`src/main/java/com/example/networktraffic/services/PacketIngestionService.java`](https://github.com/ty-dwyer/network_traffic/blob/main/src/main/java/com/example/networktraffic/services/PacketIngestionService.java) (Ingestion service), [`src/main/java/com/example/networktraffic/configs/SecurityConfig.java`](https://github.com/ty-dwyer/network_traffic/blob/main/src/main/java/com/example/networktraffic/configs/SecurityConfig.java) (JWT security), [`src/main/java/com/example/networktraffic/controllers/AuthController.java`](https://github.com/ty-dwyer/network_traffic/blob/main/src/main/java/com/example/networktraffic/controllers/AuthController.java) (Authentication), [`src/main/java/com/example/networktraffic/configs/JwtAuthFilter.java`](https://github.com/ty-dwyer/network_traffic/blob/main/src/main/java/com/example/networktraffic/configs/JwtAuthFilter.java) (JWT filter)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_api["API and access"]
  node_api["REST API"]
  node_auth["Authentication"]
  node_authservice["Auth service<br/>[AuthService.java]"]
  node_security["JWT security"]
  node_jwtfilter["JWT filter<br/>[JwtAuthFilter.java]"]
  node_jwtutil["JWT utilities<br/>[JwtUtil.java]"]
end

subgraph group_ingestion["Packet ingestion"]
  node_ingestapi["Ingest endpoints"]
  node_parser["PCAP parser<br/>[PcapParser.java]"]
  node_ingestionservice["Ingestion service"]
  node_device["Device tracking<br/>[Device.java]"]
  node_anomaly["Anomaly alerts<br/>[Alert.java]"]
end

subgraph group_data["Persistence"]
  node_packet["Packet records<br/>[Packet.java]"]
  node_repositories["JPA repositories"]
  node_database[("PostgreSQL")]
end

subgraph group_realtime["Live updates"]
  node_wsconfig["WebSocket setup"]
  node_ws["STOMP WebSocket"]
end

node_client(("Dashboard client"))

node_client -->|"registers or logs in"| node_auth
node_client -->|"uploads PCAP"| node_ingestapi
node_client -->|"requests data"| node_api
node_auth -->|"handles auth"| node_authservice
node_security -->|"configures filter"| node_jwtfilter
node_jwtfilter -.->|"validates tokens"| node_jwtutil
node_security -->|"protects endpoints"| node_api
node_ingestapi -->|"starts ingestion"| node_ingestionservice
node_ingestionservice -->|"parses capture"| node_parser
node_ingestionservice -->|"tracks devices"| node_device
node_ingestionservice -->|"creates alerts"| node_anomaly
node_ingestionservice -->|"persists results"| node_repositories
node_repositories -->|"stores via JPA"| node_database
node_ingestionservice -->|"broadcasts updates"| node_ws
node_wsconfig -->|"configures endpoint"| node_ws
node_ws -->|"pushes live updates"| node_client

click node_api "https://github.com/ty-dwyer/network_traffic/tree/main/src/main/java/com/example/networktraffic/controllers"
click node_auth "https://github.com/ty-dwyer/network_traffic/blob/main/src/main/java/com/example/networktraffic/controllers/AuthController.java"
click node_authservice "https://github.com/ty-dwyer/network_traffic/blob/main/src/main/java/com/example/networktraffic/services/AuthService.java"
click node_security "https://github.com/ty-dwyer/network_traffic/blob/main/src/main/java/com/example/networktraffic/configs/SecurityConfig.java"
click node_jwtfilter "https://github.com/ty-dwyer/network_traffic/blob/main/src/main/java/com/example/networktraffic/configs/JwtAuthFilter.java"
click node_jwtutil "https://github.com/ty-dwyer/network_traffic/blob/main/src/main/java/com/example/networktraffic/util/JwtUtil.java"
click node_ingestapi "https://github.com/ty-dwyer/network_traffic/blob/main/src/main/java/com/example/networktraffic/controllers/PacketController.java"
click node_parser "https://github.com/ty-dwyer/network_traffic/blob/main/src/main/java/com/example/networktraffic/parser/PcapParser.java"
click node_ingestionservice "https://github.com/ty-dwyer/network_traffic/blob/main/src/main/java/com/example/networktraffic/services/PacketIngestionService.java"
click node_device "https://github.com/ty-dwyer/network_traffic/blob/main/src/main/java/com/example/networktraffic/entities/Device.java"
click node_anomaly "https://github.com/ty-dwyer/network_traffic/blob/main/src/main/java/com/example/networktraffic/entities/Alert.java"
click node_packet "https://github.com/ty-dwyer/network_traffic/blob/main/src/main/java/com/example/networktraffic/entities/Packet.java"
click node_repositories "https://github.com/ty-dwyer/network_traffic/tree/main/src/main/java/com/example/networktraffic/repositories"
click node_wsconfig "https://github.com/ty-dwyer/network_traffic/blob/main/src/main/java/com/example/networktraffic/configs/WebSocketConfig.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_api,node_auth,node_authservice,node_security,node_jwtfilter,node_jwtutil,node_client toneBlue
class node_ingestapi,node_parser,node_ingestionservice,node_device,node_anomaly toneAmber
class node_packet,node_repositories,node_database toneMint
class node_wsconfig,node_ws toneRose
```

## Components

### API and access

- [REST API](https://github.com/ty-dwyer/network_traffic/tree/main/src/main/java/com/example/networktraffic/controllers): `src/main/java/com/example/networktraffic/controllers`
- [Authentication](https://github.com/ty-dwyer/network_traffic/blob/main/src/main/java/com/example/networktraffic/controllers/AuthController.java): `src/main/java/com/example/networktraffic/controllers/AuthController.java`
- [Auth service](https://github.com/ty-dwyer/network_traffic/blob/main/src/main/java/com/example/networktraffic/services/AuthService.java): `src/main/java/com/example/networktraffic/services/AuthService.java`
- [JWT security](https://github.com/ty-dwyer/network_traffic/blob/main/src/main/java/com/example/networktraffic/configs/SecurityConfig.java): `src/main/java/com/example/networktraffic/configs/SecurityConfig.java`
- [JWT filter](https://github.com/ty-dwyer/network_traffic/blob/main/src/main/java/com/example/networktraffic/configs/JwtAuthFilter.java): `src/main/java/com/example/networktraffic/configs/JwtAuthFilter.java`
- [JWT utilities](https://github.com/ty-dwyer/network_traffic/blob/main/src/main/java/com/example/networktraffic/util/JwtUtil.java): `src/main/java/com/example/networktraffic/util/JwtUtil.java`

### Packet ingestion

- [Ingest endpoints](https://github.com/ty-dwyer/network_traffic/blob/main/src/main/java/com/example/networktraffic/controllers/PacketController.java): `src/main/java/com/example/networktraffic/controllers/PacketController.java`
- [PCAP parser](https://github.com/ty-dwyer/network_traffic/blob/main/src/main/java/com/example/networktraffic/parser/PcapParser.java): `src/main/java/com/example/networktraffic/parser/PcapParser.java`
- [Ingestion service](https://github.com/ty-dwyer/network_traffic/blob/main/src/main/java/com/example/networktraffic/services/PacketIngestionService.java): `src/main/java/com/example/networktraffic/services/PacketIngestionService.java`
- [Device tracking](https://github.com/ty-dwyer/network_traffic/blob/main/src/main/java/com/example/networktraffic/entities/Device.java): `src/main/java/com/example/networktraffic/entities/Device.java`
- [Anomaly alerts](https://github.com/ty-dwyer/network_traffic/blob/main/src/main/java/com/example/networktraffic/entities/Alert.java): `src/main/java/com/example/networktraffic/entities/Alert.java`

### Persistence

- [Packet records](https://github.com/ty-dwyer/network_traffic/blob/main/src/main/java/com/example/networktraffic/entities/Packet.java): `src/main/java/com/example/networktraffic/entities/Packet.java`
- [JPA repositories](https://github.com/ty-dwyer/network_traffic/tree/main/src/main/java/com/example/networktraffic/repositories): `src/main/java/com/example/networktraffic/repositories`
- **PostgreSQL**

### Live updates

- [WebSocket setup](https://github.com/ty-dwyer/network_traffic/blob/main/src/main/java/com/example/networktraffic/configs/WebSocketConfig.java): `src/main/java/com/example/networktraffic/configs/WebSocketConfig.java`
- **STOMP WebSocket**

### Other components

- **Dashboard client**

## Connections

- Dashboard client → Authentication: registers or logs in (evidence: `README.md`)
- Dashboard client → Ingest endpoints: uploads PCAP (evidence: `README.md`)
- Dashboard client → REST API: requests data (evidence: `README.md`)
- Authentication → Auth service: handles auth (evidence: `README.md`)
- JWT security → JWT filter: configures filter (evidence: `README.md`)
- JWT filter → JWT utilities: validates tokens
- JWT security → REST API: protects endpoints (evidence: `README.md`)
- Ingest endpoints → Ingestion service: starts ingestion (evidence: `README.md`)
- Ingestion service → PCAP parser: parses capture (evidence: `README.md`)
- Ingestion service → Device tracking: tracks devices (evidence: `README.md`)
- Ingestion service → Anomaly alerts: creates alerts (evidence: `README.md`)
- Ingestion service → JPA repositories: persists results (evidence: `README.md`)
- JPA repositories → PostgreSQL: stores via JPA (evidence: `README.md`)
- Ingestion service → STOMP WebSocket: broadcasts updates (evidence: `README.md`)
- WebSocket setup → STOMP WebSocket: configures endpoint (evidence: `README.md`)
- STOMP WebSocket → Dashboard client: pushes live updates (evidence: `README.md`)
