Domain Modeling For Itineraries And Trip Cost Estimation
A travel-planning interface can look like a collection of forms, but the underlying model has several responsibilities: itinerary order, destination choices, traveler counts, accommodation, transport, activities, and cost assumptions.
Combining all of that into one screen-level object makes change difficult.
Separate The Planning Concepts
A practical model separates:
- trip and traveler context
- itinerary days
- destination references
- selected services
- pricing inputs
- calculated totals
typescripttype ItineraryDay = {
dayNumber: number;
destinationId: string;
activities: ActivitySelection[];
transport?: TransportSelection;
accommodation?: AccommodationSelection;
};The itinerary owns sequence. Catalog entities own descriptive data. Pricing owns calculation rules.
Snapshot Prices At Decision Time
Live catalog prices can change after a traveler creates a plan. A reliable workflow stores a price snapshot when a quote, booking, or confirmed itinerary is created.
Useful snapshot fields include:
- market or region
- source currency
- display currency
- exchange rate
- unit price
- quantity
- calculated subtotal
Without snapshots, historical totals can change when current prices change.
Keep Derived Totals Derived
The system should have one calculation boundary. Screens should not independently calculate totals using slightly different rules.
textTraveler selections
-> validated pricing inputs
-> pricing service
-> line-item snapshots
-> display totalThis also makes future discounts, taxes, and service fees easier to introduce.
Preserve User-Owned Draft State
Planning is rarely completed in one session. Draft itineraries should survive navigation and partial input without pretending they are confirmed bookings.
Explicit draft, quoted, submitted, and confirmed states prevent UI progress from being confused with operational state.
Engineering Outcome
Travel planning becomes maintainable when itinerary composition, catalog data, and pricing are separate domains connected through explicit snapshots and transitions.