Box Optimizer
A web app that designs the best set of shipping box sizes for a small online store, using the store's own order history. It won first place at HackNorse 2026, Luther College's first hackathon (November 20–21, 2026), in the Sustainability track. Ahmed Mohamed and I built it as a team of two in about 24 hours. The engine is written in Rust and compiled to WebAssembly, and the interface is Next.js and TypeScript.
My role
Ahmed and I worked as equal partners on every part of the project. We chose the idea together after researching the problem, built the app together, and made and gave the final presentation together, all within the 24 hours of the hackathon.

The problem
Small online sellers often pick their box sizes by guesswork, so many orders ship in boxes much bigger than the items inside. That wastes cardboard and truck space. It also costs money, because carriers charge for the size of a box and not only its weight. This is called dimensional weight: if a box is big for what it weighs, you pay for its size.
The apps we found for small sellers pick the best box from the boxes a seller already owns. They don't say which sizes to buy. Tools that choose a set of box sizes do exist, but they're made for large warehouses.
The idea
Box Optimizer designs the set of boxes itself. Our "before" already puts every order in the cheapest of the seller's current boxes that fits, which is what those apps do. So the savings we show come on top of that.
What it does
- Designs a box set. You choose how many sizes you want, from 1 to 8. The app picks the best set from 170 standard stock sizes, or designs fully custom ones.
- Checks the fit in 3D. It works out which orders fit in which boxes. The check is careful: it can miss a packing that would work, but every "yes" comes with a real placement where no items overlap.
- Prices each option. The cost of an order is shipping by dimensional or actual weight, whichever is higher, plus the box and the void fill (the material that fills the empty space).
- Shows the difference. You get before and after results, and a curve of cost against the number of box sizes. You can also view any of the 50 most common order types in 3D, in its current box and its recommended one.
- Exports the plan. You can download a buying list and a packing guide as CSV files, and save a printable report as a PDF from the browser.

Architecture & technical decisions
Everything runs in the browser. The Next.js interface reads the CSV files and sends the data to a Web Worker, which runs the Rust engine as WebAssembly. There's no server and no database, so order data never leaves the user's computer. The 3D view uses react-three-fiber.
Next.js
CSV import · results · 3D view
Web Worker
Keeps the page responsive
Rust engine
WebAssembly · fit, cost, optimizer
Choosing the boxes. Picking the best set of boxes is a p-median (facility-location) problem. You choose a fixed number of boxes so that the total cost is as low as possible when each order uses its cheapest chosen box that fits. The engine adds boxes greedily, one at a time, then swaps boxes as long as that lowers the cost. It does this from several fixed starting points and keeps the best result. Nothing is random, so the same input always gives the same boxes.
Checking the answer. We compared the optimizer with brute force, which tries every combination. Trying every set from the full catalog would be a much bigger search, so this check uses 25 candidate boxes. On the sample store, it tries all 300 two-box sets and all 2,300 three-box sets. The gap was 0.00% for both stock and custom sizes. The method page runs the same check live.
Speed. We also wrote the fit check in pure Python and ran both versions on the same 80,427 checks, using our earlier catalog of 83 sizes. The answers were identical, and Rust was about 55× faster (14 ms against 800 ms). That test ran Rust natively, not as WebAssembly in the browser.
Tests. The project has 44 Rust tests, 86 web unit tests, and 12 end-to-end tests. The Rust tests include property tests that try thousands of random packings. CI runs all the tests on every push to main and on every pull request.
Problems we hit
The optimizer sometimes missed the best answer
Problem
On about 3% of small random tests, the optimizer missed the best answer that brute force found. The worst result cost 6.8% more.
Diagnosis
The first version started from one greedy solution and took the first swap that helped. A swap search can get stuck: no single swap lowers the cost, but a better set still exists. With only one starting point, there was no other way to reach it.
Fix
The search now takes the best swap each time, not the first one that helps. For each number of boxes, it also tries several fixed starting points and keeps the best result. This brought the misses down to 1 in 1,600 random tests, with a 1.2% gap. One starting point takes the answer for one fewer box and adds a box to it, which guarantees that more box sizes never cost more.
Custom boxes came out long and thin
Problem
For orders with several items, the custom mode sometimes designed long, thin boxes, such as 36.5 × 14 × 7 in.
Diagnosis
The custom mode packed the items into a large container, then measured the space they took up. It placed items one at a time, each where the overall size grew least. Each step looked good on its own, but together they could make a long row.
Fix
The engine now makes three layouts for each of these orders: the original compact one, one from the normal packing method, and one that starts near a cube and grows until the items fit. It uses the fit check to confirm each layout and keeps the box with the smallest volume.
The first results looked weak
Problem
On the sample store, the first results only went from 82% to 79% empty space, which made the app look like it barely helped.
Diagnosis
There were two causes. The stock catalog had only 83 sizes, with big gaps between them, so small items jumped to boxes that were too large. The main number was also a poor fit: empty space counts the protective padding around the items, so even a perfect fit looks partly empty. As a percentage, it also doesn't show how much air is shipped.
Fix
We expanded the catalog to 170 sizes, with 1-inch steps for small boxes, and added void-fill cost to the total the optimizer minimizes. We also made the volume of air shipped per year the main number. It still includes padding, but it shows how much space is actually being shipped. The void-fill number next to it leaves padding out. Empty space is still shown as a smaller number, and now goes from 82% to 78%.
Results
These results come from a synthetic sample store, not a real business. It has about 3,000 orders over one year. They compare 4 sizes chosen from the stock catalog with the store's 3 current boxes, on the 2,991 orders that both sets can ship:
- 25% less air shipped: from 1,250 to 934 ft³ per year.
- 29% less void fill: from 833 to 588 ft³ per year.
- 11.4% lower cost for shipping, boxes, and void fill combined.
The cost result uses example shipping rates and estimated prices for boxes and void fill. Sellers can change the shipping rates and the void-fill price in the settings, and upload what they pay for their current boxes.

More sizes never cost more, but fewer sizes can. With only two sizes, the sample store does worse than with its three current boxes. From three sizes up, it does better.
What's next
These are the next steps on the project's roadmap:
- Shopify and WooCommerce apps. Import orders automatically and show which box to use for each one.
- Real carrier rates. Use a seller's own rates, uploaded or from an API, in place of the example rates.
- More packing rules. Support fragile items, items that must stay upright, and orders split across several boxes.
- Supplier links. Order the recommended boxes in one click, or get quotes for custom sizes.
- A version for small warehouses. Support companies that ship for several stores, and update their box sizes each season.