HomeCase studiesCross-Platform Commercial Fleet Management and Telematics Compliance...

Case study · Calgary, Canada

Cross-Platform Commercial Fleet Management and Telematics Compliance Platform Built with Flutter, Node.js, and PostgreSQL

Commercial Fleet Telematics & Compliance

Regional and long-haul trucking carriers operating across Western Canada often wrestle with disconnected GPS pucks, paper pre-trip inspection binders, and brittle spreadsheets that fail during roadside audits. We engineered a unified fleet management system pairing an offline-capable Flutter driver app with a Node.js ingestion pipeline, an operational web console, and a PostgreSQL-TimescaleDB telemetry store. The platform normalizes high-frequency J1939 engine diagnostics alongside Canadian Hours of Service rules, giving safety officers and dispatchers real-time visibility across cellular dead zones.

Industry
Commercial Fleet Telematics & Compliance
Solution
A cross-platform fleet telematics, electronic logging, and dispatch platform combining a Flutter driver mobile app, Node.js MQTT/REST ingestion services, PostgreSQL time-series storage, and a React dispatch console.
Platforms
Cross-platform · Web & API
Stack
Flutter · Node.js · PostgreSQL · TimescaleDB · MQTT · Redis
Location
Calgary, Canada · delivered remotely
Role
Engineering, with the team behind for mobile and QA

Delivered remotely for a business based in Calgary, Canada. Names withheld by agreement.

Project Overview

Commercial carriers hauling freight across Alberta and British Columbia navigate mountain and prairie highways where cellular coverage drops unexpectedly and winter cold tests cab hardware. Previously, mid-sized operators stitched together legacy GPS portals, separate electronic logging devices (ELDs), and paper Driver Vehicle Inspection Reports (DVIRs) in cab clipboards. Safety managers caught expired certifications weeks late, while dispatchers phoned drivers repeatedly to confirm remaining driving hours before assigning backhaul loads.

Designed around fleet operations headquartered in Calgary, we engineered a unified fleet management system built on Flutter, Node.js, and PostgreSQL. The platform bridges in-cab J1939 telematics hardware, a cross-platform driver mobile application, and a browser-based dispatch and compliance command center into a single auditable source of truth.

Operational Bottlenecks in Mixed-Hardware Fleets

Consolidating commercial trucking operations exposed four recurring engineering friction points across legacy tooling:

  • Fragmented device protocols: Mixed tractor and reefer fleets carried different OBD-II and J1939 cellular gateways emitting incompatible binary and JSON payloads, forcing dispatchers to juggle multiple vendor dashboards.
  • Unreliable dead-zone logging: Mobile apps built as thin web wrappers dropped duty-status changes and DVIR inspection photos whenever drivers crossed mountain passes without LTE signal.
  • Database write contention: Naive relational schemas that appended every 10-second GPS ping into a single unpartitioned table degraded dispatcher map queries and nightly compliance exports simultaneously.
  • Audit trail gaps: Manual edits to driver logs or missing co-driver handoff signatures created compliance exposure during Transport Canada safety audits.

Architectural Strategy

Rather than building isolated silos for telematics, safety compliance, and dispatch, we designed an event-normalized telemetry core inside Node.js backed by PostgreSQL with TimescaleDB and PostGIS extensions. Hardware gateways and the Flutter mobile client act as decoupled producers feeding canonical domain events—coordinate updates, engine fault codes (SPN/FMI), reefer temperature readings, and signed HOS duty changes—into a single validation pipeline.

For the driver experience, we rejected online-only forms in favor of an offline-first local ledger inside Flutter. Drivers authenticate once per shift, record pre-trip inspections, pair tractors with trailers via QR scan or Bluetooth gateway handshake, and transition HOS duty statuses regardless of signal strength. Every local mutation carries a monotonic sequence number and client timestamp, allowing Node.js to reconstruct exact timelines without conflict once LTE resumes.

Core Capabilities

  • Normalized J1939 & Reefer Telemetry: Ingests ignition state, engine hours, fuel burn, DEF levels, diagnostic trouble codes, and multi-zone refrigerated trailer temperatures across heterogeneous cab hardware.
  • Canadian HOS & ELD Rule Engine: Tracks driving, on-duty, sleeper-berth splits, and Cycle 1 / Cycle 2 resets with proactive cab warnings before violations occur.
  • Digital DVIR & Defect Workflows: Guides drivers through vehicle-class inspection checklists with mandatory photo capture for flagged defects, automatically notifying shop coordinators and locking unsafe units from dispatch.
  • PostGIS Geofencing & Corridor Alerts: Evaluates yard entries, customer dock dwell times, border-crossing delays, and unauthorized off-route movement in real time.
  • Dispatcher Live Command Map: Clusters thousands of active tractors in React, displaying live HOS remaining clocks alongside trailer temperature telemetry and assigned trip milestones.

Technical Architecture

Hardware telematics units maintain persistent TLS-encrypted MQTT sessions with a Mosquitto broker cluster, while the Flutter app communicates over HTTPS and WebSockets with stateless Node.js API pods. Node.js stream workers deserialize vendor-specific frames into canonical telemetry schemas, evaluate PostGIS geofences against cached yard polygons, push live positions into Redis Pub/Sub for active browser sockets, and batch-insert raw telemetry into TimescaleDB hypertables.

Flow: Cab J1939 Gateways & Flutter App → Mosquitto MQTT / HTTPS Gateway → Node.js Telemetry Normalizer & HOS Validator → Redis Live State & Pub/Sub + PostgreSQL / TimescaleDB / PostGIS → React Dispatch & Safety Portal

Separating hot-state queries (latest coordinates, active duty status, online socket state) into Redis keeps live dispatch maps snappy without hitting disk-backed historical chunks, while PostgreSQL remains the durable system of record for compliance audits, billing exports, and trip histories.

Technology Stack

Category Technology detail
Driver Mobile App Flutter cross-platform iOS and Android client for DVIR checklists, HOS clocks, and offline sync
Ingestion & API Tier Node.js TypeScript services terminating MQTT device streams and REST/WebSocket client traffic
Relational & Time-Series DB PostgreSQL with TimescaleDB hypertables storing vehicle registries, HOS logs, and GPS telemetry
Spatial Indexing PostGIS evaluating yard geofences, highway corridor alerts, and border-crossing triggers
Device Broker Mosquitto MQTT cluster receiving TLS-authenticated J1939/OBD-II payloads from cab gateways
Stream State & Cache Redis holding latest unit coordinates, active geofence memberships, and WebSocket pub/sub channels
Dispatch Web Console React SPA rendering live fleet maps, HOS violation warnings, and route assignment boards
Document Archive S3-compatible object storage retaining signed DVIR photos, roadside inspection PDFs, and fuel receipts
Container Runtime Dockerized microservices behind an NGINX reverse proxy with automated zero-downtime rollouts

Engineering Trade-offs & Solutions

Engineering Challenge Solution & Trade-off
High-frequency GPS and CAN-bus pings bloat standard PostgreSQL B-tree indexes Adopted TimescaleDB time-partitioned hypertables with automated compression after 14 days and retention policies, trading slightly higher schema migration care for predictable insert throughput.
Offline mobile edits conflict when dispatchers adjust trip assignments concurrently Implemented an append-only event log in Flutter SQLite with server-side idempotency keys and explicit HOS edit-approval workflows, trading instant silent overwrites for strict auditability.
Maintaining separate native iOS and Android driver apps doubles QA effort on ruggedized cab tablets Standardized on Flutter with native platform channels solely for Bluetooth Low Energy gateway pairing, accepting minor native bridge maintenance for unified UI and HOS logic.
Noisy GPS coordinates near depot walls trigger false yard arrival and departure events Added speed-gated spatial hysteresis and multi-ping confirmation inside Node.js geofence evaluators, trading a brief entry detection delay for clean dock-dwell timestamps.

Security & Audit Integrity

Electronic logging and safety records carry legal weight during roadside inspections and insurance reviews. Every cab gateway authenticates via mutual TLS with per-device X.509 certificates, and Mosquitto enforces strict topic ACLs preventing cross-tenant telemetry injection. Inside PostgreSQL, HOS duty logs are append-only: corrections by safety officers generate linked amendment records requiring explicit driver co-signature inside Flutter before taking effect, preserving the original immutable entry.

API endpoints enforce role-based access control scoped by fleet tenant and terminal group, while sensitive driver license metadata and inspection attachments reside encrypted at rest with pre-signed, short-lived download URLs for audit exports.

Ingestion Throughput & Query Resilience

Telemetry traffic peaks sharply at morning shift starts when hundreds of tractors power on simultaneously, flush buffered overnight positions, and submit pre-trip inspections. Node.js ingestion workers use bounded internal queues and bulk COPY / multi-row inserts into TimescaleDB so bursts absorb smoothly without exhausting PostgreSQL connection pools.

TimescaleDB continuous aggregates precompute daily mileage by jurisdiction (supporting IFTA fuel-tax reporting), idle-time ratios, and harsh-braking summaries incrementally in the background. Dispatchers opening multi-month safety scorecards receive pre-aggregated metrics in milliseconds without scanning raw 10-second coordinate history.

Operational Outcomes

Unifying cab telemetry, compliance workflows, and dispatch coordination reshaped daily fleet oversight:

  • Audit-ready compliance continuity: Safety teams review unbroken digital HOS timelines and photo-verified DVIR histories from one console instead of reconciling cab paperwork weeks late.
  • Zero lost dead-zone telemetry: Offline-first Flutter storage preserves every duty transition, defect note, and fuel receipt across remote corridors until cellular handoff completes.
  • Proactive mechanical triage: Real-time J1939 fault alerts and inspection defect locks reach shop leads before minor coolant or brake issues escalate into highway breakdowns.
  • Faster dispatch matching: Planners pair available tractors and remaining legal driving hours directly on live corridor maps without interrupting drivers on the road.

01 — Questions

asked about this kind of project

How does the Flutter driver app record Hours of Service and DVIRs in northern highway dead zones?

All duty-status transitions, odometer readings, and pre-trip defect photos write first to an encrypted local SQLite queue on the device. When cellular connectivity returns, the Flutter background isolate flushes signed chronological events to Node.js using idempotency keys so reconnections never duplicate log segments.

Why pair PostgreSQL with TimescaleDB instead of maintaining a separate NoSQL database for GPS pings?

Using TimescaleDB hypertables inside PostgreSQL allows dispatchers to join recent telemetry bursts directly against transactional driver assignments, trailer pairings, and compliance rules in one SQL query without maintaining dual-write synchronization pipelines.

How do you prevent noisy GPS drift from flooding geofence arrival alerts while trucks idle in yards?

Node.js ingestion workers apply speed gating, HDOP accuracy thresholds, and consecutive-sample hysteresis before updating Redis geofence state. Stationary jitter inside a depot perimeter never fires spurious departure or arrival notifications.

How are cab telematics gateways authenticated against the MQTT broker?

Each hardware gateway provisions with a unique X.509 client certificate bound to its VIN and tenant workspace. Mosquitto enforces topic-level ACLs so compromised credentials cannot publish telemetry into another fleet's namespace or spoof another tractor.

What happens during a roadside Transport Canada ELD inspection if connectivity is poor?

The Flutter client maintains a rolling 14-day local compliance ledger and renders a deterministic inspection summary screen offline, while also supporting one-tap local transfer bundles when cellular data is available.

03 — Similar project?

describe what is different about yours

Build yours.

Tell me what exists, what you need and the deadline. Fixed price for a defined scope, or $55/day (8–9 hours work) with a written plan first.

Solitaire Corporate Park, Makarba, Ahmedabad, Gujarat 380015, India · IST (UTC+5:30) · --:-- IST · Mon–Fri 09:00–18:00 IST · US & EU overlap daily

No newsletter, no CRM. Just a reply.