FlutterJuly 05, 2026•8 MIN READ

Taming Courier Fragmentation: Link Parsing & Unified Shipment State in Parcella

How Parcella normalizes pasted SMS tracking links and raw tracking numbers across six Turkish couriers into a single five-stage status pipeline.

Ehsan Taghavi
Ehsan Taghavi
@EhsanTgv
Case Study: Parcellaarrow_outward
bolt

Key Engineering Takeaways

  • 01.A deterministic URL & regex parser detects the courier and extracts the tracking ID from messy SMS copy-pastes in a single step.
  • 02.Six disparate carrier status vocabularies map into a canonical 5-stage state machine (`processing`, `on_the_way`, `at_branch`, `delivered`, `returned`).
  • 03.On the web, a typed bilingual dictionary (`Record<PcLang, PcCopy>`) powers instant Turkish/English switching with zero duplicated JSX.

The Turkish E-Commerce Tracking Problem

Online shopping in Turkey has a unique fragmentation headache: a single order batch from Trendyol or Hepsiburada can easily ship across four different logistics providers—Trendyol Express, Yurtiçi Kargo, PTT, Sürat Kargo, Aras Kargo, or Kolay Gelsin. Each carrier sends its own SMS link with its own URL structure and status terminology.

Parcella was designed around a zero-friction input model: paste whatever SMS link or tracking number you received, and the app figures out the rest.

Deterministic Link Parsing Over Fragile Heuristics

When a user pastes a string from their clipboard into Parcella’s "Add Package" sheet, we run it through a prioritized chain of courier matchers. First, we parse the hostname and query/path segments if the input contains a URL; if it is a raw alphanumeric code, we match against carrier-specific prefix and checksum patterns and pre-select the likeliest carrier.

lib/domain/tracking_link_parser.dartdart
sealed class ParsedTrackingInput {}

class ResolvedShipment extends ParsedTrackingInput {
  const ResolvedShipment({required this.courier, required this.trackingNumber});
  final CourierId courier;
  final String trackingNumber;
}

ParsedTrackingInput? parseClipboardInput(String raw) {
  final trimmed = raw.trim();
  final uri = Uri.tryParse(trimmed);

  if (uri != null && uri.hasScheme) {
    for (final rule in courierUrlRules) {
      final match = rule.tryExtract(uri);
      if (match != null) {
        return ResolvedShipment(courier: rule.courier, trackingNumber: match);
      }
    }
  }
  return matchRawTrackingNumber(trimmed);
}

One Canonical 5-Stage Shipment Pipeline

Every courier reports checkpoints differently—one carrier emits 14 granular hub scan codes while another only reports three coarse states. If you expose raw carrier strings directly in the list view, the inbox becomes visual noise.

Parcella normalizes every carrier adapter’s output into five canonical states: `Processing`, `On the Way`, `At Delivery Branch`, `Delivered`, and `Returned`. Push notifications fire only when a package transitions across one of those canonical boundaries (for example, entering `At Delivery Branch` or `Out for Delivery`), keeping alerts high-signal and actionable.

BILINGUAL ARCHITECTURE

Both the Flutter app and the `/projects/Parcella` marketing site treat Turkish as the primary experience with first-class English support. On the web, every component reads from a strongly typed `Record<PcLang, PcCopy>` dictionary so switching between TR and EN is instantaneous and type-checked at build time.

Featured Product in This Article

Parcella

Universal package tracker for Turkish online shoppers supporting Trendyol Express, Yurtiçi Kargo, PTT, Sürat Kargo, and more.

Explore Parcellaarrow_forward

Want to build something like this?

Let's talk about mobile architecture, Flutter, or native Android/iOS engineering.

mail