13 / 20Module 1: A Rell backend with FT4 accounts
Work with Rell modules
Splitting a dapp into modules keeps the codebase organized and easier to maintain as it grows.
To turn a file into a module, put the module; keyword at its top. The module takes its name from the file name. The exception is a file called module.rell: it makes the whole folder a module, named after that folder. Sub-modules come from nesting folders inside a module, or from adding another file in the same folder that declares module;.
Consider the following:
module;The result is a module named main.
module;The result is again a module named main.
Suppose you add another file, src/main/bar.rell, with no module declaration. Its contents join the main module. Declaring the file as a module changes that:
module;Now it is a separate sub-module, main.bar.
Apply this pattern to build up a modular layout for your project.