How esarmiem/b2c-landing works
Project Type & Purpose
• The project is a modern web application for travel insurance and assistance services. The README and file structure indicate that it is built as a full-stack frontend application using React with TypeScript, styled with Tailwind CSS.
• Key functionalities include travel assistance quotations, multi-language support, real-time currency conversion, secure payment processing via ePayco, and integration with multiple APIs (TravelKit, ISL, and ePayco).
High-Level Architectural Components
a. User Interface / Frontend:
• The core UI is implemented using React and is divided into multiple layers:
• TravelCore: Contains core features and shared layouts, context providers, hooks, utility functions, and API service integrations.
• TravelFeatures: Contains feature-specific components and pages (e.g., Home, Invoice, Traveler, TripQuote) that build on top of the core functionality.
• Shared components: Located in /components (e.g., base UI elements such as buttons, inputs, cards) that can be reused across features.
• Main routing is handled in the TravelCore/Routes directory.
• Internationalization is supported via i18next with translation files stored under public/locales (for both English and Spanish).
b. Service Integration & API Communication:
• The application separates API calls based on functionality:
• Services/API Integration: In the TravelCore/Services/Apis directory, there are dedicated folders for Authentication, ISL based authentication, Masters, Order, and Payment.
• These services encapsulate HTTP communications (using Axios as per the README) and provide data to React Context providers.
• External APIs include TravelKit APIs, ISL API for travel assistance, and the payment gateway via ePayco.
c. State Management:
• Managed using React Context through the files in TravelCore/ContextData.
• Custom hooks (in TravelCore/Hooks) help interact with specific pieces of state for data, orders, sessions, etc.
d. Configuration & Utilities:
• Configuration files for Tailwind (tailwind.config.js), Vite (vite.config.ts), and TypeScript (tsconfig.json) define the development and build environment.
• Utility functions and constants are in TravelCore/Utils for runtime behaviors (e.g., date formatting, HTTP methods, and validation rules).
Relationships and Interactions
• The UI components within the TravelFeatures and TravelCore directories interact with each other through well-defined context providers.
• API service modules (grouped by functionality) provide data to state management contexts.
• The shared UI components support consistency in the look and feel across different features.
• Internationalization is implemented at the UI level; translation files are loaded from the public folder and used across components.
• Styling is centralized in the TravelCore/Styles directory and through global styles (e.g., index.css, assets, and Tailwind CSS).
Architectural Patterns & Design Principles
• Separation of concerns: Clear separation between core functionalities (TravelCore) and feature-specific functionalities (TravelFeatures).
• Component reusability: Shared components and UI elements in /components.
• State management with React Context promotes modular design.
• API abstraction: The Services/Apis directories abstract external API interactions.
• Responsive design: Ensured using Tailwind CSS alongside media queries in custom style sheets.