Project structure
In Chromia, projects help you organize your Rell code and resources in a single unit that is easy to store and share. In simple words, a project is a directory that keeps everything that makes up your dapp. A typical project normally has a set of settings and one or several modules.
Rell modules can be composed and reused more easily than traditional smart contracts, and they can be updated without disrupting the entire blockchain network. They can be used to define assets, manage user accounts, create custom token economies, and implement complex business logic for dapps. They can also interact with other modules and external systems through well-defined interfaces and APIs.
Here's a structure of a project that gets created when you run the command chr create-rell-dapp. It creates a new Rell
structured project with the necessary files. A main.rell file, which starts with module keywoard (making it a single
file module), it includes the Hello World query and test files in the src/test/ folder. You also have a standard
configuration for your project in the chromia.yml file.
|--chromia.yml
|--src
|--main.rell
|--test
|--arithmetic_test.rell
|--data_test.rell
You can add modules to a project as follows:
|--chromia.yml
|--src
|--module_a
|--module.rell
|--operations.rell
|--queries.rell
|--module_b
|--module.rell
|--util.rell
Here module_a and module_b are multifile modules. In Rell, the folder defines the module when it contains a
module.rell file starting with the module keyword. All files within the same module can access each other's
definitions without explicit imports.
When specifying an entry point in chromia.yml, use the module name (single module filename, or foldername), not a file
path. For example, use module_a as the entry point, not module_a/module.rell. :::