Skip to content

SCS Gateway Implemented Features

Last updated: 2026-06-02

This page summarizes the implemented gateway, camera, NVR, client portal, and Cloudflare server features for the SCS Smart City stack.

Deployment

SurfaceValue
Portalhttps://scs.itms.solutions
APIhttps://scsapi.itms.solutions
Worker configapps/worker/wrangler.scs.toml
Pages projectscs-itms-web
Latest verified Worker versiona55c41a1-6688-4f9a-a066-6b9a39e98829
Latest verified Pages previewhttps://3323a896.scs-itms-web.pages.dev

Portal Structure

Sensor Management now separates gateway-class devices from field devices:

  • Gateways
  • Cameras
  • NVRs
  • Field Devices
  • Register Gateway
  • Health Monitor

Implemented routes:

  • /dashboard/gateways
  • /dashboard/gateways/new
  • /dashboard/gateways/:id
  • /dashboard/cameras
  • /dashboard/cameras/:id
  • /dashboard/nvrs
  • /dashboard/nvrs/:id

Gateway, camera, and NVR inventory uses the existing backend model:

  • Gateways are EDGE_CONTROLLER sensors.
  • Cameras are CAMERA sensors.
  • NVRs are NVR sensors.
  • Child relationships use Sensor.parentSensorId.

Pinned navigation is stored locally with localStorage key scs:pinned-navigation:v1.

Metrics And Storage

  • Go gateway agent sends telemetry to Worker ingest.
  • Gateway offline queue/history uses local SQLite.
  • Worker stores gateway, camera, and NVR samples in D1 metric tables.
  • VictoriaMetrics forwarding is removed from the active product path.
  • /api/v1/metrics/export remains as an authenticated Prometheus-compatible diagnostics export backed by D1.

Security

  • Operator-facing inventory, health, status, metrics, map, storage, reporting, and command reads require authenticated sessions.
  • Device tRPC writes require X-API-Key.
  • Device credentials support hashed lookup, lazy plaintext backfill, revoked-key rejection, and target scope checks.
  • Parent gateway keys can ingest for linked child devices through Sensor.parentSensorId.
  • Optional signed tRPC device requests use X-Signature, X-Timestamp, X-Nonce, and X-Body-SHA256.
  • DeviceRequestNonce rejects replayed signed requests.

Command Lifecycle

  • Worker command flow supports create, list, get, readiness, approve, reject, cancel, polling, and ACK/result endpoints.
  • Command lifecycle covers queued, approval, dispatched, running, success, failed, timeout, and cancelled states.
  • Active cancellation supports PENDING, PENDING_APPROVAL, DISPATCHED, and RUNNING.
  • Late device ACKs cannot overwrite a cancelled command.
  • Audit records capture lifecycle, actor, previous status, reason, object path, operation, and metadata.

Gateway Commands

Shared command metadata is centralized in @smart-city/shared and generated into gateway-agent/internal/agent/command_registry_gen.go.

Implemented read-only diagnostics:

  • get_ip_config
  • get_dns_config
  • get_ntp_status
  • get_temperature
  • get_process_status
  • run_diagnostics
  • run_traceroute
  • get_update_status

Gateway update paths exist for check, download, install, rollback, and status flows.

Camera And NVR

Camera command coverage includes probe, profiles, stream URI, imaging reads/options, event reads, PTZ status/move, services/time, and reboot paths.

NVR support includes:

  • First-class portal routes and sidebar pinning.
  • D1-backed NVRMetrics.
  • get_recording_jobs
  • search_recordings
  • get_replay_uri
  • export_recording_clip

export_recording_clip uploads bounded video clips as command artifacts instead of embedding binary data in command results.

Command history details render returned artifacts with Open and Download actions. Video or NVR clip artifacts also render an inline browser player backed by the tokenized artifact URL.

Artifact Storage

  • Worker supports command artifact upload and tokenized download paths.
  • R2 stores large command artifacts such as logs and NVR clip exports.
  • Command results return SCS artifact metadata.
  • Remote artifact smoke verified signed upload, tokenized fetch, checksum match, R2 deletion, post-delete 404, and cleanup of temporary D1 rows.

SCS Smart City - Traffic, Gateway, Camera, and NVR Platform