Skip to main content

Boilerplate Overview

A Boilerplate is a pre-written codebase that speeds up development by providing a foundational template for building extensions. The Logistics Extension boilerplate serves as a foundation for building and deploying a logistics extension on Fynd Commerce. It is an enhanced version of the General Extension boilerplate with additional configuration to support logistics-specific features. Developers should first familiarize themselves with the General Extension boilerplate before working on the Logistics boilerplate.

Prerequisite

Download the Logistics Boilerplate code from Here.

Directory Structure

<extension_name>
├── backend
│ ├── basic_router.js
│ ├── constant.js
│ ├── fdk.js
│ ├── partner_router.js
│ ├── platform_router.js
│ ├── utils.js
│ ├── webhook_routes.js
├— test
├— extension.context.json
├— fdk.ext.config.json
├— index.js
├— jest.config.js
├— jest.init.js
├— jsconfig.js
├— sample_serv_file.csv
├— sample_tat_file.csv
└─ server.js
note

The files described below are specific to the Logistics Extension. Since the Logistics Extension boilerplate is built on the General Extension boilerplate, commonly shared files from the General Extension Boilerplate are not included in the list below.
Go through the General Extension boilerplate for foundational understanding.

basic_router.js

The basic_router.js is a foundational component for handling various FDK methods related to logistics extension. It defines routes for creating, updating, and managing schemes, accounts, serviceability, TAT, creating seller accounts and updating shipment status and tracking details. It provides an interface for communication between the extension in Fynd Commerce and the logistics service.

constant.js

The constant.js file defines a constant as the unique identifier for an organization within the system. The API is accessible from the Administrator dashboard. This string value ensures consistent organization identification across various operations and should be treated as immutable.

partner_router.js

The partner_router.js file is a dummy file that acts as a router for interacting with the Fynd Partner API. It can be access from Fynd Partners Admin tab. It provides functionality for accessing DP's data.

platform_router.js

The platform_router.js file is a dummy file that acts as a router for interacting with the Fynd Platform API and can be accesses from the Fynd Commerce extension UI when you install it. It facilitates tasks such as retrieving product information and managing application-specific catalogs. This file enables developers to programmatically access and manage a seller’s Fynd Commerce data, including inventory, orders, and products.

utils.js

The utils.js file in the Logistics Extension boilerplate contains reusable utility functions that are frequently required throughout the extension. For example, the file includes an FDK method like uploadFileToStorage for uploading files to a storage service via a PUT request.

fdk.js

The fdk.js file is used to integrate webhooks. Webhooks in this file allow the extension to stay synchronized with Fynd Commerce data, triggering actions in response to specific events, such as courier partner updates.

webhook_routes.js

The webhook_routes.js file in the Logistics Extension boilerplate processes events triggered by webhook calls related to shipment operations. This file contains the logic to handle events such as assigning or canceling a courier partner for a shipment. While the fdk.js file determines which function should be invoked when an event occurs, the actual handling and processing of the event data are implemented in webhook_routes.js.


Was this section helpful?