Building a Universal Logistics Graph

Building a Universal Logistics Graph

●2 ●37 ●92
calendar_today • schedule13 min read

Modern life is built on movement.

A package moves from a warehouse to a distribution center.

A truck moves inventory from a supplier to a retailer.

A customer moves through a delivery process without seeing the hundreds of decisions happening behind the scenes.

A shipment crosses borders.

A container changes vehicles.

A product moves from a factory to a warehouse, from a warehouse to a store, and from a store to someone's home.

We usually represent these processes as lists.

Orders.

Shipments.

Tracking numbers.

Invoices.

Addresses.

Vehicles.

Warehouses.

Drivers.

Delivery events.

But logistics is not really a list.

Logistics is a graph.

Every shipment is connected to something.

A package belongs to an order.

An order contains products.

Those products originate from suppliers.

A shipment travels through locations.

Locations are connected by routes.

Routes depend on vehicles.

Vehicles are operated by people or organizations.

A delivery creates an event.

An event changes the state of an object.

An object may then trigger another process.

Once we see logistics this way, an interesting engineering problem appears:

What if we built one universal graph capable of representing the relationships between everything involved in moving goods, documents, resources, and people through a logistics system?

That is the idea behind a Universal Logistics Graph.

It is not simply another tracking dashboard.

It is not just a database for shipments.

It is a computational model of movement.

And the interesting part is that the same architecture can support e-commerce, manufacturing, retail, agriculture, transportation, warehousing, field operations, procurement, and many other systems.


The Problem With Traditional Logistics Software

Many logistics systems are organized around individual applications.

One system manages orders.

Another manages warehouses.

Another manages transportation.

Another manages inventory.

Another handles invoices.

Another manages customers.

Another handles tracking.

Each system may work perfectly well on its own.

The problem appears at the boundaries.

Imagine this sequence:

A customer places an order.

The order contains three products.

One product is available locally.

Another must come from a regional warehouse.

The third is still being manufactured.

The system therefore creates multiple fulfillment operations.

One warehouse prepares a package.

A supplier prepares another.

A manufacturing facility schedules production.

Several packages eventually converge into a delivery process.

A traditional system may represent these as separate records.

A graph represents them as connected entities.

That difference is important.

Instead of asking:

"Where is shipment #18492?"

we can ask:

"What is the current state of everything connected to shipment #18492?"

That could include:

  • its order,
  • its customer,
  • its products,
  • its warehouse,
  • its previous locations,
  • its current location,
  • its assigned vehicle,
  • its delivery route,
  • its dependencies,
  • its customs documents,
  • its inventory reservations,
  • its expected next event,
  • and other connected shipments.

The graph turns isolated records into context.


What Is a Logistics Graph?

At its simplest, a graph contains:

Nodes + edges + properties + events.

A node represents something.

An edge represents a relationship.

A property describes an entity.

An event describes something that happened.

For example:

Customer
   |
places
   ↓
Order
   |
contains
   ↓
Product
   |
stored_at
   ↓
Warehouse
   |
dispatched_by
   ↓
Vehicle
   |
travels
   ↓
Route
   |
arrives_at
   ↓
Delivery Location

This structure is powerful because logistics is naturally relational.

The graph can contain different types of nodes:

Customer
Supplier
Manufacturer
Product
SKU
Order
Shipment
Package
Warehouse
Store
Vehicle
Driver
Route
Location
Container
Invoice
Document
Delivery
Event

Edges can describe relationships:

CONTAINS
BELONGS_TO
STORED_AT
SHIPPED_FROM
SHIPPED_TO
ASSIGNED_TO
OPERATED_BY
TRAVELS_THROUGH
DEPENDS_ON
FULFILLS
GENERATED_BY
REQUIRES
DELIVERED_TO

Now the system has a language for logistics.


The Core Architecture

A Universal Logistics Graph can be designed as several layers.

                ┌──────────────────────┐
                │     Applications     │
                └──────────┬───────────┘
                           │
                ┌──────────▼───────────┐
                │   Query / API Layer  │
                └──────────┬───────────┘
                           │
                ┌──────────▼───────────┐
                │  Logistics Graph     │
                │                      │
                │ Nodes + Relationships│
                └──────────┬───────────┘
                           │
              ┌────────────┼────────────┐
              │            │            │
        ┌─────▼─────┐ ┌────▼────┐ ┌────▼────┐
        │ Event Bus  │ │ Storage │ │ Rules   │
        └───────────┘ └─────────┘ └─────────┘

The graph becomes the central representation.

Applications interact with the graph rather than independently rebuilding their own understanding of logistics.


1. The Entity Layer

The first layer defines what exists.

Consider a shipment.

{
  "id": "shipment_18492",
  "type": "shipment",
  "status": "in_transit"
}

A warehouse might look like:

{
  "id": "warehouse_102",
  "type": "warehouse",
  "capacity": 12000
}

A vehicle:

{
  "id": "vehicle_77",
  "type": "truck",
  "capacity": 1800
}

But entities alone are not enough.

The important information is how they connect.


2. The Relationship Layer

Relationships become first-class objects.

For example:

shipment_18492
      |
assigned_to
      |
vehicle_77

Or:

shipment_18492
      |
origin
      |
warehouse_102

A relationship can have properties too.

{
  "from": "shipment_18492",
  "to": "vehicle_77",
  "type": "assigned_to",
  "assigned_at": "2026-09-21T08:00:00Z"
}

This matters because relationships often contain valuable information.

A vehicle may have been assigned to a shipment at a particular time.

A shipment may have passed through a location.

A product may have been allocated to an order.

A warehouse may have reserved inventory for a fulfillment operation.

The relationship itself has history.


3. The Event Layer

A logistics graph should not only represent the current state.

It should understand how that state happened.

Consider:

Shipment Created
       ↓
Package Prepared
       ↓
Warehouse Dispatched
       ↓
Vehicle Assigned
       ↓
Checkpoint Reached
       ↓
Destination Arrived
       ↓
Delivered

Each event becomes part of the graph.

For example:

{
  "id": "event_991",
  "type": "shipment_dispatched",
  "entity": "shipment_18492",
  "location": "warehouse_102",
  "timestamp": "2026-09-21T09:12:00Z"
}

Now the system can reconstruct the history.

This creates a temporal dimension.

The graph is no longer simply:

What is connected to what?

It becomes:

What was connected to what, when, where, and because of which event?

That is a much more useful model.


The Graph Should Understand Time

Logistics is deeply temporal.

A shipment has a current location.

But it also has previous locations.

A vehicle has a current assignment.

But it had previous assignments.

Inventory has a current quantity.

But quantities changed because of events.

Therefore, relationships should be time-aware.

Instead of:

Shipment → Warehouse

we can represent:

Shipment
   |
   ├── Warehouse A [08:00–10:00]
   |
   ├── Truck 17    [10:20–15:40]
   |
   └── Warehouse B [16:00–17:30]

This enables historical queries.

For example:

Where was this shipment yesterday?

Which vehicle carried it?

Which facilities handled it?

How long did it spend at each facility?

The graph becomes a logistics timeline.


Building the Physical Network

The next major challenge is representing geography.

A logistics system is a physical network.

Locations are not merely addresses.

They are nodes in a transportation topology.

Factory
   |
   ↓
Distribution Center
   |
   ├──── Route A ──── Store
   |
   └──── Route B ──── Regional Warehouse

A location node might contain:

{
  "id": "loc_55",
  "type": "warehouse",
  "country": "Zambia",
  "city": "Ndola"
}

Routes connect locations.

{
  "from": "loc_55",
  "to": "loc_77",
  "type": "route",
  "distance_km": 320
}

The graph can then represent an entire transportation network.


Logistics Is a Multi-Graph Problem

One of the most interesting aspects of this project is that there is not just one graph.

There are several graphs overlapping each other.

Physical graph

Where things physically move.

Factory → Warehouse → Store

Ownership graph

Who owns what.

Supplier → Product → Customer

Transaction graph

What commercial operations created movement.

Customer → Order → Payment → Fulfillment

Inventory graph

Where resources are stored.

Warehouse → Inventory → SKU

Dependency graph

What depends on what.

Product → Component → Supplier

Event graph

What happened and when.

Order → Event → Shipment → Event → Delivery

The Universal Logistics Graph combines these dimensions.

That is where the architecture becomes interesting.


A Unified Data Model

A practical graph schema might begin with:

Entity
 ├── id
 ├── type
 ├── attributes
 ├── created_at
 └── updated_at

Relationships:

Relationship
 ├── id
 ├── source_id
 ├── target_id
 ├── type
 ├── attributes
 ├── valid_from
 └── valid_until

Events:

Event
 ├── id
 ├── type
 ├── entity_id
 ├── location_id
 ├── timestamp
 ├── metadata
 └── source

This provides a generic foundation.

Instead of building a special database structure for every logistics scenario, the graph can accommodate new entity types and relationships.


The Universal Event Model

One of the most useful design decisions is standardizing events.

Instead of every subsystem producing different formats:

shipment.updated
package.moved
truck.arrived
warehouse.received
delivery.completed

we can normalize events around a common structure.

{
  "event_id": "evt_1001",
  "event_type": "entity.moved",
  "entity_id": "package_90",
  "source": "warehouse_system",
  "timestamp": "2026-09-21T10:30:00Z",
  "location": "warehouse_10",
  "metadata": {}
}

Now multiple systems can feed the graph.

A warehouse management system can publish events.

A transportation system can publish events.

A mobile application can publish events.

An IoT device can publish events.

The graph consumes them.


Ingestion Architecture

Real logistics systems produce data from many sources.

For example:

ERP
 │
 ├── Orders
 │
WMS
 │
 ├── Inventory
 │
TMS
 │
 ├── Transportation
 │
Mobile Apps
 │
 ├── Driver Events
 │
IoT
 │
 ├── Sensor Events
 │
External APIs
 │
 └── Tracking

A normalization layer sits between those systems and the graph.

External Systems
       ↓
   Connectors
       ↓
Event Normalizer
       ↓
Validation
       ↓
Event Bus
       ↓
Graph Processor
       ↓
Universal Logistics Graph

This prevents every integration from directly modifying the graph.


Event Processing

A message broker can handle incoming events.

For example:

Kafka
RabbitMQ
NATS
Redis Streams

The architecture might be:

Producer
   ↓
Message Broker
   ↓
Normalizer
   ↓
Validator
   ↓
Graph Writer
   ↓
Projection Builder

The graph writer updates relationships.

The projection builder creates optimized views for applications.

This separation is important because the graph is optimized for relationships, while dashboards may require different query patterns.


Graph Database or Relational Database?

The obvious question is:

Do we actually need a graph database?

Not necessarily.

A Universal Logistics Graph can be implemented using different storage strategies.

A graph database such as Neo4j can make relationship traversal natural.

A relational database can represent graphs using:

entities
relationships
events

A document database can store flexible entities.

A hybrid architecture can use multiple stores.

For example:

PostgreSQL
    ↓
Canonical entities

Kafka
    ↓
Event stream

Neo4j
    ↓
Relationship graph

Redis
    ↓
Hot state / caching

Object Storage
    ↓
Documents and historical data

The important idea is not the database product.

The important idea is the graph model.


Querying the Logistics Graph

Once the graph exists, interesting queries become possible.

Imagine asking:

Show everything connected to Order 10092.

The graph might return:

Order
 ├── Customer
 ├── Product A
 │    └── Warehouse 1
 ├── Product B
 │    └── Supplier 4
 ├── Shipment 1
 │    └── Vehicle 8
 └── Shipment 2
      └── Vehicle 11

Another query:

Which shipments depend on Warehouse 4?

Or:

Which orders contain products currently located in transit?

Or:

Which deliveries depend on a particular vehicle?

The graph turns complicated questions into traversals.


Pathfinding

A logistics graph naturally supports pathfinding.

Suppose a package must travel from:

Warehouse A

to:

Customer B

The graph contains:

Warehouse A
      ↓
Distribution Center
      ↓
Regional Hub
      ↓
Local Facility
      ↓
Customer B

The system can evaluate possible paths.

But pathfinding should not only minimize distance.

A route could be evaluated using multiple constraints:

cost
distance
time
capacity
availability
risk
vehicle compatibility
facility availability
delivery windows

A generalized route cost function could look like:

Cost =
    distance_weight × distance
  + time_weight × travel_time
  + handling_weight × handling_cost
  + delay_weight × expected_delay

This transforms the graph from a passive database into a decision-support engine.


Detecting Bottlenecks

One of the most valuable capabilities is identifying highly connected infrastructure.

Imagine:

Factory A
      \
       → Hub X → Warehouse Y
      /
Factory B

If many routes depend on Hub X, then Hub X becomes structurally important.

The graph can calculate:

  • incoming connections,
  • outgoing connections,
  • dependent shipments,
  • dependent orders,
  • dependent facilities,
  • historical throughput,
  • average processing time.

This makes bottlenecks visible as graph structures rather than isolated metrics.


Dependency Propagation

Consider a supplier responsible for a critical component.

The graph might look like:

Supplier
   ↓
Component
   ↓
Product
   ↓
Order
   ↓
Customer

If the component becomes unavailable, the impact can propagate through the graph.

The system can identify:

Affected products
Affected orders
Affected warehouses
Affected fulfillment operations
Affected routes

This is a powerful concept:

impact analysis.

Instead of discovering consequences after they happen, software can trace dependencies before executing an operation.


Inventory as a Graph

Inventory is often treated as a number.

For example:

SKU-100 = 250 units

But inventory is more interesting when represented relationally.

SKU
 |
 ├── Warehouse A → 100
 ├── Warehouse B → 75
 ├── Vehicle 22   → 25
 └── Store C      → 50

Now inventory becomes spatial and relational.

The system can ask:

Where is all inventory for this SKU?

Or:

Which orders can be fulfilled from inventory within a particular region?

Or:

Which inventory is already reserved?

The graph connects inventory to demand.


Building a Logistics Digital Twin

At a larger scale, the Universal Logistics Graph can become a digital twin of the logistics environment.

The graph represents:

Facilities
Vehicles
Products
Orders
Inventory
Routes
Shipments
People
Events
Dependencies

The real world produces events.

Those events update the digital representation.

REAL WORLD
    ↓
Events
    ↓
LOGISTICS GRAPH
    ↓
Analysis
    ↓
Decisions
    ↓
Operational Actions

This creates a feedback loop.


Predictive Capabilities

Once enough historical events exist, machine-learning models can operate on top of the graph.

For example:

Graph
  ↓
Historical Events
  ↓
Feature Extraction
  ↓
ML Model
  ↓
Prediction

Predictions could include:

  • estimated arrival times,
  • expected processing times,
  • demand patterns,
  • inventory requirements,
  • route congestion,
  • facility workload,
  • potential delays.

Graph-based machine learning can also use relationships as features.

A product's behavior may depend not only on the product itself but also on:

  • supplier,
  • warehouse,
  • region,
  • season,
  • route,
  • customer segment.

The graph provides that context.


Graph Algorithms

A Universal Logistics Graph opens the door to classic graph algorithms.

Shortest paths

Find efficient routes between locations.

Connected components

Identify isolated or disconnected parts of the network.

Centrality

Identify highly connected facilities or infrastructure.

Community detection

Identify clusters of operational activity.

Dependency traversal

Determine what depends on a specific entity.

Temporal traversal

Understand how relationships evolved over time.

Flow analysis

Understand movement through a network.

The interesting part is that these algorithms operate on the same underlying model.


The API

A universal logistics system needs a clean API.

For example:

POST /entities
POST /relationships
POST /events
GET /entities/:id
GET /entities/:id/neighbors
GET /entities/:id/history
GET /shipments/:id/path
GET /orders/:id/network
GET /locations/:id/dependencies

A graph query endpoint could expose more advanced operations:

POST /graph/query

With:

{
  "start": "shipment_18492",
  "relationship": "depends_on",
  "depth": 4
}

The API becomes a universal interface over logistics relationships.


Designing for Idempotency

Logistics systems often receive duplicate events.

A scanner might send an event twice.

A mobile application might retry.

A network connection might reconnect.

Therefore:

event_id

should be globally unique.

The system can maintain an idempotency record:

event_id → processed

If the same event arrives again, the graph does not duplicate the operation.

This small architectural decision can prevent enormous amounts of inconsistency.


Handling Conflicting Data

Different systems may disagree.

One system says:

Shipment = delivered

Another says:

Shipment = in_transit

The graph should not simply overwrite one value with another.

Instead, preserve the evidence.

Source A
  status = delivered

Source B
  status = in_transit

Timestamp
Source priority
Confidence

Then a resolution engine can determine the current operational state according to explicit rules.

This keeps the underlying history intact.


Observability

A logistics graph should also observe itself.

Every important operation should produce telemetry.

Graph Query
   ↓
Latency
   ↓
Database
   ↓
Cache
   ↓
External Dependency

Metrics might include:

events_processed
events_failed
graph_updates
query_latency
traversal_depth
relationship_count
stale_entities
duplicate_events

Tracing can reveal why a query became slow.

Logging can explain how a particular state was produced.

Observability becomes part of the graph architecture rather than an afterthought.


Security

A universal graph can contain sensitive operational information.

Therefore, access control should exist at multiple levels.

A user may be allowed to see:

orders

but not:

supplier contracts

Another user may see:

vehicle locations

but not:

customer information

This suggests graph-aware authorization.

Permissions can be associated with:

entity types
relationships
organizations
locations
operations

The API becomes responsible for enforcing these boundaries.


Building It Incrementally

The biggest mistake would be attempting to model every possible logistics entity immediately.

Start small.

Version 1

Build:

Order
Shipment
Package
Location
Event

Support:

created
assigned
moved
arrived
delivered

Then add:

Version 2

Warehouse
Vehicle
Route
Inventory

Then:

Version 3

Supplier
Product
Purchase Order
Container
Document

Then:

Version 4

Add:

prediction
optimization
simulation
analytics

The graph grows with the system.


A Minimal Implementation

A simple relational implementation could start with:

CREATE TABLE entities (
    id UUID PRIMARY KEY,
    type VARCHAR(100) NOT NULL,
    data JSONB,
    created_at TIMESTAMP NOT NULL,
    updated_at TIMESTAMP NOT NULL
);

Relationships:

CREATE TABLE relationships (
    id UUID PRIMARY KEY,
    source_id UUID NOT NULL,
    target_id UUID NOT NULL,
    type VARCHAR(100) NOT NULL,
    data JSONB,
    valid_from TIMESTAMP,
    valid_until TIMESTAMP
);

Events:

CREATE TABLE events (
    id UUID PRIMARY KEY,
    entity_id UUID NOT NULL,
    type VARCHAR(100) NOT NULL,
    location_id UUID,
    occurred_at TIMESTAMP NOT NULL,
    data JSONB
);

Indexes become critical:

CREATE INDEX idx_relationship_source
ON relationships(source_id);

CREATE INDEX idx_relationship_target
ON relationships(target_id);

CREATE INDEX idx_events_entity
ON events(entity_id);

CREATE INDEX idx_events_time
ON events(occurred_at);

That is already enough to build a surprisingly capable logistics graph.


The Graph Is More Than a Database

This is where the project becomes interesting.

A Universal Logistics Graph should not be thought of as merely:

"A database containing logistics records."

It is better understood as:

A computational model of how logistics exists and changes.

That distinction matters.

A database stores information.

A graph can expose relationships.

An event system can explain change.

A rules engine can interpret state.

A prediction engine can estimate future states.

An optimization engine can evaluate possible actions.

Together, they form something much larger.


The Future of the Architecture

Imagine opening a logistics application.

Instead of seeing hundreds of unrelated tables, you see a living network.

                    Supplier
                       │
                       ▼
                   Product
                       │
                       ▼
                     Order
                    /     \
                   /       \
             Shipment A   Shipment B
                 │             │
                 ▼             ▼
              Truck A       Truck B
                 │             │
                 ▼             ▼
             Warehouse      Hub
                   \          /
                    \        /
                     ▼      ▼
                     Customer

Every node can be inspected.

Every relationship can be traversed.

Every event can be replayed.

Every dependency can be analyzed.

Every movement can be understood in context.

This is where logistics software starts feeling less like a collection of CRUD applications and more like an operating system for movement.


The Real Engineering Challenge

The difficult part is not creating nodes.

It is creating a consistent language for relationships.

What does "moved" mean?

What does "assigned" mean?

When does a shipment become "delivered"?

How do we represent partial deliveries?

How do we represent split shipments?

How do we represent returns?

How do we represent inventory transfers?

How do we represent cancelled operations?

How do we represent temporary relationships?

How do we represent uncertainty?

These questions define the quality of the architecture.

The graph schema is therefore not just a database design.

It is a model of the real world.

And real-world modeling is one of the hardest parts of software engineering.


Conclusion

We often build logistics software around objects.

Orders.

Shipments.

Vehicles.

Warehouses.

Products.

But logistics itself is not organized around objects.

It is organized around relationships and movement.

A product is connected to an order.

An order is connected to a customer.

A shipment is connected to a route.

A route is connected to locations.

A vehicle is connected to a shipment.

A warehouse is connected to inventory.

Events connect the present to the past.

Dependencies connect today's decisions to tomorrow's consequences.

The Universal Logistics Graph brings all of those relationships into one computational model.

It provides a foundation for:

  • logistics tracking,
  • inventory intelligence,
  • route optimization,
  • dependency analysis,
  • shipment visibility,
  • supply-chain exploration,
  • operational analytics,
  • predictive systems,
  • simulation,
  • and eventually autonomous decision-support systems.

The most powerful part is not the graph database.

It is the abstraction.

Once logistics is represented as a graph, the system can reason about movement rather than merely record it.

And that opens an entirely different way of building logistics software.

Software in my mind.

Rock in my soul.

And somewhere between the two is an engineer looking at thousands of disconnected records and asking a simple question:

What if all of this was connected?

Want more #programming & #softwareengineering deep dives?

Join 6,110+ developers sharing real benchmarks, code breakdowns, and projects. Free forever.

More Posts

Merancang Backend Bisnis ISP: API Pelanggan, Paket Internet, Invoice, dan Tiket Support

Masbadar - Mar 13

The Zero-Net-Loss Fleet & The Mercenary Squad: A Live AI Economy

DEVPlank - Aug 4

How AI Is Changing Web Development, and What Developers Still Need to Understand

Daniel Decker - Nov 10

I’m a Senior Dev and I’ve Forgotten How to Think Without a Prompt

Karol Modelski - Mar 19

Stop Turning Every REST Endpoint into an MCP Tool: A Better Approach to AI Tool Design

zeekwrites - Nov 30
chevron_left
2.5k Points • 131 Badges
Kapiri Mposhi, Zambia. • zambianmillenial.com
56Posts
11Comments
408Connections
Derek Mwale — Where Code Meets Creativity.

Related Jobs

View all jobs →

Commenters (This Week)

1 comment
1 comment

Contribute meaningful comments to climb the leaderboard and earn badges!