# cobbfan9/swgoh-assetapi architecture

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

- Interactive diagram: https://gitdiagram.com/cobbfan9/swgoh-assetapi
- Repository: https://github.com/cobbfan9/swgoh-assetapi

## Overview

SWGoH AssetAPI is a FastAPI service for retrieving Star Wars: Galaxy of Heroes asset bundles, manifests, and decoded textures. The principal workflow is an HTTP request, optional HMAC verification and Comlink version lookup, then endpoint-level manifest or bundle handling, EA asset retrieval, and (for texture endpoints) Unity decoding into PNG or base64 results. It also supports manifest comparisons, raw bundle downloads, and temporary-file cleanup. Relationships below are grounded in README documentation and the supplied source excerpts/index; some endpoint internals were only partially excerpted.

Main entry points: [`helpers/Endpoints.py`](https://github.com/cobbfan9/swgoh-assetapi/blob/main/helpers/Endpoints.py) (Asset endpoints), [`assetapi.py`](https://github.com/cobbfan9/swgoh-assetapi/blob/main/assetapi.py) (HTTP routes), [`helpers/RequestManager.py`](https://github.com/cobbfan9/swgoh-assetapi/blob/main/helpers/RequestManager.py) (Asset HTTP client), [`helpers/ManifestDecoder.py`](https://github.com/cobbfan9/swgoh-assetapi/blob/main/helpers/ManifestDecoder.py) (Manifest decoding)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_api["API and access"]
  node_fastapi["HTTP routes<br/>[assetapi.py]"]
  node_hmac["HMAC verification<br/>[HMACDecoder.py]"]
  node_comlink["Comlink version<br/>[RequestManager.py]"]
end

subgraph group_manifest["Manifest operations"]
  node_manifest_decode["Manifest decoding<br/>[ManifestDecoder.py]"]
  node_protobuf["Manifest schema"]
  node_manifest_diff["Manifest comparison<br/>[ManifestDiff.py]"]
  node_manifest_cache[("Manifest cache")]
end

subgraph group_assets["Asset retrieval"]
  node_endpoint["Asset endpoints<br/>[Endpoints.py]"]
  node_request_mgr["Asset HTTP client<br/>[RequestManager.py]"]
  node_bundle_cache[("Bundle cache")]
  node_texture["Texture decoding"]
  node_bundle_download["Bundle response<br/>[Endpoints.py]"]
end

subgraph group_runtime["Runtime utilities"]
  node_cleanup["Temporary cleanup<br/>[FileCleaner.py]"]
  node_file_lock["File coordination<br/>[FileLock.py]"]
  node_types["API types<br/>[TypeHelpers.py]"]
  node_logger["Logging<br/>[Logger.py]"]
end

node_client(("API client"))
node_ea(("EA asset server"))

node_client -->|"requests"| node_fastapi
node_fastapi -->|"verifies"| node_hmac
node_fastapi -->|"looks up version"| node_comlink
node_fastapi -->|"dispatches"| node_endpoint
node_fastapi -->|"runs cleanup"| node_cleanup
node_endpoint -->|"loads manifest"| node_manifest_decode
node_endpoint -->|"compares manifests"| node_manifest_diff
node_manifest_decode -->|"fetches manifest"| node_request_mgr
node_manifest_decode -->|"parses bytes"| node_protobuf
node_manifest_decode -->|"writes manifest"| node_manifest_cache
node_endpoint -->|"reads manifests"| node_manifest_cache
node_endpoint -->|"downloads bundles"| node_request_mgr
node_request_mgr -->|"fetches assets"| node_ea
node_request_mgr -->|"saves bundles"| node_bundle_cache
node_endpoint -->|"reads bundles"| node_bundle_cache
node_endpoint -->|"decodes textures"| node_texture
node_endpoint -->|"returns bundle"| node_bundle_download
node_cleanup -->|"deletes files"| node_bundle_cache
node_cleanup -->|"deletes files"| node_manifest_cache
node_endpoint -->|"coordinates access"| node_file_lock
node_request_mgr -->|"locks writes"| node_file_lock
node_manifest_decode -->|"locks writes"| node_file_lock
node_fastapi -->|"uses parameters"| node_types
node_endpoint -->|"uses enums"| node_types
node_comlink -->|"posts metadata"| node_request_mgr

click node_fastapi "https://github.com/cobbfan9/swgoh-assetapi/blob/main/assetapi.py"
click node_hmac "https://github.com/cobbfan9/swgoh-assetapi/blob/main/helpers/HMACDecoder.py"
click node_comlink "https://github.com/cobbfan9/swgoh-assetapi/blob/main/helpers/RequestManager.py"
click node_endpoint "https://github.com/cobbfan9/swgoh-assetapi/blob/main/helpers/Endpoints.py"
click node_manifest_decode "https://github.com/cobbfan9/swgoh-assetapi/blob/main/helpers/ManifestDecoder.py"
click node_protobuf "https://github.com/cobbfan9/swgoh-assetapi/blob/main/helpers/ManifestDecoderHelper.py"
click node_manifest_diff "https://github.com/cobbfan9/swgoh-assetapi/blob/main/helpers/ManifestDiff.py"
click node_request_mgr "https://github.com/cobbfan9/swgoh-assetapi/blob/main/helpers/RequestManager.py"
click node_texture "https://github.com/cobbfan9/swgoh-assetapi/blob/main/helpers/Texture2DDecoder.py"
click node_bundle_download "https://github.com/cobbfan9/swgoh-assetapi/blob/main/helpers/Endpoints.py"
click node_cleanup "https://github.com/cobbfan9/swgoh-assetapi/blob/main/helpers/FileCleaner.py"
click node_file_lock "https://github.com/cobbfan9/swgoh-assetapi/blob/main/helpers/FileLock.py"
click node_types "https://github.com/cobbfan9/swgoh-assetapi/blob/main/helpers/TypeHelpers.py"
click node_logger "https://github.com/cobbfan9/swgoh-assetapi/blob/main/helpers/Logger.py"

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_fastapi,node_hmac,node_comlink,node_client toneBlue
class node_manifest_decode,node_protobuf,node_manifest_diff,node_manifest_cache toneAmber
class node_endpoint,node_request_mgr,node_bundle_cache,node_texture,node_bundle_download,node_ea toneMint
class node_cleanup,node_file_lock,node_types,node_logger toneRose
```

## Components

### API and access

- [HTTP routes](https://github.com/cobbfan9/swgoh-assetapi/blob/main/assetapi.py): `assetapi.py`
- [HMAC verification](https://github.com/cobbfan9/swgoh-assetapi/blob/main/helpers/HMACDecoder.py): `helpers/HMACDecoder.py`
- [Comlink version](https://github.com/cobbfan9/swgoh-assetapi/blob/main/helpers/RequestManager.py): `helpers/RequestManager.py`

### Manifest operations

- [Manifest decoding](https://github.com/cobbfan9/swgoh-assetapi/blob/main/helpers/ManifestDecoder.py): `helpers/ManifestDecoder.py`
- [Manifest schema](https://github.com/cobbfan9/swgoh-assetapi/blob/main/helpers/ManifestDecoderHelper.py): `helpers/ManifestDecoderHelper.py`
- [Manifest comparison](https://github.com/cobbfan9/swgoh-assetapi/blob/main/helpers/ManifestDiff.py): `helpers/ManifestDiff.py`
- **Manifest cache**

### Asset retrieval

- [Asset endpoints](https://github.com/cobbfan9/swgoh-assetapi/blob/main/helpers/Endpoints.py): `helpers/Endpoints.py`
- [Asset HTTP client](https://github.com/cobbfan9/swgoh-assetapi/blob/main/helpers/RequestManager.py): `helpers/RequestManager.py`
- **Bundle cache**
- [Texture decoding](https://github.com/cobbfan9/swgoh-assetapi/blob/main/helpers/Texture2DDecoder.py): `helpers/Texture2DDecoder.py`
- [Bundle response](https://github.com/cobbfan9/swgoh-assetapi/blob/main/helpers/Endpoints.py): `helpers/Endpoints.py`

### Runtime utilities

- [Temporary cleanup](https://github.com/cobbfan9/swgoh-assetapi/blob/main/helpers/FileCleaner.py): `helpers/FileCleaner.py`
- [File coordination](https://github.com/cobbfan9/swgoh-assetapi/blob/main/helpers/FileLock.py): `helpers/FileLock.py`
- [API types](https://github.com/cobbfan9/swgoh-assetapi/blob/main/helpers/TypeHelpers.py): `helpers/TypeHelpers.py`
- [Logging](https://github.com/cobbfan9/swgoh-assetapi/blob/main/helpers/Logger.py): `helpers/Logger.py`

### Other components

- **API client**
- **EA asset server**

## Connections

- API client → HTTP routes: requests (evidence: `README.md`)
- HTTP routes → HMAC verification: verifies (evidence: `assetapi.py`)
- HTTP routes → Comlink version: looks up version (evidence: `assetapi.py`)
- HTTP routes → Asset endpoints: dispatches (evidence: `assetapi.py`)
- HTTP routes → Temporary cleanup: runs cleanup (evidence: `assetapi.py`)
- Asset endpoints → Manifest decoding: loads manifest (evidence: `helpers/Endpoints.py`)
- Asset endpoints → Manifest comparison: compares manifests (evidence: `helpers/Endpoints.py`)
- Manifest decoding → Asset HTTP client: fetches manifest (evidence: `helpers/ManifestDecoder.py`)
- Manifest decoding → Manifest schema: parses bytes (evidence: `helpers/ManifestDecoder.py`)
- Manifest decoding → Manifest cache: writes manifest (evidence: `helpers/ManifestDecoder.py`)
- Asset endpoints → Manifest cache: reads manifests (evidence: `helpers/Endpoints.py`)
- Asset endpoints → Asset HTTP client: downloads bundles (evidence: `helpers/Endpoints.py`)
- Asset HTTP client → EA asset server: fetches assets (evidence: `helpers/RequestManager.py`)
- Asset HTTP client → Bundle cache: saves bundles (evidence: `helpers/RequestManager.py`)
- Asset endpoints → Bundle cache: reads bundles (evidence: `helpers/Endpoints.py`)
- Asset endpoints → Texture decoding: decodes textures (evidence: `helpers/Endpoints.py`)
- Asset endpoints → Bundle response: returns bundle (evidence: `helpers/Endpoints.py`)
- Temporary cleanup → Bundle cache: deletes files (evidence: `README.md`)
- Temporary cleanup → Manifest cache: deletes files (evidence: `README.md`)
- Asset endpoints → File coordination: coordinates access (evidence: `helpers/Endpoints.py`)
- Asset HTTP client → File coordination: locks writes (evidence: `helpers/RequestManager.py`)
- Manifest decoding → File coordination: locks writes (evidence: `helpers/ManifestDecoder.py`)
- HTTP routes → API types: uses parameters (evidence: `assetapi.py`)
- Asset endpoints → API types: uses enums (evidence: `helpers/Endpoints.py`)
- Comlink version → Asset HTTP client: posts metadata (evidence: `helpers/RequestManager.py`)
