Prompt
How do I build parcel and freight shipping in the same app?
Latest observation
To build parcel and freight shipping in the same app, design it as a single shipping platform with two fulfillment modes that share common infrastructure but use different rules, carriers, and workflows.
1) Use one shipping domain model
Create a core model that supports both:
- Shipment
- Package / Carton
- Pallet
- Freight item / handling unit
- Address / location
- Rate quote
- Label / documents
- Tracking event
- Pickup / delivery appointment
A shipment can contain:
- one or more parcels
- one or more pallets
- or both, if your business supports mixed-mode shipping
2) Split the app into shared and mode-specific logic
Shared logic
- customer/account management
- address validation
- rate shopping
- shipment creation
- payment/billing
- tracking and notifications
- webhooks/API integration
- history/audit logs
Parcel-specific logic
- dimensional weight
- packaging optimization
- label printing
- small-package carrier APIs
- multi-piece parcel support
Freight-specific logic
- pallet count / stackability
- NMFC/class or freight class
- accessorials
- appointment scheduling
- bill of lading
- LTL/FTL rate logic
- terminal/hub handling
3) Normalize shipping inputs
Have one UI form, but dynamically show fields based on mode.
Common fields
- origin and destination
- ship date
- reference numbers
- service level
- insurance
Parcel fields
- number of packages
- weight per package
- dimensions per package
- packaging type
Freight fields
- number of pallets
- pallet dimensions
- total weight
- freight class
- liftgate / inside delivery / appointment required
4) Build a routing/rating engine
Use a rules engine that decides:
- parcel vs freight
- eligible carriers
- service levels
- surcharge/accessorial application
- whether to split a load
Example logic:
- if weight < X and package count small → parcel
- if palletized or over threshold → freight
- if both appear in one order → split into separate shipments or create a multimodal shipment
5) Abstract carrier integrations
Do not hardcode business logic into carrier code.
Create an interface like:
getRates(shipment)createShipment(shipment)buyLabel(shipment)track(shipmentId)cancel(shipmentId)
Then implement adapters for:
- parcel carriers: UPS, FedEx, USPS, DHL
- freight carriers: Yellow, XPO, Old Dominion, Estes, etc.
- freight aggregators/marketplaces if you use them
6) Handle documents differently
Parcel outputs
- shipping label
- packing slip
Freight outputs
- Bill of Lading
- pallet labels
- pro numbers
- appointment confirmation
- delivery receipts
7) Design tracking around events, not carrier type
Use a common event model:
- label created
- picked up
- in transit
- at terminal
- out for delivery
- delivered
- delayed
- exception
Freight tracking often has fewer scans, so your UI should support sparse updates and milestone-based status.
8) Plan your database for flexibility
A practical schema:
ordersshipmentsshipment_unitspackagespalletsaddressesrateslabelstracking_eventsdocumentsaccessorials
Use polymorphism or a shipment_type field:
parcelfreightmixed
9) Make the UI mode-aware
Example user flow:
- User enters order details
- App estimates shipment type
- User confirms parcel or freight
- App quotes carriers
- User selects rate
- App generates docs
- App tracks shipment
For better UX:
- show “recommended shipping mode”
- allow manual override
- explain freight accessorials clearly
10) Build for operational differences
Parcel:
- automated
- high volume
- label-centric
Freight:
- quote-heavy
- appointment-heavy
- documentation-heavy
- exception-prone
Your app should support:
- shipment splitting
- partial fulfillment
- re-quoting
- freight claims
- status overrides
- internal notes
11) Suggested architecture
A good structure is:
-
Frontend
- shipment creation UI
- quote comparison
- tracking dashboard
-
Backend API
- shipment service
- rating service
- carrier integration service
- document service
- tracking service
-
Data layer
- relational DB for shipments/rates/docs
- event log for tracking updates
-
Integration layer
- webhooks
- carrier adapters
- label/document generation
12) Start with a simple MVP
Build in this order:
- create shipment
- support parcel quotes and labels
- add freight quote and BOL generation
- add tracking
- add accessorials and appointments
- add optimization/splitting logic
13) Key product decision
Decide whether your app will:
- treat parcel and freight as separate shipment types, or
- allow a single order to generate multiple shipment legs
For most apps, the easiest approach is:
- one order
- one or more shipments
- each shipment is either parcel or freight
That keeps the system simpler.
If you want, I can also give you:
- a database schema
- a backend API design
- a React UI flow
- a carrier integration example for parcel + freight