How phamkhanhminhman97/shopee-tiktok-lazada-api works
Project Type & Purpose
• This is an integration library/module which helps applications interact with Shopee, TikTok Shops, and Lazada APIs.
• The README highlights installation steps and usage examples for configuring each module, indicating that this package is meant to be installed as an npm module to abstract interactions with these external e-commerce systems.
Core Architectural Components
• The library itself acts as the main entry point where the app (src/app.ts) initializes and possibly coordinates between the different modules.
• Three distinct modules exist under the “src/module” directory:
○ Lazada Module – Provides API endpoints (authorization, order, product) by organizing endpoints, constants, helpers, DTOs (data transfer objects) for request and response.
○ Shopee Module – Contains dedicated folders for its API endpoints (authorization, logistic, order, product) and similar support files (constants, helpers, DTO definitions).
○ TikTok Shops Module – Divided into versioned API folders (v1 and v2) reflecting multiple API iterations, and also including a set of common, DTO request/response files.
• Common Elements for Each Module:
○ APIs: Organized into subdirectories that group related endpoints.
○ Common Codes: “common” folders housing constants and helper functions used by API calls.
○ DTOs: Clearly separated request and response DTO directories help encapsulate the data structures needed for each API call.
Interactions & Relationships
• The client application (or a higher-level service) will create instances of each module (e.g., new LazadaModule, new ShopeeModule, new TiktokModule) by passing their respective credentials and configuration parameters.
• Each module internally uses its API components to make network requests to the external e-commerce platforms.
• The DTO directories establish contracts for data exchange, ensuring that requests and responses conform to expected structures.
• Helper utilities (in the “common” folders) standardize operations and ensure consistent logic across endpoints.
• There is a separation of concerns at the module level, and each module interacts directly with its associated external service rather than with one another.
Architectural Patterns and Design Principles
• Modular Design: Each e-commerce platform has its own self-contained module, promoting clear separation of responsibilities.
• Layered / MVC-like Separation: Within each module, separation between the API layer (handling communication), DTO layer (data definitions), and Helper/common functions.
• Versioning: TikTok Shops module clearly supports different API versions (v1 and v2), indicating support for evolving API specifications.