It’s Q4, undoubtedly the busiest season for the shipping and logistics world. Between Thanksgiving and Black Friday and the Christmas gift shopping, very few people stop and wonder what the back end of this industry looks like.
You order something online, and a few days later someone knocks at your door holding it. In between those two events, a warehouse, a transport network, and a local delivery operation have had to coordinate.
You buy one delivery, but several companies may have to pass the package, and information about it, between them.
That is the part of shipping I find interesting. This has been my bread and butter for the last decade.
So let me take you through the journey your package goes through.
I’m hoping that by the time you are done reading this you will have a newfound appreciation for all the systems that come together to ensure that new set of LEGO you ordered gets to your loved ones just in time for Christmas.
Subscribe to follow what I’m building and learning.
Before the package leaves the warehouse
Let’s use a simple example: you order an item from an online store whose warehouse is in another city, within the same country.
This is an illustration, and different deliveries will take different routes.
Before anyone collects the package, the merchant needs a way to get it to you. That means choosing a fulfillment route: where the item will ship from and which delivery service, or combination of services, can carry it to your address.
The closest warehouse might be a good starting point. But finding a warehouse and finding a network that can complete the delivery are connected decisions.
Someone has to cover the distance between that building and your door.
A carrier might handle the whole journey through its network. Or several providers might each handle a part.
Inside the warehouse, your order needs to become a package. A picker finds the LEGO set on its shelf and takes it to a packing station. Someone chooses a box, adds padding, and seals it.
That box also needs a shipping label. The merchant’s software can request rates from connected carriers, select a service, and create the shipment to get its label and tracking number.
Once the label is on, the package is ready for collection.
This is the part I built Karrio, an open-source shipping project, to help with: giving developers a common way to request rates and generate labels from connected carriers.
This is where the terms first mile, middle mile, and last mile become useful.
They describe the parts of the journey and don’t mean your package travels three miles.
Shipping would be a much easier problem if it did.
The first mile gets it into the network
Our package is still at the merchant’s warehouse. A carrier comes to collect it, along with the other packages ready to leave.
That pickup is part of the first mile: getting the package into the shipping network.
For a warehouse with enough volume, having a carrier collect a batch makes sense. A smaller merchant might take its packages to the post office or another drop-off point instead. The arrangements might be different, but they both work to accomplish the same thing.
The merchant hands the package over, and now its journey begins.
It is tempting to think of this as the whole shipping transaction. You give a package to a delivery company, and now it is their problem.
From the merchant’s side, though, that handover creates a need for information. Once that package leaves the building, the merchant depends on updates from the network to know what is happening to it.
The middle mile
The next job is to move the package toward the area where you live. This is the middle mile.
In our example, it could travel between cities by truck. Another route might require air transport. A provider can use its own transport network or work with partners for part of the movement.
So even here, in what looks like one stretch of a delivery, there may be another handoff. The company that collected the package does not necessarily own the vehicle carrying it across the country.
Eventually, it reaches a sorting facility near its destination. The purpose here is to get it ready for the next part of the journey. Packages come in, spend a short time there, and move on with the participant who can take them closer to their recipients.
Our package has reached your city, yay.
It still needs to reach you.
The last mile
A local delivery operation takes the package from the destination facility to your address. This is the last mile, the part you see when a courier arrives at your door.
Home delivery is one option, though.
You might instead collect the package from a post office or a pickup location. That is still part of the last mile. The delivery arrangement determines where the network hands the package over to you.
Where the information can stop
Now let’s give our LEGO set a longer trip: from a warehouse in the UK to a customer abroad.
Some shipping services put that journey together using other companies’ networks. A local carrier could collect the package and take it to a freight forwarder, who arranges its onward transport by air.
At the destination, another partner handles customs clearance, using documents such as a commercial invoice describing the contents. A local carrier then takes it the rest of the way.
You bought one delivery. Several companies are doing the work.
Now suppose one provider hands the package over, but the update doesn’t reach the merchant’s system. Your package could already be in your city, but the merchant still thinks it’s in transit.
So whenever you ask where your package is, the merchant needs an update from whoever is handling it. If that information doesn’t reach the systems the merchant is using, you could get an outdated answer.
A gap between updates can also be normal. On a long trip, the next scan may only happen when the package reaches the destination hub. The problem here is when an update exists but doesn’t reach the people who need it.
Karrio also lets the merchant’s software retrieve tracking updates from connected carriers. But that connection depends on the information the carrier supplies. If an update isn’t available through that connection, the merchant still has a gap in their information.
That is what I want to help improve. Your package might pass through several companies before it reaches you. You should still be able to ask where it is and get a useful answer.
So, next time that LEGO set arrives at your door, you will have a rough idea of how it has spent its last few days.
Someone collected it, others moved it between cities, and a local courier brought it the rest of the way.
I spend my time thinking about the software that helps those people work together. Hopefully, you can see why it keeps me interested.
—Dan
Thanks for reading, . I hope this gave you something to think about. If you’d like more, subscribe, I’d be glad to have you back.






I just cheked and apparenty amazon ships 6.3 billion packages.... so this whole process happens that many times at least... wooow
I actually am planning on ordering some lego set for my nephew, what are the odds