Module Recipe - Plugin Setup and Installation Guide
How-to Guide
Author:
Nandha Balaguru
Changed on:
15 Mar 2025
Key Points
- Create the new module:
`fluent module create -n <module-name> ` - Populate the plugin structure in
`plugins/`
`rules/`- Contains rules, unit tests and GraphQL queries/mutations
`types/`- Stores model classes and extended DTOs
`util/`- Holds service classes and utilities - Build the module:
`./scripts/build-module.sh` - Install the module:
`fluent module install dist/<module-name>-<version>.zip -p <profile> -r <retailer>`
Prerequisites
Steps
Preparing the Custom Module
To create and initialize a new custom module, follow these steps:- Navigate to the directory where the new module should be created.
- Run the following command to generate the module structure:
`fluent module create -m <module-name>`
Understanding the Multi-Module Maven Structure
The `pom.xml` file inside the `plugins` folder contains all module dependencies and information. It typically includes:`<modules>``<module>rules</module>``<module>types</module>``<module>util</module>``</modules>`Recommended Directory Structure
| Module | Purpose |
`rules/` | Contains all the associated rules, unit tests and GraphQL queries & mutations. |
`types/` | Contains all the model classes and extended DTO's. |
`util/` | Contains service classes and utility functions. |
Building the Plugin and Module
- Navigate to the
`resources/`directory and remove any unneeded asset directories. Retain the`module.json`file since we are focusing on plugin installation.`Note : Plugins can be installed along with the data.` - Edit the
`module.json`file to add any other information about the module, eg author information or any module dependencies. - Execute
`./scripts/build-module.sh`and build the module itself
`-p` option, otherwise it would skip the plugin build step.Once the build process completes successfully, check the generated Module Structure and Module Archive inside the `dist/` directory.You can also inspect the assets in the module with `fluent module describe dist/<module-name>-<version>` and confirm that the plugin is present.
Installing the Module
To install the module, execute one of the following commands:
`fluent module install dist/<module-name>-<version>/ --retailer <retailer> --profile <profile>`or
`fluent module install dist/<module-name>-<version>.zip --retailer <retailer> --profile <profile>`