# openskynetwork/opensky-api architecture

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

- Interactive diagram: https://gitdiagram.com/openskynetwork/opensky-api
- Repository: https://github.com/openskynetwork/opensky-api

## Overview

This repository is a multi-part client SDK repo for the OpenSky Network API, plus the source for the public documentation site. The main architectural boundary is between the external OpenSky backend and three local deliverables: a Python client, a Java client, and generated docs.

1. **External system**
   - The only real backend dependency is the OpenSky API itself.
   - Both SDKs are thin consumers of that API; they do not store data locally or implement their own server.

2. **Python client library**
   - Located under `python/`.
   - Main entry point is `opensky_api.py`, with `example.py` showing usage and `test_opensky_api.py` covering behavior.
   - The Python package is the actively maintained implementation and supports OAuth2 client-credentials authentication through a `TokenManager`.
   - It exposes a user-facing API around query methods such as “get states,” returning Python-side objects or structured results.

3. **Python data flow**
   - Application code instantiates `OpenSkyApi`.
   - Optional credentials are loaded from a JSON file and exchanged for OAuth2 tokens.
   - Requests go to OpenSky over HTTP via `requests`.
   - API responses are turned into Python objects, then returned to the caller for inspection or downstream processing.

4. **Java client library**
   - Located under `java/`.
   - Maven-based project with `pom.xml`, tests under `src/test`, and implementation under `src/main/java`.
   - Main API class is `org.opensky.api.OpenSkyApi`.
   - Model classes include `OpenSkyStates` and `StateVector`, with `OpenSkyStatesDeserializer` handling JSON-to-object conversion.
   - The README positions this Java code as an example/legacy implementation rather than the actively maintained SDK.

5. **Java data flow**
   - Caller invokes `OpenSkyApi`.
   - The client performs HTTP calls to OpenSky using OkHttp.
   - JSON responses are deserialized into domain objects, especially `OpenSkyStates` containing a list of `StateVector` records.
   - The consumer works with typed objects rather than raw JSON.

6. **Auth model difference**
   - Python explicitly supports OAuth2 and anonymous fallback with reduced rate limits.
   - The repository README does not describe equivalent OAuth2 support for Java, which reinforces the split between the maintained Python SDK and the older Java example.

7. **Documentation subsystem**
   - Under `docs/` and `docs/free/`.
   - Built with Sphinx-style structure (`conf.py`, `index.rst`, language-specific pages).
   - Documentation covers API concepts and endpoint families such as REST state queries, state vectors, flight response, track response, and Trino-related material.
   - This is a separate artifact from the SDKs, but it shares the same repository and likely the same release workflow.

8. **Publishing / site structure**
   - `.nojekyll` and the GitHub Pages-oriented layout suggest the docs are intended for static hosting.
   - The docs tree likely produces the public site at the GitHub Pages URL referenced in the README.

9. **CI / validation**
   - `.github/workflows/main.yml` likely orchestrates build/test checks for the repo.
   - The presence of Python and Java tests suggests the workflow validates both SDKs independently.

10. **Key architectural boundaries to draw**
   - Boundary 1: client libraries vs. OpenSky network service.
   - Boundary 2: Python SDK vs. Java SDK, with different maturity and auth behavior.
   - Boundary 3: code vs. generated documentation.
   - Boundary 4: typed model layer (`StateVector`, `OpenSkyStates`) vs. raw HTTP/JSON transport.

In diagram form, the repo is best represented as two SDK pipelines feeding the same external OpenSky API, with a separate docs pipeline publishing reference material for those clients and endpoints.

Main entry points: [`docs/free/index.rst`](https://github.com/openskynetwork/opensky-api/blob/master/docs/free/index.rst) (Docs index), [`java/src/main/java/org/opensky/api/OpenSkyApi.java`](https://github.com/openskynetwork/opensky-api/blob/master/java/src/main/java/org/opensky/api/OpenSkyApi.java) (OpenSkyApi), [`python/opensky_api.py`](https://github.com/openskynetwork/opensky-api/blob/master/python/opensky_api.py) (OpenSkyApi), [`.github/workflows/main.yml`](https://github.com/openskynetwork/opensky-api/blob/master/.github/workflows/main.yml) (Main workflow)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_external["External service"]
  node_opensky_api[("OpenSky API<br/>backend service")]
end

subgraph group_python["Python SDK"]
  node_py_entry["OpenSkyApi<br/>python client<br/>[opensky_api.py]"]
  node_py_tokens["TokenManager<br/>python auth<br/>[opensky_api.py]"]
  node_py_example["Example<br/>python usage<br/>[example.py]"]
  node_py_tests["Python tests"]
  node_py_pkg["Python package<br/>[pyproject.toml]"]
end

subgraph group_java["Java SDK"]
  node_java_api["OpenSkyApi<br/>java client<br/>[OpenSkyApi.java]"]
  node_java_states["OpenSkyStates<br/>java model<br/>[OpenSkyStates.java]"]
  node_java_vector["StateVector<br/>java model<br/>[StateVector.java]"]
  node_java_deser["Deserializer<br/>java json mapping"]
  node_java_tests["Java tests"]
  node_java_pom["Maven build<br/>java build<br/>[pom.xml]"]
end

subgraph group_docs["Documentation"]
  node_docs_index["Docs index<br/>docs entry<br/>[index.rst]"]
  node_docs_rest["REST docs<br/>api docs<br/>[rest.rst]"]
  node_docs_states["State docs<br/>api docs<br/>[state-vectors.rst]"]
  node_docs_track["Track docs<br/>api docs<br/>[track-response.rst]"]
  node_docs_trino["Trino docs<br/>api docs<br/>[trino.rst]"]
end

subgraph group_ci["CI / release"]
  node_workflow["Main workflow<br/>ci workflow<br/>[main.yml]"]
  node_pages_marker["Pages marker<br/>static hosting<br/>[.nojekyll]"]
end

node_py_entry -->|"HTTP queries"| node_opensky_api
node_py_tokens -->|"auth setup"| node_py_entry
node_py_example -->|"usage"| node_py_entry
node_py_tests -->|"verifies"| node_py_entry
node_java_api -->|"HTTP queries"| node_opensky_api
node_java_api -->|"maps JSON"| node_java_deser
node_java_deser -->|"builds"| node_java_states
node_java_states -->|"contains"| node_java_vector
node_java_tests -->|"verifies"| node_java_api
node_java_tests -->|"verifies"| node_java_deser
node_java_pom -->|"builds"| node_java_api
node_docs_index -->|"navigates"| node_docs_rest
node_docs_index -->|"navigates"| node_docs_states
node_docs_index -->|"navigates"| node_docs_track
node_docs_index -->|"navigates"| node_docs_trino
node_workflow -->|"runs"| node_py_tests
node_workflow -->|"runs"| node_java_tests
node_workflow -->|"builds"| node_docs_index
node_pages_marker -->|"hosts"| node_docs_index

click node_py_entry "https://github.com/openskynetwork/opensky-api/blob/master/python/opensky_api.py"
click node_py_tokens "https://github.com/openskynetwork/opensky-api/blob/master/python/opensky_api.py"
click node_py_example "https://github.com/openskynetwork/opensky-api/blob/master/python/example.py"
click node_py_tests "https://github.com/openskynetwork/opensky-api/blob/master/python/test_opensky_api.py"
click node_py_pkg "https://github.com/openskynetwork/opensky-api/blob/master/python/pyproject.toml"
click node_java_api "https://github.com/openskynetwork/opensky-api/blob/master/java/src/main/java/org/opensky/api/OpenSkyApi.java"
click node_java_states "https://github.com/openskynetwork/opensky-api/blob/master/java/src/main/java/org/opensky/model/OpenSkyStates.java"
click node_java_vector "https://github.com/openskynetwork/opensky-api/blob/master/java/src/main/java/org/opensky/model/StateVector.java"
click node_java_deser "https://github.com/openskynetwork/opensky-api/blob/master/java/src/main/java/org/opensky/model/OpenSkyStatesDeserializer.java"
click node_java_tests "https://github.com/openskynetwork/opensky-api/blob/master/java/src/test/java/TestOpenSkyApi.java"
click node_java_pom "https://github.com/openskynetwork/opensky-api/blob/master/java/pom.xml"
click node_docs_index "https://github.com/openskynetwork/opensky-api/blob/master/docs/free/index.rst"
click node_docs_rest "https://github.com/openskynetwork/opensky-api/blob/master/docs/free/rest.rst"
click node_docs_states "https://github.com/openskynetwork/opensky-api/blob/master/docs/free/state-vectors.rst"
click node_docs_track "https://github.com/openskynetwork/opensky-api/blob/master/docs/free/track-response.rst"
click node_docs_trino "https://github.com/openskynetwork/opensky-api/blob/master/docs/free/trino.rst"
click node_workflow "https://github.com/openskynetwork/opensky-api/blob/master/.github/workflows/main.yml"
click node_pages_marker "https://github.com/openskynetwork/opensky-api/blob/master/.nojekyll"

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_opensky_api toneBlue
class node_py_entry,node_py_tokens,node_py_example,node_py_tests,node_py_pkg toneAmber
class node_java_api,node_java_states,node_java_vector,node_java_deser,node_java_tests,node_java_pom toneMint
class node_docs_index,node_docs_rest,node_docs_states,node_docs_track,node_docs_trino toneRose
class node_workflow,node_pages_marker toneIndigo
```

## Components

### External service

The OpenSky backend API consumed by both SDKs.

- **OpenSky API**: backend service · External OpenSky Network HTTP API used by the clients.

### Python SDK

Actively maintained Python client library and its usage flow.

- [OpenSkyApi](https://github.com/openskynetwork/opensky-api/blob/master/python/opensky_api.py): python client · Main Python entry point for querying the API. · `python/opensky_api.py`
- [TokenManager](https://github.com/openskynetwork/opensky-api/blob/master/python/opensky_api.py): python auth · OAuth2 client-credentials and credential handling for Python. · `python/opensky_api.py`
- [Example](https://github.com/openskynetwork/opensky-api/blob/master/python/example.py): python usage · Small Python usage example. · `python/example.py`
- [Python tests](https://github.com/openskynetwork/opensky-api/blob/master/python/test_opensky_api.py): python test · Behavior coverage for the Python client. · `python/test_opensky_api.py`
- [Python package](https://github.com/openskynetwork/opensky-api/blob/master/python/pyproject.toml): python package · Python deliverable and packaging metadata. · `python/pyproject.toml`

### Java SDK

Maven-based Java client and typed model layer.

- [OpenSkyApi](https://github.com/openskynetwork/opensky-api/blob/master/java/src/main/java/org/opensky/api/OpenSkyApi.java): java client · Main Java client entry point. · `java/src/main/java/org/opensky/api/OpenSkyApi.java`
- [OpenSkyStates](https://github.com/openskynetwork/opensky-api/blob/master/java/src/main/java/org/opensky/model/OpenSkyStates.java): java model · Typed response container for state vectors. · `java/src/main/java/org/opensky/model/OpenSkyStates.java`
- [StateVector](https://github.com/openskynetwork/opensky-api/blob/master/java/src/main/java/org/opensky/model/StateVector.java): java model · Individual state record used by the Java client. · `java/src/main/java/org/opensky/model/StateVector.java`
- [Deserializer](https://github.com/openskynetwork/opensky-api/blob/master/java/src/main/java/org/opensky/model/OpenSkyStatesDeserializer.java): java json mapping · Converts JSON responses into Java domain objects. · `java/src/main/java/org/opensky/model/OpenSkyStatesDeserializer.java`
- [Java tests](https://github.com/openskynetwork/opensky-api/blob/master/java/src/test/java/TestOpenSkyApi.java): java test · Tests for the Java client and deserializer. · `java/src/test/java/TestOpenSkyApi.java`
- [Maven build](https://github.com/openskynetwork/opensky-api/blob/master/java/pom.xml): java build · Project build and dependency configuration. · `java/pom.xml`

### Documentation

Sphinx-style documentation sources for the public site.

- [Docs index](https://github.com/openskynetwork/opensky-api/blob/master/docs/free/index.rst): docs entry · Top-level Sphinx documentation entry point. · `docs/free/index.rst`
- [REST docs](https://github.com/openskynetwork/opensky-api/blob/master/docs/free/rest.rst): api docs · REST endpoint and request documentation. · `docs/free/rest.rst`
- [State docs](https://github.com/openskynetwork/opensky-api/blob/master/docs/free/state-vectors.rst): api docs · State-vector and states-response documentation. · `docs/free/state-vectors.rst`
- [Track docs](https://github.com/openskynetwork/opensky-api/blob/master/docs/free/track-response.rst): api docs · Flight and track response documentation. · `docs/free/track-response.rst`
- [Trino docs](https://github.com/openskynetwork/opensky-api/blob/master/docs/free/trino.rst): api docs · Trino-related documentation page. · `docs/free/trino.rst`

### CI / release

Workflow and static hosting markers for validation and publishing.

- [Main workflow](https://github.com/openskynetwork/opensky-api/blob/master/.github/workflows/main.yml): ci workflow · GitHub Actions validation workflow for the repository. · `.github/workflows/main.yml`
- [Pages marker](https://github.com/openskynetwork/opensky-api/blob/master/.nojekyll): static hosting · GitHub Pages nojekyll marker for static docs hosting. · `.nojekyll`

## Connections

- OpenSkyApi → OpenSky API: HTTP queries · Python client sends requests to OpenSky over HTTP.
- TokenManager → OpenSkyApi: auth setup · Token management configures authenticated access for the client.
- Example → OpenSkyApi: usage · Example shows how callers instantiate and use the Python API.
- Python tests → OpenSkyApi: verifies · Python tests cover client behavior.
- OpenSkyApi → OpenSky API: HTTP queries · Java client sends requests to OpenSky over HTTP.
- OpenSkyApi → Deserializer: maps JSON · Client relies on JSON-to-object conversion for responses.
- Deserializer → OpenSkyStates: builds · Deserializer produces the typed response container.
- OpenSkyStates → StateVector: contains · States response wraps a list of state vectors.
- Java tests → OpenSkyApi: verifies · Java tests cover client behavior.
- Java tests → Deserializer: verifies · Java tests cover deserialization behavior.
- Maven build → OpenSkyApi: builds · Maven project builds the Java client implementation.
- Docs index → REST docs: navigates · Docs index links into REST coverage.
- Docs index → State docs: navigates · Docs index links into state-related pages.
- Docs index → Track docs: navigates · Docs index links into track and flight response pages.
- Docs index → Trino docs: navigates · Docs index links into Trino documentation.
- Main workflow → Python tests: runs · CI validates the Python SDK.
- Main workflow → Java tests: runs · CI validates the Java SDK.
- Main workflow → Docs index: builds · CI likely builds the documentation site.
- Pages marker → Docs index: hosts · Static hosting marker supports the generated docs site.
