Case study · Edge-to-cloud IoT telematics

From GPS dots on a map to who is driving, how, and the footage to prove it.

A production IoT platform for commercial fleets that pairs in-vehicle edge vision with a cloud event backbone - verifying the driver biometrically at ignition, isolating collision footage automatically, and streaming a cabin camera on demand without leaving a video link open.

Commercial fleet · telematics
Edge ADAS / DMS · biometrics
Kafka · Protobuf · mTLS
On-demand WebRTC evidence

Every figure below is a build fact verified by the engineering team - we do not publish invented performance percentages for this engagement.

How every event becomes evidence

Something happens in the cabHarsh brake · lane departure · eyes off road · unknown face
The edge decides, on-deviceADAS / DMS inference · cabin warning · clip window marked
geofence
notify
data
video
profile
Persistent mTLS ingress → Kafka, Protobuf frames · sync handshake on reconnect
Evidence lands and is retainedClip to S3 · record to MongoDB · one alert to the dispatcher

As builtVerified

0

Architecture tiers, edge device to identity provider

0

Core microservices on the event backbone

0

Storage tiers behind every evidence clip

0%

Telemetry or video loss under erratic 4G/5G

The client

A commercial fleet technology operator running connected vehicles across long-haul, last-mile and passenger transport. Identity withheld at their request.

The challenge

Telematics answered where the vehicle is and nothing about who was driving, how, or what happened - and the footage was gone before anyone asked.

What we built

An edge-to-cloud platform: on-device ADAS/DMS inference, biometric driver verification, automatic evidence capture, and video on demand.

The outcome

Every incident now produces a clip, a position, a timestamp and a verified driver - the four things an insurer actually asks for.

01 The client

A fleet is not a set of coordinates. It is people, cargo and liability.

Their existing telematics answered one question well - where is the vehicle - and left the expensive ones to phone calls and paperwork.

Two consumers, one platform
In the moment

The dispatcher and the driver

  • Need an alert while the vehicle is still moving, not a nightly report
  • Need to see the cab, on demand, to confirm a driver is alert
  • Need the cabin warning to fire at the edge, with no round trip to the cloud
  • Act on a signal, not a dashboard
After the fact

Compliance, insurance and the fleet manager

  • Need footage of the incident itself, not the minute either side of it
  • Need the record to be tamper-resistant and time-anchored
  • Need behaviour aggregated into a scorecard a driver can be coached against
  • Defend a claim with evidence, not recollection
The core question

Every incident asks the same thing twice: what happened, and who was at the wheel when it did? Legacy telematics can answer neither from the record it keeps - which is why the answer had to be produced at the edge, in the moment, and shipped somewhere durable before the vehicle reached the next cell tower.

02 The challenge

The hard part was never the tracking. It was the evidence.

Six problems, each cheap to describe and expensive to solve, all of them sitting between a moving vehicle on a patchy cellular link and a record somebody has to stand behind.

Blind to the driver

A vehicle can be tracked perfectly while being operated by someone who was never authorised to touch it. Sub-contracting, key sharing and shift swaps are invisible to GPS.

Blind to the behaviour

Drowsiness, eyes off road, phone use and a deliberately blocked camera are the leading indicators of the incident. None of them appear in a position feed.

Evidence expires

The footage that matters is the eight seconds around impact. On a rolling partition it is overwritten long before anybody thinks to ask for it.

The link is unreliable by nature

Vehicles drive through tunnels, dead zones and border crossings. Any design that assumes connectivity at the moment of the incident loses exactly the events it exists to capture.

Always-on video is unaffordable

Streaming continuously from two cameras per vehicle burns cellular data at a rate no fleet will fund, and most of it is footage nobody will ever open.

Storage grows without a ceiling

Every alert wants a clip. Overlapping requests duplicate the same footage, and nothing prunes itself, so cloud spend climbs with vehicle count and never comes back down.

Why it mattered

A fleet's real exposure is not fuel or routing - it is a liability claim it cannot answer. Every one of the six problems above ends in the same place: an incident where the operator has a timestamp and the other party has a story.

03 The mandate

Three non-negotiables, fixed before a line of code.

Each one is a constraint on the architecture rather than a feature on a roadmap - which is why they are stated as absolutes.

Non-negotiable · 01

Zero loss, offline by default

The vehicle is the source of truth and the network is optional. Every event and every clip must survive a total loss of connectivity and arrive intact when the link returns.

Non-negotiable · 02

Identity, not just position

The platform must establish who is operating the vehicle at ignition and refuse to treat an unverified face as an authorised driver.

Non-negotiable · 03

Video on demand, never idling

A live channel exists only while a dispatcher is watching it. No standing tunnel, no long-lived credential, no billable stream left open by accident.

The decision that shaped everything

Push the judgement to the edge and the durability to the cloud. Inference, cabin warning and clip selection happen on-device so they work with no network at all; correlation, retention and access control happen in the cloud where they can be governed.

A gated path from prototype to production fleet
P1

Edge contract

Fixed the device-to-cloud contract first - Protobuf schemas, mTLS identity and the reconnection handshake - so nothing downstream depended on a wire format still in flux.

P2

Event backbone

Stood up Kafka and split the consumers into five single-responsibility services, so a traffic spike in one could not reach the others.

P3

Evidence pipeline

Built the alert-to-video routine with its storage fallbacks and the local transactional buffer, then tested it by removing the network mid-extraction.

P4

Identity & live video

Added biometric verification against the authorised-driver registry, geofencing, and the on-demand WebRTC tunnel with short-lived credentials and automatic teardown.

Scope discipline as a safety feature

The platform detects, records and reports. It does not intervene in the vehicle - no braking, no speed limiting, no remote immobilisation. Keeping actuation out of scope is what allows the detection path to be aggressive about flagging, because a false positive costs a review rather than a stopped truck.

04 The solution

Ignition goes in. A verified driver, a behaviour record and retrievable footage come out.

One vehicle-hour produces a stream of decisions taken on-device and a matching set of records assembled in the cloud. The split between the two columns below is the architecture.

What a single vehicle-hour answers
Decided at the edge, without the network
  • Is the face at the wheel in the authorised registry?
  • Is the driver drowsy, distracted, or on a phone?
  • Has the cabin camera been obstructed?
  • Is a pedestrian or lane departure a collision risk right now?
  • Does this impact warrant preserving a clip?
  • If storage or network fails, where does the clip go instead?
Assembled and retained in the cloud
  • The driver-verification verdict, with the captured face on a mismatch
  • The geofence state and every boundary crossing
  • The event clip, deduplicated against footage already stored
  • The trip record and the aggregated driver scorecard
  • The dispatcher alert, routed by severity
  • A retention clock, so the record prunes itself on policy
Watch an incident become evidence

The run on the right replays a single harsh-braking event.

The decision happens before the upload. The edge agent classifies the impact and marks the window it needs; nothing is shipped speculatively.

Storage failure is an expected branch, not an error. When the event partition reports a write-lock, extraction falls through to the rolling partition without blocking.

Losing the network delays the clip; it never loses it. The extraction task is queued in a local transactional buffer and retried with exponential backoff.

It ends in a durable record. The clip lands in S3, the event lands in MongoDB, and the dispatcher gets one notification rather than five.

edge agent · event trace · unit TU-•••• · link: 4G degraded

08:41:12 imu harsh_brake detected Δv -8.4 m/s 08:41:12 adas forward_collision_warning → cabin chime 08:41:12 clip window marked t-6s → t+4s 08:41:13 store read event_partition ... 08:41:13 store fallback → normal_partition (non-blocking) 08:41:14 store extracted 10.0s / 3.1 MB ok 08:41:14 uplink tcp/tls session ... 08:41:14 buffer queued sqlite tx #4471 retry in 2s 08:41:31 buffer retry 4/8 backoff 16s 08:43:07 uplink carrier restored mTLS handshake verified 08:43:07 uplink sync handshake replay 1 clip + 38 telemetry frames 08:43:09 kafka published vehicle.event.harsh_brake (protobuf, 214 B) 08:43:09 video s3 put dedupe: no existing asset for window 08:43:10 data mongo upsert trip 8812 · scorecard +1 harsh_brake 08:43:10 notify dispatcher alert sent 1 of 1 complete

Illustrative trace with representative values. In the delivered platform every line is produced by the running system.

05 Architecture

Six tiers, one rule: ingress, async processing and command routing never share a failure.

A layered microservices architecture that deliberately decouples the three kinds of traffic - devices pushing telemetry in, events fanning out to consumers, and dispatchers issuing synchronous commands back down to a vehicle.

1Edge & IoT device tierin-vehicle
Smart IoT telematics unitGPS · IMU · dual camera (road + cabin) · DMS inference
Local SQLite / flash bufferOffline cache · transactional queue · exponential backoff retry
Event + rolling partitionsDedicated high-speed event store, with a circular normal-record fallback
mutual TLS (mTLS) · lightweight Protobuf framing · sync handshake on reconnection
2Gateway & ingress tierstateful
TCP/TLS gatewayPersistent device connections · client-side certificate verification · session registry in Redis
publish telemetry events
3Asynchronous messaging backbonedecoupling layer
Apache Kafka event stream brokerProtobuf-serialised payloads · absorbs regional traffic spikes so no consumer can degrade another
consumer events × 5
4Core microservices tierNestJS
geofence-serviceBoundary calculations · breach events
notification-serviceEvent alert triggers · severity routing
data-apiAlerts, trips & operations · REST surface
video-serviceWebRTC live · VOD uploads · dedupe
profile-serviceUser, fleet & biometric registry
upload video · stream signalling · verify identity
5Enterprise data & storage tierstate
RedisGateway sessions & hot lookups
AWS S3Media & thumbnails · reference-aware dedupe
MongoDBStructured records · trips, alerts, scorecards
6Cloud & identity providersAWS
Kinesis Video Streams + STSWebRTC signalling channel · short-lived credentials
Cognito / OIDCIdentity & access authorisation for operators
solid — synchronous command pathdashed — asynchronous event path
Why the tiers are separated this way

The gateway holds thousands of long-lived sockets and must never block on business logic. Kafka absorbs the burst. The five services scale on their own load curves. A rush-hour spike in road events therefore shows up as consumer lag on one topic - not as a slow dashboard, and never as a dropped event.

The life of an event, tier by tier
Step 01

Sensed and classified

IMU, GPS and the two cameras feed on-device inference. ADAS scores the road scene, DMS scores the driver. A cabin warning fires locally, with no cloud round trip.

Step 02

Marked for evidence

If the event crosses the severity threshold, the agent marks a clip window and requests an atomic extraction from the dedicated event partition.

Step 03

Extracted, or fallen back

On a write-lock or sector timeout the agent switches to a non-blocking read of the circular normal partition rather than failing the capture.

Step 04

Buffered if offline

With no carrier, the extraction task is written to a local transactional SQLite queue and retried with exponential backoff until the link returns.

Step 05

Authenticated at ingress

The device re-establishes a persistent TCP/TLS session with client-certificate verification, then replays everything the buffer holds through the sync handshake.

Step 06

Published to the backbone

Telemetry and event frames are published to Kafka as Protobuf, keeping the network footprint compact and the schema strict across every consumer.

Step 07

Fanned out to five services

Geofence, notification, data, video and profile each consume independently. One slow consumer delays its own topic and nothing else.

Step 08

Persisted and pruned

The clip lands in S3 behind a dedupe check, the record lands in MongoDB, and a retention policy is attached so the artefact expires on schedule rather than forever.

06 Inside the build

The decisions that made the evidence trustworthy.

Connecting a camera to a cloud bucket is straightforward. The engineering that makes a fleet platform hold up under a claim lives in six deliberate choices - each one as built.

A Ingestion

Every device proves who it is before it says anything.

Devices hold a persistent TCP/TLS connection to the ingress layer and authenticate with client-side certificate verification - mutual TLS, not a shared password or a rotating API key. A unit that cannot present a valid certificate never reaches the broker.

Because the session is long-lived, reconnection is the interesting case rather than connection. A sync handshake runs on every reconnect, so the gateway and the device agree on what the device still owes before any new telemetry is accepted.

Why mTLS over a token

A stolen credential should not be a fleet-wide event

A per-device certificate scopes compromise to one vehicle and makes revocation a gateway operation rather than a firmware rollout. Password-based IoT authentication has neither property.

B Serialisation

Protobuf on the wire, because cellular data is the running cost.

Telemetry payloads are packaged as Protocol Buffers end to end - device to gateway, gateway to Kafka, Kafka to every consumer. That buys three things at once: an ultra-compact network footprint on a metered link, high-speed serialisation on constrained edge hardware, and a strict structural schema that every service is held to.

The schema is the contract. A consumer cannot quietly start accepting a differently-shaped event, which is what keeps five independent services honest about the same event stream.

// vehicle.event - the shape every consumer is held to
message VehicleEvent {
  string unit_id    = 1;   // device identity, cert-bound
  uint64 ts_ms      = 2;   // edge clock, monotonic
  EventType type    = 3;   // ADAS | DMS | IMU | GEOFENCE
  Severity severity = 4;
  GeoPoint position = 5;
  optional ClipRef clip = 6;  // set when evidence exists
}
C Decoupling

Kafka in the middle, so a storm cannot reach the dashboard.

Anchoring the platform on an event stream broker means the five microservices are entirely decoupled from ingestion and from each other. A regional storm or a rush-hour peak produces a massive influx of road events - and it lands as consumer lag on a topic, not as an unresponsive UI and not as data loss.

It also makes the consumer set open-ended. Adding a sixth service is a subscription, not a change to the gateway.

01
AbsorbThe broker takes the spike at wire speed
02
Fan outFive consumers read independently
03
Catch upA slow consumer drains its own lag
04
ExtendA new service subscribes; nothing upstream changes
D Evidence capture

Three storage tiers, because the disk is as unreliable as the network.

Guaranteeing that footage survives means assuming the flash controller will fail at exactly the wrong moment. When an ADAS or DMS event flags a critical alert, the agent attempts an atomic extraction from the dedicated high-speed event partition. If the controller reports write-locks or sector timeouts, it falls back to a non-blocking read of the circular normal-storage rolling partition.

If connectivity is gone entirely, the extraction task itself is queued in a local transactional SQLite buffer with exponential backoff - so the loss window is bounded by the buffer, not by the cellular link.

Tier 1 · atomic

Event partition

Dedicated, high-speed, written for exactly this purpose.

Tier 2 · non-blocking

Rolling partition

The circular normal-record stream, read without waiting on the lock.

Tier 3 · durable

Local transactional buffer

SQLite queue with exponential backoff retry. Zero telemetry or video loss under erratic 4G/5G.

E Live video

A tunnel that does not exist until somebody looks, and closes when they stop.

Authorised dispatchers can open a real-time, low-latency stream from either the cabin or the road-facing camera. To protect cellular bandwidth the connection stays dormant until it is requested: the platform commands the device to spin up a secure, temporary cloud tunnel only on demand.

Signalling uses AWS STS to mint short-lived credentials and establish a Kinesis Video signalling channel for WebRTC playback. The moment the dispatcher closes the stream, the device teardown routine fires and the tunnel is gone.

01
DormantNo standing video connection on any vehicle
02
RequestDispatcher asks; command routed down to the unit
03
Short-lived credsSTS issues scoped, expiring credentials
04
SignalKinesis Video channel established, WebRTC plays
05
TeardownStream closed → tunnel torn down instantly
F Storage economics

Deduplicated on the way in, pruned on the way out.

Reference-aware deduplication. Multiple requests for overlapping event footage resolve to a single S3 asset rather than several near-identical copies, which removes a whole class of redundant cloud storage billing.

Automated data lifecycles. Configurable retention tasks systematically prune outdated telemetry logs and media against corporate policy - so compliance and cloud spend are both predictable instead of both growing.

The point

Evidence platforms fail commercially before they fail technically. Storage that only ever grows is a platform with an expiry date - so dedupe and lifecycle policy were built in from the first upload, not retrofitted after the first invoice.

07 Authorization & gates

Success is a verified driver inside an approved boundary - not a vehicle that moved.

Biometric verification is where the platform stops being a tracker and starts being a control. It runs at ignition, before the trip record exists.

Edge-to-cloud matching. On ignition the cabin DMS camera captures a face vector and streams it securely to the cloud, where similarity algorithms run it against the authorised driver registry held by the profile service.

Dynamic access control. If an unauthorised driver attempts to operate the vehicle, an alert is published across the broker immediately. If the face is unrecognised rather than rejected, the platform commands the edge device to upload a high-resolution photo for manual administrative review by dispatch.

Geofencing, blended in. Boundary calculations run alongside verification, so the platform can assert both halves of the compliance question at once: the right person, inside the approved area.

profile-service · ignition verification · unit TU-••••

05:58:02 dms ignition → face vector captured (128-d) 05:58:02 uplink mTLS session verified vector sent 05:58:03 profile registry match ... 05:58:03 verdict - not the same as unauthorised 05:58:03 command device → upload high-res still for review 05:58:05 video s3 put still/ignition/8814.jpg 05:58:05 kafka published vehicle.auth.unrecognised_driver 05:58:05 notify dispatch review queued human decides

Unrecognised routes to a person. Only a positive registry mismatch raises an unauthorised-driver alert.

The gates that can halt or escalate a trip
GateTriggerOutcomeWhy it exists
Device identityClient certificate absent or invalid at ingressConnection refused; nothing enters the brokerAn unverified unit must not be able to write to the fleet record
Driver mismatchFace vector matches no authorised driverAlert published; high-res still uploaded for reviewUnrecognised is a question for a human, not a verdict
Unauthorised operationVerified face is not authorised for this vehicleImmediate alert across the broker to dispatchKey sharing and sub-contracting are invisible to GPS
Geofence breachVehicle leaves an approved boundaryBreach event; dispatcher notified with positionRoute adherence is the control for high-risk cargo
Camera obstructionDMS reports the cabin lens blocked or coveredCabin warning at the edge; event recordedA blinded camera would otherwise read as a clean shift
Evidence extraction failureBoth storage partitions unreadableTask retained in the local buffer and retriedA capture is never silently dropped
Refusing to answer is part of the product

The distinction between unrecognised and unauthorised is deliberate. A platform that collapses the two either locks out legitimate relief drivers or waves through people it never identified. Routing the ambiguous case to a person with a photograph attached is the only version of this that a fleet will actually keep switched on.

08 Infrastructure

Engineered as a production service, not a pilot with a dashboard.

Cloud-native, event-driven microservices with fault tolerance, retry and resilient processing pipelines - so the platform stays up through the conditions that produce its most valuable data.

Before — GPS-era telematics

A position feed and a phone call

  • Where the vehicle is; nothing about who is driving it
  • Behaviour inferred from speed traces, after the trip
  • Footage overwritten before anyone requests it
  • Events lost whenever the vehicle lost signal
  • Live video too expensive to leave available
  • Liability defended with recollection
After — the delivered platform

A verified record, per vehicle-hour

  • Driver identity established biometrically at ignition
  • Behaviour classified on-device, in the moment, with a cabin warning
  • Impact footage isolated automatically and stored durably
  • Nothing lost offline - buffered locally and replayed on reconnect
  • Live video on demand only, torn down on close
  • Liability defended with the clip and the timestamp
State, media and identity, separated by concern

MongoDB

Holds: alerts, trips, geofence definitions, driver scorecards and the biometric registry metadata.

Why: event and trip documents vary in shape by device generation and event type - a flexible document model absorbs that without a migration per firmware release.

Amazon S3

Holds: event clips, VOD uploads, ignition stills and thumbnails.

Why: cheap, durable object storage that reference-aware dedupe and lifecycle policy can both act on, so evidence is retained deliberately rather than indefinitely.

Redis

Holds: gateway session state for persistent device connections and hot lookups on the command path.

Why: a dispatcher command has to find the right open socket in milliseconds; that lookup does not belong in the primary datastore.

Kinesis Video + Cognito

Holds: the WebRTC signalling channel, STS short-lived credentials, and operator identity.

Why: the live-video path needs credentials that expire on their own, so a leaked token cannot become a standing window into a cab.

Separation of concerns

Ingress, event transport, business logic, structured state, media and identity each scale and fail on their own. That is what makes the platform's high-availability claim testable rather than aspirational: you can take one tier away and name exactly what degrades.

09 Outcomes

What shipped, and what it changes.

The figures below are as-delivered build facts, verified by the engineering team. We deliberately do not publish performance percentages for an anonymised engagement - so the impact is described as what changed in the work, not as an invented number.

As built · verified
The delivered platform, in countable facts

0

Architecture tiers, edge device to identity provider

0

Core microservices, each independently deployable

0

Storage tiers behind every evidence clip

0

Automated gates that can halt or escalate a trip

0

Camera feeds per vehicle, streamable on demand

Before and after, in the operator's terms
Before — GPS-era telematicsAfter — the delivered platform
Driver identity taken on trust from the rosterDriver verified biometrically against the authorised registry at ignition
Risky behaviour surfaced days later, if at allDrowsiness, distraction, phone use and camera blockage flagged in-cab as they happen
Collision footage lost to the rolling bufferImpact clips isolated automatically and uploaded to durable storage
Events dropped whenever the vehicle lost signalBuffered in a local transactional queue and replayed on reconnect
Live video either always on and unaffordable, or unavailableOn-demand WebRTC tunnel with short-lived credentials and automatic teardown
Insurance disputes settled on recollection and paperworkDisputes settled with the clip, the position and the verified driver
Cloud storage growing with every alert, foreverReference-aware dedupe plus policy-driven retention
Risk moved earlier

The warning now fires in the cab, at the moment of the behaviour, rather than arriving as a line in next week's report. Coaching has something specific to point at.

Liability became defensible

An incident produces a clip, a position, a timestamp and a verified driver identity - the four things an insurer or an investigator actually asks for.

Cost became predictable

Dormant video links, deduplicated media and automated retention mean the platform's running cost tracks fleet size rather than compounding with it.

10 What's next

Built to take new intelligence without touching the vehicle.

The modular microservices boundary and the containerised over-the-air update layer were designed for the same reason: the useful thing to change over a platform's life is the model, not the hardware.

The roadmap
  • New edge models, over the air. Seatbelt compliance, smoking in the cabin, or any new DMS class deploys through the containerised OTA layer with no vehicle hardware replaced.
  • New device types. The modular service boundary means an additional sensor or unit generation is a new producer on an existing topic.
  • Deeper scorecards. Aggregated telemetry already feeds driver safety scoring; the next step is route- and shift-aware baselines rather than fleet-wide averages.
  • Measured outcomes. Once the fleet is fully live, incident-rate and claim-turnaround metrics turn today's qualitative gains into verified figures.
The reusable pattern

This generalises.

An edge tier that decides locally, a certificate-bound ingress, a broker that absorbs bursts, and a storage strategy that both deduplicates and expires - that shape transfers to any estate of connected assets that has to produce a defensible record from an unreliable link.

Connected vehicles
Industrial & plant telemetry
Cold-chain logistics
Remote asset monitoring
Any evidence-bearing sensor estate
Enterprise use cases the platform was validated against

Hazardous materials transport

Application: absolute route adherence and driver-alertness verification.

Value: geofencing alerts fire the moment a high-risk vehicle deviates from its approved lane, and live DMS streaming lets dispatchers confirm alertness during long-haul night transits.

Last-mile delivery fleets

Application: high-density urban route monitoring and driver safety coaching.

Value: localised infractions such as phone use and distracted driving feed straight into safety scorecards, so managers can optimise routes and curb high-risk behaviour with evidence.

Public transport & ride-hailing

Application: driver compliance and rapid insurance turnaround.

Value: biometric validation prevents unverified or sub-contracted operators taking the wheel, and automated uploads provide the proof that settles a dispute quickly.

The stack, end to end
EDGEIoT telematics unit
DMSDriver monitoring
ADASRoad-scene inference
mTLSTCP/TLS gateway
PBProtocol Buffers
KFKApache Kafka
NESTNestJS services
MDBMongoDB
RDSRedis
S3Amazon S3
KVSKinesis Video + STS
SQLSQLite edge buffer
IAMCognito / OIDC
OTAContainerised updates

Have an asset estate that reports position but cannot prove anything?

We design and ship production-grade IoT and agentic platforms for high-stakes operations - edge decisions that work offline, cloud records that hold up under scrutiny.