Installation
Installation
There are various components required when creating a SubQuery project. The @subql/cli tool is used to create SubQuery projects. The @subql/node component is required to run an indexer. The @subql/query library is required to generate queries.
Install @subql/cli
The @subql/cli tool helps to create a project framework or scaffold, meaning you don't have to start from scratch.
Install SubQuery CLI globally on your terminal by using Yarn or NPM:
npm install -g @subql/cli
yarn global add @subql/cli
You can then run help to see available commands and usage provided by CLI:
subql --help
Install @subql/node
A SubQuery node is an implementation that extracts substrate-based blockchain data per the SubQuery project and saves it into a Postgres database.
Install SubQuery node globally on your terminal by using Yarn or NPM:
npm install -g @subql/node
yarn global add @subql/node
Once installed, you can start a node with:
subql-node <command>
Note
If you are using Docker or hosting your project in SubQuery's Managed Service, you can skip this step. This is because the SubQuery node is already provided in the Docker container and the hosting infrastructure.
Install @subql/query
The SubQuery query library provides a service that allows you to query your project in a "playground" environment via your browser.
Install SubQuery query globally on your terminal by using Yarn or NPM:
npm install -g @subql/query
yarn global add @subql/query
Note
If you are using Docker or hosting your project in SubQuery's Managed Service, you can skip this step also. This is because the SubQuery node is already provided in the Docker container and the hosting infrastructure.