# dnlortega/spx-android architecture

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

- Interactive diagram: https://gitdiagram.com/dnlortega/spx-android
- Repository: https://github.com/dnlortega/spx-android

## Overview

SPX Route OS is an Android delivery-routing app whose interface runs in a WebView. The driver registers a route, optimizes and navigates its stops, records delivery completion and optional POD, and can transfer route data. Local storage supports offline workflows; network services provide maps, geocoding and routing. Separate capabilities include package lookup, label/barcode/voice input, and APK self-update. The Java excerpts show the WebView host and update handoff; several web modules are unsampled, so their detailed internal calls are not asserted.

Main entry points: [`app/src/main/assets/js/logistics-ui.js`](https://github.com/dnlortega/spx-android/blob/main/app/src/main/assets/js/logistics-ui.js) (Stop workflows), [`app/src/main/java/br/com/spxroute/app/ApkUpdater.java`](https://github.com/dnlortega/spx-android/blob/main/app/src/main/java/br/com/spxroute/app/ApkUpdater.java) (APK updater), [`app/src/main/assets/index.html`](https://github.com/dnlortega/spx-android/blob/main/app/src/main/assets/index.html) (Operations UI), [`app/src/main/java/br/com/spxroute/app/MainActivity.java`](https://github.com/dnlortega/spx-android/blob/main/app/src/main/java/br/com/spxroute/app/MainActivity.java) (WebView host)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_mobile["Android host"]
  node_activity["WebView host<br/>[MainActivity.java]"]
  node_androidinstaller{{"Android installer"}}
end

subgraph group_operations["Route operations"]
  node_interface["Operations UI<br/>[index.html]"]
  node_logistics["Stop workflows<br/>[logistics-ui.js]"]
  node_routeengine["Route optimizer<br/>[route-engine.js]"]
  node_packagefinder["Package finder<br/>[logistics-ui.js]"]
  node_pod["POD capture<br/>[logistics-ui.js]"]
end

subgraph group_records["Local records"]
  node_localstore[("Route storage<br/>[store.js]")]
  node_transfer["Route transfer<br/>[transfer.js]"]
end

subgraph group_connectivity["Maps and routing"]
  node_map["Map display<br/>[leaflet.js]"]
  node_routeproviders{{"Route providers<br/>[route-engine.js]"}}
  node_geocoding["Address lookup<br/>[logistics-ui.js]"]
  node_externalnav{{"Map apps"}}
end

subgraph group_updates["App updates"]
  node_updaterui["Update interface<br/>[app-update.js]"]
  node_updater["APK updater<br/>[ApkUpdater.java]"]
  node_releases{{"GitHub Releases"}}
end

node_driver(("Driver"))

node_driver -->|"uses"| node_interface
node_interface -.->|"presents"| node_logistics
node_logistics -->|"optimizes stops"| node_routeengine
node_logistics -->|"saves routes"| node_localstore
node_logistics -->|"finds packages"| node_packagefinder
node_logistics -->|"records POD"| node_pod
node_driver -->|"imports or exports"| node_transfer
node_routeengine -->|"requests routes"| node_routeproviders
node_logistics -->|"looks up addresses"| node_geocoding
node_logistics -.->|"shows stops"| node_map
node_driver -->|"opens navigation"| node_externalnav
node_activity -->|"hosts WebView"| node_interface
node_activity -->|"creates and starts"| node_updater
node_updaterui -.->|"requests update"| node_updater
node_updater -->|"checks releases"| node_releases
node_updater -->|"installs validated APK"| node_androidinstaller

click node_activity "https://github.com/dnlortega/spx-android/blob/main/app/src/main/java/br/com/spxroute/app/MainActivity.java"
click node_interface "https://github.com/dnlortega/spx-android/blob/main/app/src/main/assets/index.html"
click node_logistics "https://github.com/dnlortega/spx-android/blob/main/app/src/main/assets/js/logistics-ui.js"
click node_routeengine "https://github.com/dnlortega/spx-android/blob/main/app/src/main/assets/js/route-engine.js"
click node_packagefinder "https://github.com/dnlortega/spx-android/blob/main/app/src/main/assets/js/logistics-ui.js"
click node_pod "https://github.com/dnlortega/spx-android/blob/main/app/src/main/assets/js/logistics-ui.js"
click node_localstore "https://github.com/dnlortega/spx-android/blob/main/app/src/main/assets/js/store.js"
click node_transfer "https://github.com/dnlortega/spx-android/blob/main/app/src/main/assets/js/transfer.js"
click node_map "https://github.com/dnlortega/spx-android/blob/main/app/src/main/assets/libs/leaflet.js"
click node_routeproviders "https://github.com/dnlortega/spx-android/blob/main/app/src/main/assets/js/route-engine.js"
click node_geocoding "https://github.com/dnlortega/spx-android/blob/main/app/src/main/assets/js/logistics-ui.js"
click node_updaterui "https://github.com/dnlortega/spx-android/blob/main/app/src/main/assets/js/app-update.js"
click node_updater "https://github.com/dnlortega/spx-android/blob/main/app/src/main/java/br/com/spxroute/app/ApkUpdater.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_activity,node_androidinstaller toneBlue
class node_interface,node_logistics,node_routeengine,node_packagefinder,node_pod toneAmber
class node_localstore,node_transfer toneMint
class node_map,node_routeproviders,node_geocoding,node_externalnav toneRose
class node_updaterui,node_updater,node_releases,node_driver toneIndigo
```

## Components

### Android host

- [WebView host](https://github.com/dnlortega/spx-android/blob/main/app/src/main/java/br/com/spxroute/app/MainActivity.java): `app/src/main/java/br/com/spxroute/app/MainActivity.java`
- **Android installer**

### Route operations

- [Operations UI](https://github.com/dnlortega/spx-android/blob/main/app/src/main/assets/index.html): `app/src/main/assets/index.html`
- [Stop workflows](https://github.com/dnlortega/spx-android/blob/main/app/src/main/assets/js/logistics-ui.js): `app/src/main/assets/js/logistics-ui.js`
- [Route optimizer](https://github.com/dnlortega/spx-android/blob/main/app/src/main/assets/js/route-engine.js): `app/src/main/assets/js/route-engine.js`
- [Package finder](https://github.com/dnlortega/spx-android/blob/main/app/src/main/assets/js/logistics-ui.js): `app/src/main/assets/js/logistics-ui.js`
- [POD capture](https://github.com/dnlortega/spx-android/blob/main/app/src/main/assets/js/logistics-ui.js): `app/src/main/assets/js/logistics-ui.js`

### Local records

- [Route storage](https://github.com/dnlortega/spx-android/blob/main/app/src/main/assets/js/store.js): `app/src/main/assets/js/store.js`
- [Route transfer](https://github.com/dnlortega/spx-android/blob/main/app/src/main/assets/js/transfer.js): `app/src/main/assets/js/transfer.js`

### Maps and routing

- [Map display](https://github.com/dnlortega/spx-android/blob/main/app/src/main/assets/libs/leaflet.js): `app/src/main/assets/libs/leaflet.js`
- [Route providers](https://github.com/dnlortega/spx-android/blob/main/app/src/main/assets/js/route-engine.js): `app/src/main/assets/js/route-engine.js`
- [Address lookup](https://github.com/dnlortega/spx-android/blob/main/app/src/main/assets/js/logistics-ui.js): `app/src/main/assets/js/logistics-ui.js`
- **Map apps**

### App updates

- [Update interface](https://github.com/dnlortega/spx-android/blob/main/app/src/main/assets/js/app-update.js): `app/src/main/assets/js/app-update.js`
- [APK updater](https://github.com/dnlortega/spx-android/blob/main/app/src/main/java/br/com/spxroute/app/ApkUpdater.java): `app/src/main/java/br/com/spxroute/app/ApkUpdater.java`
- **GitHub Releases**

### Other components

- **Driver**

## Connections

- Driver → Operations UI: uses (evidence: `README.md`)
- Operations UI → Stop workflows: presents
- Stop workflows → Route optimizer: optimizes stops (evidence: `README.md`)
- Stop workflows → Route storage: saves routes (evidence: `README.md`)
- Stop workflows → Package finder: finds packages (evidence: `README.md`)
- Stop workflows → POD capture: records POD (evidence: `README.md`)
- Driver → Route transfer: imports or exports (evidence: `README.md`)
- Route optimizer → Route providers: requests routes (evidence: `README.md`)
- Stop workflows → Address lookup: looks up addresses (evidence: `README.md`)
- Stop workflows → Map display: shows stops
- Driver → Map apps: opens navigation (evidence: `README.md`)
- WebView host → Operations UI: hosts WebView (evidence: `README.md`)
- WebView host → APK updater: creates and starts (evidence: `app/src/main/java/br/com/spxroute/app/MainActivity.java`)
- Update interface → APK updater: requests update
- APK updater → GitHub Releases: checks releases (evidence: `README.md`)
- APK updater → Android installer: installs validated APK (evidence: `app/src/main/java/br/com/spxroute/app/ApkUpdater.java`)
