# nickfox/gpstracker architecture

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

- Interactive diagram: https://gitdiagram.com/nickfox/gpstracker
- Repository: https://github.com/nickfox/gpstracker

## Overview

GPS Tracker is a multi-platform location-tracking product: mobile apps capture and upload device locations; server implementations accept and store updates; web maps expose current positions and route history. The main documented v7 workflow is represented by the Kotlin Android client and PHP/JS server, with the Swift iOS client and documented legacy implementations retained as distinct branches. Source excerpts and the index support the PHP routing and persistence relationships; several mobile and legacy internals were not sampled, so their links are limited to documented relationships.

Main entry points: [`servers/php/index.php`](https://github.com/nickfox/gpstracker/blob/master/servers/php/index.php) (HTTP entry and routes), [`phoneClients/android/app/src/main/java/com/websmithing/gpstracker/ui/TrackingViewModel.kt`](https://github.com/nickfox/gpstracker/blob/master/phoneClients/android/app/src/main/java/com/websmithing/gpstracker/ui/TrackingViewModel.kt) (Tracking view model), [`servers/php/src/Services/LocationService.php`](https://github.com/nickfox/gpstracker/blob/master/servers/php/src/Services/LocationService.php) (Location processing), [`servers/php/src/Services/RouteRepository.php`](https://github.com/nickfox/gpstracker/blob/master/servers/php/src/Services/RouteRepository.php) (Route repository)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_mobile["Mobile clients"]
  node_android_ui["Android app UI"]
  node_android_vm["Tracking view model"]
  node_android_service["Background tracking<br/>[TrackingService.kt]"]
  node_android_location["Location repository"]
  node_android_settings["Settings repository"]
  node_android_api["Android API client<br/>[ApiService.kt]"]
  node_ios_ui["iOS screens<br/>[ContentView.swift]"]
  node_ios_vm["iOS tracking view model"]
  node_ios_location["iOS location service"]
  node_ios_repository["iOS location repository"]
  node_ios_api["iOS API service<br/>[APIService.swift]"]
end

subgraph group_php["PHP server"]
  node_php_entry["HTTP entry and routes<br/>[index.php]"]
  node_php_router["Request router<br/>[Router.php]"]
  node_php_location["Location controller"]
  node_php_location_service["Location processing"]
  node_php_model["GPS location model<br/>[GPSLocation.php]"]
  node_php_routes["Route controller"]
  node_php_route_repo["Route repository"]
  node_php_database["Database access<br/>[Database.php]"]
end

subgraph group_web["Map interface"]
  node_map_template["Map page<br/>[map.php]"]
end

subgraph group_legacy["Legacy platforms"]
  node_legacy_clients["Earlier mobile clients<br/>[GpsTracker.java]"]
  node_legacy_dotnet["ASP.NET server"]
  node_legacy_wordpress["WordPress plugin<br/>[gpstracker.php]"]
end

node_user(("Tracker user"))
node_location_store[("Location database")]
node_map_viewer(("Map viewer"))

node_user -->|"configures tracking"| node_android_ui
node_android_ui -->|"uses view model"| node_android_vm
node_android_vm -->|"controls tracking"| node_android_service
node_android_vm -->|"uses repository"| node_android_location
node_android_vm -->|"uses settings"| node_android_settings
node_android_service -->|"uploads locations"| node_android_location
node_android_location -->|"calls API"| node_android_api
node_android_api -.->|"posts location updates"| node_php_entry
node_user -->|"uses tracking app"| node_ios_ui
node_ios_ui -.->|"drives tracking"| node_ios_vm
node_ios_vm -.->|"uses location"| node_ios_location
node_ios_location -.->|"provides location"| node_ios_repository
node_ios_repository -.->|"uploads updates"| node_ios_api
node_ios_api -.->|"sends location data"| node_php_entry
node_php_entry -->|"dispatches requests"| node_php_router
node_php_entry -->|"registers updates"| node_php_location
node_php_entry -->|"registers route queries"| node_php_routes
node_php_entry -->|"serves map page"| node_map_template
node_php_location -->|"processes updates"| node_php_location_service
node_php_location_service -->|"uses location model"| node_php_model
node_php_location_service -->|"stores locations"| node_php_database
node_php_routes -->|"queries routes"| node_php_route_repo
node_php_route_repo -->|"queries records"| node_php_database
node_php_route_repo -->|"uses location model"| node_php_model
node_php_database -->|"reads and writes"| node_location_store
node_map_template -->|"renders map"| node_map_viewer
node_user -->|"views route history"| node_map_viewer
node_user -.->|"may use"| node_legacy_clients
node_legacy_clients -.->|"sends tracking data"| node_legacy_dotnet
node_user -.->|"may use"| node_legacy_wordpress

click node_android_ui "https://github.com/nickfox/gpstracker/blob/master/phoneClients/android/app/src/main/java/com/websmithing/gpstracker/GpsTrackerActivity.kt"
click node_android_vm "https://github.com/nickfox/gpstracker/blob/master/phoneClients/android/app/src/main/java/com/websmithing/gpstracker/ui/TrackingViewModel.kt"
click node_android_service "https://github.com/nickfox/gpstracker/blob/master/phoneClients/android/app/src/main/java/com/websmithing/gpstracker/service/TrackingService.kt"
click node_android_location "https://github.com/nickfox/gpstracker/blob/master/phoneClients/android/app/src/main/java/com/websmithing/gpstracker/data/repository/LocationRepositoryImpl.kt"
click node_android_settings "https://github.com/nickfox/gpstracker/blob/master/phoneClients/android/app/src/main/java/com/websmithing/gpstracker/data/repository/SettingsRepositoryImpl.kt"
click node_android_api "https://github.com/nickfox/gpstracker/blob/master/phoneClients/android/app/src/main/java/com/websmithing/gpstracker/network/ApiService.kt"
click node_ios_ui "https://github.com/nickfox/gpstracker/blob/master/phoneClients/ios/GPSTracker/View/ContentView.swift"
click node_ios_vm "https://github.com/nickfox/gpstracker/blob/master/phoneClients/ios/GPSTracker/ViewModel/TrackingViewModel.swift"
click node_ios_location "https://github.com/nickfox/gpstracker/blob/master/phoneClients/ios/GPSTracker/Service/LocationService.swift"
click node_ios_repository "https://github.com/nickfox/gpstracker/blob/master/phoneClients/ios/GPSTracker/Repository/LocationRepository.swift"
click node_ios_api "https://github.com/nickfox/gpstracker/blob/master/phoneClients/ios/GPSTracker/Service/APIService.swift"
click node_php_entry "https://github.com/nickfox/gpstracker/blob/master/servers/php/index.php"
click node_php_router "https://github.com/nickfox/gpstracker/blob/master/servers/php/src/Router.php"
click node_php_location "https://github.com/nickfox/gpstracker/blob/master/servers/php/src/Controllers/LocationController.php"
click node_php_location_service "https://github.com/nickfox/gpstracker/blob/master/servers/php/src/Services/LocationService.php"
click node_php_model "https://github.com/nickfox/gpstracker/blob/master/servers/php/src/Models/GPSLocation.php"
click node_php_routes "https://github.com/nickfox/gpstracker/blob/master/servers/php/src/Controllers/RouteController.php"
click node_php_route_repo "https://github.com/nickfox/gpstracker/blob/master/servers/php/src/Services/RouteRepository.php"
click node_php_database "https://github.com/nickfox/gpstracker/blob/master/servers/php/src/Services/Database.php"
click node_map_template "https://github.com/nickfox/gpstracker/blob/master/servers/php/templates/map.php"
click node_legacy_clients "https://github.com/nickfox/gpstracker/blob/master/phoneClients/javaMe/src/com/websmithing/gpstracker/GpsTracker.java"
click node_legacy_dotnet "https://github.com/nickfox/gpstracker/blob/master/servers/dotNet/UpdateLocation.aspx.cs"
click node_legacy_wordpress "https://github.com/nickfox/gpstracker/blob/master/servers/wordpress/gps-tracker/gpstracker.php"

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_android_ui,node_android_vm,node_android_service,node_android_location,node_android_settings,node_android_api,node_ios_ui,node_ios_vm,node_ios_location,node_ios_repository,node_ios_api,node_user,node_map_viewer toneBlue
class node_php_entry,node_php_router,node_php_location,node_php_location_service,node_php_model,node_php_routes,node_php_route_repo,node_php_database,node_location_store toneAmber
class node_map_template toneMint
class node_legacy_clients,node_legacy_dotnet,node_legacy_wordpress toneRose
```

## Components

### Mobile clients

- [Android app UI](https://github.com/nickfox/gpstracker/blob/master/phoneClients/android/app/src/main/java/com/websmithing/gpstracker/GpsTrackerActivity.kt): `phoneClients/android/app/src/main/java/com/websmithing/gpstracker/GpsTrackerActivity.kt`
- [Tracking view model](https://github.com/nickfox/gpstracker/blob/master/phoneClients/android/app/src/main/java/com/websmithing/gpstracker/ui/TrackingViewModel.kt): `phoneClients/android/app/src/main/java/com/websmithing/gpstracker/ui/TrackingViewModel.kt`
- [Background tracking](https://github.com/nickfox/gpstracker/blob/master/phoneClients/android/app/src/main/java/com/websmithing/gpstracker/service/TrackingService.kt): `phoneClients/android/app/src/main/java/com/websmithing/gpstracker/service/TrackingService.kt`
- [Location repository](https://github.com/nickfox/gpstracker/blob/master/phoneClients/android/app/src/main/java/com/websmithing/gpstracker/data/repository/LocationRepositoryImpl.kt): `phoneClients/android/app/src/main/java/com/websmithing/gpstracker/data/repository/LocationRepositoryImpl.kt`
- [Settings repository](https://github.com/nickfox/gpstracker/blob/master/phoneClients/android/app/src/main/java/com/websmithing/gpstracker/data/repository/SettingsRepositoryImpl.kt): `phoneClients/android/app/src/main/java/com/websmithing/gpstracker/data/repository/SettingsRepositoryImpl.kt`
- [Android API client](https://github.com/nickfox/gpstracker/blob/master/phoneClients/android/app/src/main/java/com/websmithing/gpstracker/network/ApiService.kt): `phoneClients/android/app/src/main/java/com/websmithing/gpstracker/network/ApiService.kt`
- [iOS screens](https://github.com/nickfox/gpstracker/blob/master/phoneClients/ios/GPSTracker/View/ContentView.swift): `phoneClients/ios/GPSTracker/View/ContentView.swift`
- [iOS tracking view model](https://github.com/nickfox/gpstracker/blob/master/phoneClients/ios/GPSTracker/ViewModel/TrackingViewModel.swift): `phoneClients/ios/GPSTracker/ViewModel/TrackingViewModel.swift`
- [iOS location service](https://github.com/nickfox/gpstracker/blob/master/phoneClients/ios/GPSTracker/Service/LocationService.swift): `phoneClients/ios/GPSTracker/Service/LocationService.swift`
- [iOS location repository](https://github.com/nickfox/gpstracker/blob/master/phoneClients/ios/GPSTracker/Repository/LocationRepository.swift): `phoneClients/ios/GPSTracker/Repository/LocationRepository.swift`
- [iOS API service](https://github.com/nickfox/gpstracker/blob/master/phoneClients/ios/GPSTracker/Service/APIService.swift): `phoneClients/ios/GPSTracker/Service/APIService.swift`

### PHP server

- [HTTP entry and routes](https://github.com/nickfox/gpstracker/blob/master/servers/php/index.php): `servers/php/index.php`
- [Request router](https://github.com/nickfox/gpstracker/blob/master/servers/php/src/Router.php): `servers/php/src/Router.php`
- [Location controller](https://github.com/nickfox/gpstracker/blob/master/servers/php/src/Controllers/LocationController.php): `servers/php/src/Controllers/LocationController.php`
- [Location processing](https://github.com/nickfox/gpstracker/blob/master/servers/php/src/Services/LocationService.php): `servers/php/src/Services/LocationService.php`
- [GPS location model](https://github.com/nickfox/gpstracker/blob/master/servers/php/src/Models/GPSLocation.php): `servers/php/src/Models/GPSLocation.php`
- [Route controller](https://github.com/nickfox/gpstracker/blob/master/servers/php/src/Controllers/RouteController.php): `servers/php/src/Controllers/RouteController.php`
- [Route repository](https://github.com/nickfox/gpstracker/blob/master/servers/php/src/Services/RouteRepository.php): `servers/php/src/Services/RouteRepository.php`
- [Database access](https://github.com/nickfox/gpstracker/blob/master/servers/php/src/Services/Database.php): `servers/php/src/Services/Database.php`

### Map interface

- [Map page](https://github.com/nickfox/gpstracker/blob/master/servers/php/templates/map.php): `servers/php/templates/map.php`

### Legacy platforms

- [Earlier mobile clients](https://github.com/nickfox/gpstracker/blob/master/phoneClients/javaMe/src/com/websmithing/gpstracker/GpsTracker.java): `phoneClients/javaMe/src/com/websmithing/gpstracker/GpsTracker.java`
- [ASP.NET server](https://github.com/nickfox/gpstracker/blob/master/servers/dotNet/UpdateLocation.aspx.cs): `servers/dotNet/UpdateLocation.aspx.cs`
- [WordPress plugin](https://github.com/nickfox/gpstracker/blob/master/servers/wordpress/gps-tracker/gpstracker.php): `servers/wordpress/gps-tracker/gpstracker.php`

### Other components

- **Tracker user**
- **Location database**
- **Map viewer**

## Connections

- Tracker user → Android app UI: configures tracking
- Android app UI → Tracking view model: uses view model (evidence: `phoneClients/android/app/src/main/java/com/websmithing/gpstracker/GpsTrackerActivity.kt`)
- Tracking view model → Background tracking: controls tracking (evidence: `phoneClients/android/app/src/main/java/com/websmithing/gpstracker/ui/TrackingViewModel.kt`)
- Tracking view model → Location repository: uses repository (evidence: `phoneClients/android/app/src/main/java/com/websmithing/gpstracker/ui/TrackingViewModel.kt`)
- Tracking view model → Settings repository: uses settings (evidence: `phoneClients/android/app/src/main/java/com/websmithing/gpstracker/ui/TrackingViewModel.kt`)
- Background tracking → Location repository: uploads locations (evidence: `phoneClients/android/app/src/main/java/com/websmithing/gpstracker/service/TrackingService.kt`)
- Location repository → Android API client: calls API (evidence: `phoneClients/android/app/src/main/java/com/websmithing/gpstracker/data/repository/LocationRepositoryImpl.kt`)
- Android API client → HTTP entry and routes: posts location updates
- Tracker user → iOS screens: uses tracking app
- iOS screens → iOS tracking view model: drives tracking
- iOS tracking view model → iOS location service: uses location
- iOS location service → iOS location repository: provides location
- iOS location repository → iOS API service: uploads updates
- iOS API service → HTTP entry and routes: sends location data
- HTTP entry and routes → Request router: dispatches requests (evidence: `servers/php/index.php`)
- HTTP entry and routes → Location controller: registers updates (evidence: `servers/php/index.php`)
- HTTP entry and routes → Route controller: registers route queries (evidence: `servers/php/index.php`)
- HTTP entry and routes → Map page: serves map page (evidence: `servers/php/index.php`)
- Location controller → Location processing: processes updates (evidence: `servers/php/src/Controllers/LocationController.php`)
- Location processing → GPS location model: uses location model (evidence: `servers/php/src/Services/LocationService.php`)
- Location processing → Database access: stores locations (evidence: `servers/php/src/Services/LocationService.php`)
- Route controller → Route repository: queries routes (evidence: `servers/php/src/Controllers/RouteController.php`)
- Route repository → Database access: queries records (evidence: `servers/php/src/Services/RouteRepository.php`)
- Route repository → GPS location model: uses location model (evidence: `servers/php/src/Services/RouteRepository.php`)
- Database access → Location database: reads and writes (evidence: `servers/php/src/Services/Database.php`)
- Map page → Map viewer: renders map
- Tracker user → Map viewer: views route history
- Tracker user → Earlier mobile clients: may use
- Earlier mobile clients → ASP.NET server: sends tracking data
- Tracker user → WordPress plugin: may use
