17 / 27Module 1: A Rell backend with FT accountsBeginner
Work with Rell modules
Splitting your dapp into modules keeps the code organized and easier to maintain.
Rell lets you group code into modules. To make a file a module, put the module; keyword on its first line. The module takes its name from the file name. The exception is a file named module.rell: it turns its whole folder into a module named after that folder. You can create sub-modules in two ways: add folders inside a module, or put a module; declaration in another file in the same folder.
Consider these two layouts:
module;The file above defines a module named main.
module;This layout also produces a module named main.
Suppose you add a second file, src/main/bar.rell. If it has no module declaration, it joins the main module automatically. If you declare it as a module instead:
module;Rell then creates a sub-module named main.bar.
Applying this pattern throughout your project gives you a modular codebase that is easier to navigate and maintain.