Rell project structure
Rell is the programming language of Chromia, designed for building decentralized applications (dapps). It integrates relational data models seamlessly, providing an efficient and intuitive way to develop robust applications on the blockchain. For more details, visit the Rell introduction.
Organizing your project
To structure your project effectively, we'll organize the code into dedicated files and folders. This approach ensures clarity, ease of management, and scalability.
Project setup
-
Create the main module folder:
- Since this project will consist of a single module, create a new folder named
main
within thesrc
directory. This folder will house all module-specific files.
- Since this project will consist of a single module, create a new folder named
-
Set up essential files:
- Inside the
main
folder, create the following files:module.rell
entities.rell
functions.rell
operations.rell
queries.rell
- Inside the
-
Initialize the module (
module.rell
):- In the
module.rell
file, add the following code:
src/main/module.rellmodule;
- The
module;
code in this file is a requirement in Rell. It declares the presence of a module and tells Rell to treat the contents of this folder as a single module, which helps organize and manage code effectively.
- In the
-
Delete the existing
main.rell
file:- The
src
folder currently contains a file namedmain.rell
. While it's possible to place all your code in this file, adopting a modular structure with multiple files is much clearer and better organized. As part of the restructuring process, go ahead and delete the existingmain.rell
file.
- The
Your project should now be structured like this:
book-review/
├── src/
│ ├── main/
│ │ ├── entities.rell
│ │ ├── functions.rell
│ │ ├── module.rell
│ │ ├── operations.rell
│ │ └── queries.rell
│ └── test/
│ └── book_review_test.rell
├── .gitignore
└── chromia.yml
Each file serves a specific purpose within the project, promoting clear organization and efficient management as your application evolves. In the following sections, we will explore each component in detail, starting with defining entities in Rell and progressively building out the decentralized application.