Skip to content
All work

> SELECT * FROM case_studies WHERE project = 'tracking-platform';

Tracking & Schedules Platform

One real-time API over 24 shipping carriers and truck and cold-chain IoT trackers: collected on demand, normalised, cached and monitored end to end.

My role
Designed and built it end to end (1,412 of 1,421 commits)
Company
Freshtrack · 2026
Stack
Python · FastAPI · Playwright · SQLite
Runs on
Docker Compose behind Nginx

coverage

  • Maersk
  • MSC
  • CMA CGM
  • Hapag-Lloyd
  • ONE
  • COSCO
  • Evergreen
  • HMM
  • Yang Ming
  • ZIM
  • OOCL
  • Wan Hai
  • PIL
  • X-Press Feeders
  • SITC
  • KMTC
  • Grimaldi
  • Arkas
  • Tailwind
  • BOLUDA
  • Samskip
  • WEC Lines
  • Akkon
  • China United Lines
  • + 3 IoT tracker providers

The source code is private, so this page shows what the platform does and the numbers from its own load-test reports. The feed on the right is a simulation modelled on the real monitoring console.

/monitor/live simulated
  1. GET /api/schedules CNSHA→MAPTM 11 ms
  2. CALL Hapag-Lloyd · schedules 2.4 s
  3. SSE slot · ONE 3.1 s
  4. GET /v2/events (DCSA) 46 ms
  5. IOT cold-chain tracker 0.9 s
  6. GET /api/track MSCU······· 1.8 s

01 · The problem

24 carriers, 24 ways to say “loaded”.

Freshtrack’s customers need to know when ships sail, where their containers are and how the cargo is doing inside the truck. Every carrier publishes that differently: public APIs, logged-in web apps or fixed catalogues, each with its own codes, time formats, limits and failure modes. Some answer in milliseconds, others in a minute.

The goal was one API that answers fast when it can, never hangs when it can’t, speaks one event language and explains itself when a carrier fails.

02 · Architecture

Collect, normalise, cache, serve, watch.

Request path

  1. 24 carriers + IoT trackers APIs · websites · devices
  2. Collectors HTTP · warm browser sessions
  3. Normalise one event language · DCSA
  4. Cache & guards 8 h results · bounded waits
  5. FastAPI REST · SSE stream · DCSA
  6. Monitor every request & carrier call

Each carrier has its own collector: an HTTP client where the carrier has an API, a warm browser session where it only has a website. Their answers are normalised into one event language with canonical meanings, and exposed both in the service’s own format and as DCSA-standard objects.

A cache sits in front of every carrier and an admission gate in front of every live fan-out. FastAPI serves REST, Server-Sent Events for progressive results and DCSA routing. A telemetry layer records every exchange for the monitoring console, and canary checks send email alerts when a carrier or the service degrades.

03 · What it serves

Schedules, containers, trucks, vessels.

Sailing schedules

  • Search any lane across carriers in parallel
  • Results stream in carrier by carrier over Server-Sent Events, with a polling fallback
  • DCSA point-to-point routing, port autocomplete and carrier coverage
  • Ready-made Python and JavaScript clients

Container tracking

  • Preferred carrier with automatic fallback to the right one
  • Every extracted event gets a canonical meaning; nothing is dropped for a missing timezone or seconds
  • DCSA-standard event objects alongside the service’s own format
  • ISO 6346 check-digit validation of container numbers

Truck & cold-chain IoT trackers

  • Three tracker providers behind one endpoint
  • Temperature, humidity, light, shock and tilt, battery and location track
  • Thresholds, alarm history and trip-wide alert counts
  • Up to 60 days of history per device

Vessels & costs

  • Vessel position, voyage and particulars by IMO or name
  • Scheduled vessel sync for current orders
  • Demurrage calculator and lane tariffs

04 · Performance

Measured under load.

Load-tested in a container capped at 4 CPUs and 8 GB with 17 carriers active: about 700 test searches, 35,000 status polls and per-second resource sampling.

scenariopathresult
Same popular lane, 50 / 100 / 300 usersCache hits100% / 100% / 99.7% served in 3–5 s
50–100 different warm lanesMixed hits100% / 84% served
50–100 brand-new lanes at onceLive carrier fan-outBounded: finished lanes return, the rest get a clean retry signal
DCSA endpointCachedunder 0.1 s
62/s
searches served on a popular lane
4–25×
faster warm than cold
27%
peak RAM of an 8 GB cap
8
live fan-outs at once; the rest get Retry-After

Cache-hit latency stays flat whatever the number of users. Only brand-new lanes cost real time, and that time is spent waiting on carrier websites. With 1,000 users on different new lanes, 8 run at once and the rest get an instant “busy, retry in 15 s”: no hanging, no crash.

05 · Monitoring

Every exchange, recorded.

A built-in console shows what the service received, what it asked each carrier, what came back and how long every step took. Selecting a run shows the request, each step and every carrier call in order. Looking up a container shows every request that named it, each carrier’s outcome, what is cached and whether its check digit is valid.

Overview Totals, outcomes over time, the slowest 5%, recent events
Live Requests in progress with their current step, carrier calls awaiting an answer, queue depths
Endpoints Calls, success, failures and latency per route, carrier host or carrier
Requests & carrier calls Searchable log with headers, bodies and timing for each exchange
Events Health changes, admin actions and lookup steps
Data Database size, retention and write health

Almost free to record

Requests only append to a queue; one writer thread batches inserts into SQLite. That costs about 35 µs per inbound request and 0.1 ms per carrier call. Under pressure, bodies are skipped first and rows dropped next, and the overview says so.

Private by design

Authorization and cookie values are never stored, header values are kept only from an allow-list, secret-looking fields are masked and HTML is reduced to its visible text.

06 · Reliability

Fails fast, recovers on its own.

Every wait has a bound

An admission gate caps live fan-outs, every fetch and job has a deadline, and identical submissions reuse one job instead of starting another.

Warm sessions

Sessions, logins and city indexes are set up once and reused, so nobody pays the launch and validation cost twice: 40 s → 10 s on repeat searches through browser-based carriers.

Polite to carriers

Per-carrier pacing and back-off when a carrier rate-limits bursts, plus per-client API rate limits with JWT or cookie authentication.

Watched around the clock

Canary checks run in the background and email alerts fire when the service or one of its dependencies degrades.

what load testing found

A rush of brand-new lanes froze the service. A crash dump traced it to a lock in the cache; after the fix, the same rush completed 50 of 50, and a unit test keeps it fixed. The same campaign found two broken carrier integrations (one carrier had changed its authentication, another failed on multi-word port names), both repaired, and a repeat-search path that relaunched a browser every time (now reused: 40 s → 10 s).

2,000+ test functions · per-search JSON logs · 2-second resource samples

  • Python
  • FastAPI
  • Pydantic
  • Playwright
  • curl_cffi
  • SSE
  • SQLite
  • Docker Compose
  • Nginx
Next case study FIREBRIDGE · NASA Space Apps 2026