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
| Surface | Value |
|---|---|
| Portal | https://scs.itms.solutions |
| API | https://scsapi.itms.solutions |
| Worker config | apps/worker/wrangler.scs.toml |
| Pages project | scs-itms-web |
| Latest verified Worker version | a55c41a1-6688-4f9a-a066-6b9a39e98829 |
| Latest verified Pages preview | https://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_CONTROLLERsensors. - Cameras are
CAMERAsensors. - NVRs are
NVRsensors. - 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/exportremains 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, andX-Body-SHA256. DeviceRequestNoncerejects 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, andRUNNING. - 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_configget_dns_configget_ntp_statusget_temperatureget_process_statusrun_diagnosticsrun_tracerouteget_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_jobssearch_recordingsget_replay_uriexport_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.