# nicegraham/selenium-grid2-api architecture

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

- Interactive diagram: https://gitdiagram.com/nicegraham/selenium-grid2-api
- Repository: https://github.com/nicegraham/selenium-grid2-api

## Overview

This small Selenium Grid 2 extension starts a hub with two custom JSON servlet endpoints, and provides a client utility that queries the hub’s test-session endpoint and parses the response into GridInfo. The README also describes standard Grid endpoints, but the sampled source does not implement them; they are represented here only as underlying hub capabilities.

Main entry points: [`src/main/java/com/seleniumgrid2api/api/GridInfoExtractor.java`](https://github.com/nicegraham/selenium-grid2-api/blob/master/src/main/java/com/seleniumgrid2api/api/GridInfoExtractor.java) (GridInfoExtractor), [`src/main/java/com/seleniumgrid2api/servlet/AllProxiesJsonServlet.java`](https://github.com/nicegraham/selenium-grid2-api/blob/master/src/main/java/com/seleniumgrid2api/servlet/AllProxiesJsonServlet.java) (All proxies JSON), [`src/main/java/com/seleniumgrid2api/servlet/ProxyStatusJsonServlet.java`](https://github.com/nicegraham/selenium-grid2-api/blob/master/src/main/java/com/seleniumgrid2api/servlet/ProxyStatusJsonServlet.java) (Proxy status JSON), [`src/main/java/com/seleniumgrid2api/StartGrid.java`](https://github.com/nicegraham/selenium-grid2-api/blob/master/src/main/java/com/seleniumgrid2api/StartGrid.java) (StartGrid)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_runtime["Hub runtime"]
  node_start["StartGrid<br/>[StartGrid.java]"]
  node_launcher["GridLauncher"]
  node_hub["Grid 2 hub"]
  node_registry[("Hub registry")]
  node_allproxies["All proxies JSON"]
  node_proxystatus["Proxy status JSON"]
  node_testsession["Test-session endpoint"]
end

subgraph group_client["Session lookup"]
  node_clientapp(("WebDriver client"))
  node_extractor["GridInfoExtractor"]
  node_gridinfo["GridInfo<br/>[GridInfo.java]"]
end

node_operator(("Operator"))

node_operator -->|"starts"| node_start
node_start -->|"invokes"| node_launcher
node_launcher -->|"starts"| node_hub
node_launcher -->|"registers"| node_allproxies
node_launcher -->|"registers"| node_proxystatus
node_allproxies -->|"reads proxies"| node_registry
node_proxystatus -->|"reads proxies"| node_registry
node_allproxies -->|"returns JSON"| node_operator
node_proxystatus -->|"returns JSON"| node_operator
node_clientapp -->|"requests lookup"| node_extractor
node_extractor -->|"POSTs session query"| node_testsession
node_testsession -->|"returns JSON"| node_extractor
node_extractor -->|"constructs"| node_gridinfo
node_gridinfo -->|"returns details"| node_clientapp

click node_start "https://github.com/nicegraham/selenium-grid2-api/blob/master/src/main/java/com/seleniumgrid2api/StartGrid.java"
click node_allproxies "https://github.com/nicegraham/selenium-grid2-api/blob/master/src/main/java/com/seleniumgrid2api/servlet/AllProxiesJsonServlet.java"
click node_proxystatus "https://github.com/nicegraham/selenium-grid2-api/blob/master/src/main/java/com/seleniumgrid2api/servlet/ProxyStatusJsonServlet.java"
click node_extractor "https://github.com/nicegraham/selenium-grid2-api/blob/master/src/main/java/com/seleniumgrid2api/api/GridInfoExtractor.java"
click node_gridinfo "https://github.com/nicegraham/selenium-grid2-api/blob/master/src/main/java/com/seleniumgrid2api/api/GridInfo.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_start,node_launcher,node_hub,node_registry,node_allproxies,node_proxystatus,node_testsession toneBlue
class node_clientapp,node_extractor,node_gridinfo toneAmber
class node_operator toneIndigo
```

## Components

### Hub runtime

- [StartGrid](https://github.com/nicegraham/selenium-grid2-api/blob/master/src/main/java/com/seleniumgrid2api/StartGrid.java): `src/main/java/com/seleniumgrid2api/StartGrid.java`
- **GridLauncher**
- **Grid 2 hub**
- **Hub registry**
- [All proxies JSON](https://github.com/nicegraham/selenium-grid2-api/blob/master/src/main/java/com/seleniumgrid2api/servlet/AllProxiesJsonServlet.java): `src/main/java/com/seleniumgrid2api/servlet/AllProxiesJsonServlet.java`
- [Proxy status JSON](https://github.com/nicegraham/selenium-grid2-api/blob/master/src/main/java/com/seleniumgrid2api/servlet/ProxyStatusJsonServlet.java): `src/main/java/com/seleniumgrid2api/servlet/ProxyStatusJsonServlet.java`
- **Test-session endpoint**

### Session lookup

- **WebDriver client**
- [GridInfoExtractor](https://github.com/nicegraham/selenium-grid2-api/blob/master/src/main/java/com/seleniumgrid2api/api/GridInfoExtractor.java): `src/main/java/com/seleniumgrid2api/api/GridInfoExtractor.java`
- [GridInfo](https://github.com/nicegraham/selenium-grid2-api/blob/master/src/main/java/com/seleniumgrid2api/api/GridInfo.java): `src/main/java/com/seleniumgrid2api/api/GridInfo.java`

### Other components

- **Operator**

## Connections

- Operator → StartGrid: starts
- StartGrid → GridLauncher: invokes
- GridLauncher → Grid 2 hub: starts
- GridLauncher → All proxies JSON: registers
- GridLauncher → Proxy status JSON: registers
- All proxies JSON → Hub registry: reads proxies
- Proxy status JSON → Hub registry: reads proxies
- All proxies JSON → Operator: returns JSON
- Proxy status JSON → Operator: returns JSON
- WebDriver client → GridInfoExtractor: requests lookup
- GridInfoExtractor → Test-session endpoint: POSTs session query
- Test-session endpoint → GridInfoExtractor: returns JSON
- GridInfoExtractor → GridInfo: constructs
- GridInfo → WebDriver client: returns details
