The Anatomy of a Trongate Module
A Trongate module is typically organized into three primary directories, each serving a specific purpose:
- Controllers: This directory contains the business logic of the module. Typically, it includes one or more PHP files, each defining a PHP class. While it is common for this directory to contain only one PHP class file, there are cases where multiple files may be necessary.
- Views: The views directory houses the presentational content, primarily HTML. In Trongate, these are PHP files designed to integrate seamlessly with HTML, focusing mainly on the user interface rather than business logic. The inclusion of this directory is optional, since it's possible for modules to exist that do not produce presentational output.
- Assets: This directory is used for storing additional files such as CSS, JavaScript, images, and configuration files for API endpoints and more. Including this directory is optional, since it's possible for modules to exist that do not require additional assets.

What About The 'Models' Directory?
To facilitate secure and efficient database interactions, all Trongate modules can access and utilize a 'Model' PHP class. This class is centrally located within the Trongate framework's 'engine' directory, rather than within individual modules. This centralization simplifies maintenance and enhances security, ensuring consistent database interaction across all modules.