Skip to content

Mobile app (PWA) + full network-stack backend (cellular, Wi-Fi, satellite, GNSS)#7

Draft
AntwerpDesignsIonity wants to merge 1 commit into
Antwerpdesigns-Seed-Root-Mainfrom
claude/mobile-app-network-backend-2rux3v
Draft

Mobile app (PWA) + full network-stack backend (cellular, Wi-Fi, satellite, GNSS)#7
AntwerpDesignsIonity wants to merge 1 commit into
Antwerpdesigns-Seed-Root-Mainfrom
claude/mobile-app-network-backend-2rux3v

Conversation

@AntwerpDesignsIonity

@AntwerpDesignsIonity AntwerpDesignsIonity commented Jun 13, 2026

Copy link
Copy Markdown
Owner

Summary

Makes NetworkzeroMonitor run on mobile and extends the backend to report the entire network stack — from local interfaces all the way up to cellular (2G–5G), Wi-Fi, satellite internet (Starlink) and GNSS / satellite positioning.

Rather than ship a separate native build, this reuses the whole existing Python backend behind a small Flask API and an installable mobile PWA, so it works on any phone via the browser (Add to Home Screen) on the same network.

What's included

Extended backend — network_extended.py

  • ExtendedNetworkMonitor probing:
    • Cellular / mobile broadband via ModemManager (mmcli) — operator, access tech, 2G/3G/4G/5G generation, signal.
    • Wi-Fi link via nmcli/iw — SSID, signal, band, rate, security.
    • Satellite internet (Starlink) — dish reachability + live gRPC telemetry (latency, throughput, obstruction) when grpcurl is present.
    • GNSS / satellite positioning via gpsd — fix, lat/lon/alt, satellites in view & used, per-satellite SNR with constellation (GPS/Galileo/GLONASS/BeiDou…).
  • Every probe degrades gracefully: missing hardware/tooling returns available: false with a human-readable reason instead of raising.

Mobile API server — api_server.py (Flask)

  • Serves the PWA and exposes the full backend as JSON.
  • /api/overview (single-call dashboard), /api/network, /api/connectivity, /api/traffic, /api/ping, /api/dns, /api/ports, /api/pihole/<action>, and /api/extended/{cellular,wifi,satellite,gnss,all}.

Mobile PWA — mobile/

  • Installable (manifest + service worker + SVG icon), responsive dark UI.
  • Views: Dashboard, Layers (per-interface traffic + wireless/WAN), GNSS (fix + satellite table), Tools (interactive ping / DNS / port scan).
  • Network-first API calls; offline app shell; 15s dashboard auto-refresh.

Plumbing

  • run_mobile.sh / run_mobile.bat launchers, [Mobile] config section, flask added to requirements.txt.
  • New unit tests for the extended layers; README documents the mobile app, API, and optional helper tools.

Testing notes

  • Extended module is pure stdlib and its logic is unit-tested (parsing, mappings, graceful fallbacks all pass).
  • The full suite and live server require the project deps (psutil, requests, flask), which aren't installable in the offline CI sandbox; new files pass py_compile.

Try it

./run_mobile.sh        # prints http://<your-ip>:8088

Open that URL on your phone → Add to Home Screen.


Generated by Claude Code

Summary by Sourcery

Add a mobile-friendly PWA frontend backed by a Flask REST API and an extended monitoring backend that surfaces cellular, Wi‑Fi, satellite internet, and GNSS data.

New Features:

  • Introduce an ExtendedNetworkMonitor module that aggregates cellular, Wi‑Fi, satellite internet (Starlink), and GNSS layers into a consolidated snapshot.
  • Expose the existing monitoring engine via a new Flask-based REST API server for use by mobile and other HTTP clients.
  • Add an installable mobile PWA frontend that provides dashboard, layered network views, GNSS details, and interactive ping/DNS/port tools.
  • Provide cross-platform launcher scripts to start the mobile API server on Unix and Windows.

Enhancements:

  • Document the mobile app, extended network stack layers, REST API endpoints, required helper tools, and updated project structure in the README.
  • Extend configuration with a dedicated Mobile section to control API bind host and port.
  • Add unit tests covering ExtendedNetworkMonitor behaviour, including graceful fallbacks and parsing logic for cellular and GNSS data.

Build:

  • Add Flask as a dependency for the mobile API server in requirements.txt.

Tests:

  • Add tests for the extended monitoring layers, including cellular generation mapping, GNSS constellation mapping, and Starlink satellite reporting.

Introduce a mobile-friendly interface and extend the backend to expose
the entire network stack from physical interfaces up to GNSS and
satellite networks.

- network_extended.py: ExtendedNetworkMonitor probing cellular (2G-5G via
  ModemManager), Wi-Fi (nmcli/iw), satellite internet (Starlink dish gRPC)
  and GNSS/satellite positioning (gpsd), each with graceful fallbacks.
- api_server.py: Flask REST API exposing the full backend and serving the
  PWA; aggregated /api/overview and /api/extended/* endpoints.
- mobile/: installable PWA (manifest, service worker, icon) with Dashboard,
  Layers, GNSS and Tools views; responsive dark UI, network-first API,
  offline app shell.
- run_mobile.sh/.bat launchers, [Mobile] config section, flask dependency.
- Tests for the extended layers and README documentation.
@sourcery-ai

sourcery-ai Bot commented Jun 13, 2026

Copy link
Copy Markdown

Reviewer's Guide

Adds an extended network monitoring backend (cellular, Wi‑Fi, satellite internet, GNSS), exposes it plus existing functionality via a new Flask REST API, and serves an installable mobile PWA frontend for monitoring and tools from any phone on the same network, with updated docs, config, tests, and launch scripts.

Sequence diagram for loading the mobile dashboard via /api/overview

sequenceDiagram
  actor User
  participant MobilePWA
  participant FlaskAPI
  participant NetworkMonitor
  participant ExtendedNetworkMonitor

  User->>MobilePWA: open app (loadDashboard)
  MobilePWA->>FlaskAPI: GET /api/overview
  FlaskAPI->>NetworkMonitor: get_network_info()
  NetworkMonitor-->>FlaskAPI: network info
  FlaskAPI->>NetworkMonitor: check_internet_connectivity()
  NetworkMonitor-->>FlaskAPI: connectivity
  FlaskAPI->>ExtendedNetworkMonitor: get_all_layers()
  ExtendedNetworkMonitor-->>FlaskAPI: cellular, wifi, satellite_internet, gnss
  FlaskAPI-->>MobilePWA: overview JSON
  MobilePWA-->>User: render dashboard cards
Loading

File-Level Changes

Change Details Files
Introduce an extended backend module to probe cellular, Wi‑Fi, satellite internet (Starlink), and GNSS layers with graceful degradation.
  • Add ExtendedNetworkMonitor class with per-layer probe methods for cellular (ModemManager/mmcli), Wi‑Fi (nmcli), satellite internet via Starlink gRPC, and GNSS via gpsd.
  • Provide helpers for safe subprocess execution, TCP reachability, timestamps, and parsing/modelling of modem and GNSS data.
  • Implement consolidated get_all_layers() snapshot for use by the API and dashboard, always returning structured results with available flags and reasons.
network_extended.py
Expose backend and extended layers over HTTP via a Flask mobile API server and serve the PWA assets.
  • Create a Flask app that wires NetworkMonitor and ExtendedNetworkMonitor into REST endpoints for network, connectivity, traffic, ping, DNS, ports, Pi-hole, and extended/{cellular,wifi,satellite,gnss,all}.
  • Add an /api/overview aggregate endpoint for the mobile dashboard and a basic /api/health endpoint including an app version constant.
  • Serve the mobile PWA static assets (HTML, JS, CSS, manifest, icon, service worker) from the mobile/ directory and provide a main() that reads NZM_HOST/NZM_PORT env vars and starts the server.
api_server.py
Add a mobile PWA frontend that consumes the new API, renders dashboard/layers/GNSS/tools views, and supports offline shell caching.
  • Implement app.js with API helpers, tab/view management, dashboard and layer rendering (including summaries of extended layers), GNSS detail view, and interactive ping/DNS/port tools wired to the API.
  • Design a dark, mobile-first responsive UI in styles.css with cards, status banner, grids, and safe-area aware layout for the PWA.
  • Create index.html wiring up the app shell, meta tags, tabs, and sections; add manifest.webmanifest and icon.svg for installability; add a service-worker.js that caches the shell while keeping /api/* network-first.
mobile/app.js
mobile/styles.css
mobile/index.html
mobile/manifest.webmanifest
mobile/icon.svg
mobile/service-worker.js
Wire the mobile server into the project via launch scripts, configuration, dependencies, and documentation, and add tests for the extended backend.
  • Update README with mobile PWA description, capabilities table, quick-start commands, API endpoint documentation, optional helper tools, and updated project tree including new files.
  • Extend tests to cover ExtendedNetworkMonitor behaviour, including structure of get_all_layers, cellular/ModemManager parsing (including generation mapping), GNSS constellation mapping, and satellite provider fields.
  • Add a [Mobile] section to config.ini for host/port defaults; add flask>=3.0.0 to requirements; and introduce run_mobile.sh / run_mobile.bat launchers that activate venv, set NZM_HOST/NZM_PORT, and start api_server.py.
README.md
test_networkzero.py
config.ini
requirements.txt
run_mobile.sh
run_mobile.bat

Tips and commands

Interacting with Sourcery

  • Trigger a new review: Comment @sourcery-ai review on the pull request.
  • Continue discussions: Reply directly to Sourcery's review comments.
  • Generate a GitHub issue from a review comment: Ask Sourcery to create an
    issue from a review comment by replying to it. You can also reply to a
    review comment with @sourcery-ai issue to create an issue from it.
  • Generate a pull request title: Write @sourcery-ai anywhere in the pull
    request title to generate a title at any time. You can also comment
    @sourcery-ai title on the pull request to (re-)generate the title at any time.
  • Generate a pull request summary: Write @sourcery-ai summary anywhere in
    the pull request body to generate a PR summary at any time exactly where you
    want it. You can also comment @sourcery-ai summary on the pull request to
    (re-)generate the summary at any time.
  • Generate reviewer's guide: Comment @sourcery-ai guide on the pull
    request to (re-)generate the reviewer's guide at any time.
  • Resolve all Sourcery comments: Comment @sourcery-ai resolve on the
    pull request to resolve all Sourcery comments. Useful if you've already
    addressed all the comments and don't want to see them anymore.
  • Dismiss all Sourcery reviews: Comment @sourcery-ai dismiss on the pull
    request to dismiss all existing Sourcery reviews. Especially useful if you
    want to start fresh with a new review - don't forget to comment
    @sourcery-ai review to trigger a new review!

Customizing Your Experience

Access your dashboard to:

  • Enable or disable review features such as the Sourcery-generated pull request
    summary, the reviewer's guide, and others.
  • Change the review language.
  • Add, remove or edit custom review instructions.
  • Adjust other review settings.

Getting Help

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants