Module Recipe - Plugin Setup and Installation 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/`
- Contains rules, unit tests and GraphQL queries/mutations`rules/`
- Stores model classes and extended DTOs`types/`
- Holds service classes and utilities`util/`
- 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>`
Once the module is created, a plugins folder is also generated. It follows a multi-module Maven approach, ensuring a structured hierarchy for better maintainability and modularity of your rules and supporting services.
Understanding the Multi-Module Maven Structure
The
`pom.xml`
`plugins`
`<modules>`
`<module>rules</module>`
`<module>types</module>`
`<module>util</module>`
`</modules>`
Recommended Directory Structure
Module | Purpose |
| Contains all the associated rules, unit tests and GraphQL queries & mutations. |
| Contains all the model classes and extended DTO's. |
| Contains service classes and utility functions. |
This structured approach ensures modular development and better maintainability.
Building the Plugin and Module
- Navigate to the directory and remove any unneeded asset directories. Retain the
`resources/`
file since we are focusing on plugin installation.`module.json`
`Note : Plugins can be installed along with the data.`
- Edit the file to add any other information about the module, eg author information or any module dependencies.
`module.json`
- Execute and build the module itself
`./scripts/build-module.sh`
Ensure that the build script is executed without the
`-p`
Once the build process completes successfully, check the generated Module Structure and Module Archive inside the
`dist/`
You can also inspect the assets in the module with
`fluent module describe dist/<module-name>-<version>`
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>`