Industries / logistics
Where are the rules?
The logistics and supply chain industry moves physical goods, but it is entirely steered by digital rules. Determining dimensional weight pricing, applying dynamic fuel surcharges, enforcing hazardous materials (hazmat) constraints, and navigating cross-border customs are all governed by strict operational logic.
However, as global supply chains have grown more complex, the systems managing them have become increasingly rigid. Today, the critical business rules of major logistics providers are often trapped deep within legacy Transportation Management Systems (TMS), Warehouse Management Systems (WMS), and fragmented ERP platforms.
In an industry where margins are razor-thin and speed is everything, burying decision logic inside opaque application code creates a massive operational bottleneck. When a new carrier tariff takes months to implement, or a warehouse compliance rule cannot be easily audited, the supply chain loses its agility. This article examines embedded business logic in logistics: unit translation risk, execution at the network edge, and how an open-source, mathematically precise approach to rule management can restore speed and visibility to global supply chains.
The friction of embedded logic
In logistics, rules change constantly. A carrier introduces a new peak-season surcharge. A regulatory body updates the storage requirements for lithium-ion batteries. A new trade agreement alters the duty calculation for cross-border freight.
When these rules are hardcoded into a TMS or WMS, the business cannot react independently. A pricing analyst or compliance officer must submit a ticket to the IT department. Developers must then translate that business requirement into code, often navigating decades of technical debt to find where the old rule was buried.
This process introduces severe friction. It creates a reality where the commercial strategy of a logistics firm moves faster than its IT infrastructure can support. If implementing a new tiered discount for a high-volume shipper takes six weeks of development and testing, the company risks losing the contract to a more agile competitor.
The danger of unit translation
Logistics is a domain of physical realities. Rules do not just deal with abstract numbers; they deal with specific, physical units: kilograms, pounds, cubic meters, pallets, and multiple currencies.
When operational rules are translated into general-purpose programming languages like Java or Python,
the explicit meaning of these units is often lost. A variable simply becomes a float or an integer. It
is entirely up to the developer to remember whether the variable weight
represents pounds
or kilograms.
This creates a high risk for catastrophic downstream errors. If a warehouse system calculates a load based on kilograms but the routing system interprets that number as pounds, trucks are loaded inefficiently, weight limits are breached, and physical safety is compromised. Standard software struggles to natively enforce these physical constraints.
Explainability at the border
When a shipment is flagged by customs, delayed at a port, or rejected by a carrier, the logistics provider must be able to explain exactly why.
If the logic governing that shipment is hidden inside a black-box application, providing an explanation is a forensic nightmare. The operations team knows the system rejected the hazmat load, but they cannot easily see the specific regulatory threshold that was triggered. They are forced to rely on vague error codes or ask developers to trace system logs.
In a highly regulated environment, "computer says no" is not an acceptable answer for a delayed container or a miscalculated customs duty. The business needs instant, deterministic proof of how the rules were applied to that specific shipment.
Speed at the edge
Logistics cannot wait for cloud latency. When a worker scans a barcode on a forklift, or an automated sorter routes a package on a conveyor belt, the business rules governing that action must execute in milliseconds.
Traditional Business Rules Engines (BREs) are often monolithic and require heavy network calls to centralized servers. If the warehouse loses internet connectivity, or the network is slow, operations grind to a halt. Supply chain rules need to be governable centrally, but executable locally at the absolute edge of the network.
Lemma for operational rules
To reclaim agility and precision, logistics enterprises must separate their operational logic from their core WMS and TMS codebases. Lemma provides the ideal open-source, declarative language to achieve this.
Lemma is architected for the physical and operational demands of the supply chain:
Native physical units
Lemma's rich type system allows you to define exact physical scales. You can write rules explicitly
using kilograms, meters, and eur. The engine enforces these constraints natively, ensuring a
dimension meant to be in centimeters is never accidentally processed as inches.
Microsecond edge execution
Written in Rust and compilable to WebAssembly (WASM), Lemma is incredibly lightweight. The rules can be embedded directly into handheld scanners, IoT edge devices, or local warehouse servers. They execute deterministically in microseconds, without requiring a round-trip to the cloud.
Instant explainability
When a shipment is routed a certain way or a specific surcharge is applied, Lemma outputs the exact, step-by-step reasoning. If a customs broker asks why a tariff was calculated, the exact logic is instantly available.
LemmaBase scales this capability globally. It acts as the central control tower for your organisation's logic. A logistics provider can publish its global pricing tariffs, hazmat rules, and carrier constraints in LemmaBase. Those rules are then distributed to the lightweight Lemma execution engines running in warehouses, trucks, and sorting facilities worldwide, ensuring total global compliance without hardcoding logic in a dozen different systems.
Lemma
Unit-aware, explainable rules with WASM and native embed for millisecond decisions at the edge.
Read the docsLemmaBase
Control tower to publish tariffs, hazmat rules, and carrier constraints across the network.
About LemmaBaseA resilient supply chain
A modern supply chain is only as agile as the logic that governs it. When critical pricing, routing, and compliance rules are locked inside massive, opaque applications, logistics providers lose the flexibility needed to navigate a volatile global market.
By adopting a deterministic, unit-aware approach to rules as code, the logistics sector can narrow the translation gap. Lemma expresses operational rules that are mathematically exact, readable by compliance officers, and fast enough to run on a forklift scanner. LemmaBase distributes and governs them across warehouses and carriers.
In an industry defined by precision and speed, moving your logic out of the black box is the key to a truly resilient supply chain.