We generate a module scaffolding using PluginFactory.io and then use it for our simple module approach using the init() method.
We hand-coded the module ourselves for our first attempt because we didn’t need a lot of functionality. For this simple module what we have is just enough. However, if you plan to build out your module to have more functionality, you should start with a more robust structure in the beginning.
The easiest way to do that is with the Pluginfactory.io tool from Andrew Welch. This generates the scaffolding for a Craft plugin or module and lets you include the components you need. You can even have it include helpful comments to guide you along.
In this video we generate scaffolding but then we simply use it to house our simple approach to a Craft module using the init() method.
Once you generate the module and it is downloaded, unzip it and then move the module directory (e.g. downlinkmodule) to your modules directory in your project.
You can see that the PluginFactory uses a naming convention that includes the word “module” in the name. That’s not a big deal, and we’ll take that into account as we’re coding our module.
The module directory structure is also different. The main module file. DownlinkModule.php is in the src directory:
├── CHANGELOG.md
├── LICENSE.md
├── README.md
├── config
│ └── app.php
└── src
├── DownlinkModule.php
├── assetbundles
│ └── downlinkmodule
│ ├── DownlinkModuleAsset.php
│ └── dist
│ ├── css
│ │ └── DownlinkModule.css
│ ├── img
│ │ └── DownlinkModule-icon.svg
│ └── js
│ └── DownlinkModule.js
├── translations
│ └── en
│ └── downlink-module.php
That’ll be just fine and we’ll take into account when we code our simple module inside of the this scaffolding.

I am the creator of CraftQuest, a web developer, and former software team manager. I spend most of my time improving CraftQuest with code and courses. When I'm not in front of the computer, I spend my time with my family, and running on the roads and trails of Austin, TX.