How travelbank/duffel-api-javascript works
Main Components
a. Core Client Layer:
• It to the Resource.ts base class which handles common functionality
b. Feature Modules (Group these in logical sections):
Booking Module
• OfferRequests
• Offers
• Orders
• OrderChanges
• OrderCancellations
• SeatMaps
• Payments
Duffel Payments Module
• PaymentIntents
• Refunds
Places Module
• Suggestions
Supporting Resources Module
• Aircraft
• Airlines
• Airports
Interaction Flows
• External application → Client
• Client → Resource base class
• Resource base class → Feature modules
• Feature modules → Duffel API endpoints
Important Elements to Highlight
a. Type System:
• Types directory (src/types) as a shared resource
b. Testing Infrastructure:
• A testing layer showing mock data files
• Mock files to their respective modules
Architectural Patterns to Emphasize
• Resource-based architecture
• Type-safe implementations (TypeScript)
• Modular design with clear separation of concerns
• RESTful API client patterns
┌─────────────────────────────────────────────┐
• External Applications │
• ┘
• ↓
┌─────────────────────────────────────────────┐
• Client (Entry Point) │
• ┘
• ↓
┌─────────────────────────────────────────────┐
• Resource Base Class │
• ┘
• ↓
┌──────────┐ ┌──────────┐ ┌──────────┐
• Booking │ │ Payments │ │ Supporting│
• Module │ │ Module │ │ Resources │
• ┘ └──────────┘ └──────────┘
• ↓
┌─────────────────────────────────────────────┐
• Duffel API │
• ┘
Additional Considerations: