Skip to main content

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 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
|--_moduleA
|--module.rell
|--operations.rell
|--queries.rell
|--_moduleB
|--module.rell
|--util.rell
note

Please note that it is not possible to have the entry point in the config of a dapp set to module.rell. If that's the name of the entry then the folder name should go into the config. For example, in the above project structure, if you want to have moduleA as entry point to the dapp, you need to write moduleA as the entry point in the chromia.yml file.