Installing SubQuery

2021-11-24 About 1 min

# Installing SubQuery

There are various components required when creating a SubQuery project. The @subql/cli (opens new window) tool is used to create SubQuery projects. The @subql/node (opens new window) component is required to run an indexer. The @subql/query (opens new window) library is required to generate queries.

# Install @subql/cli

The @subql/cli (opens new window) 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:

You can then run help to see available commands and usage provide by CLI:

subql help
1

# 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:

Once installed, you can can start a node with:

subql-node <command>
1

Note: If you are using Docker or hosting your project in SubQuery Projects, you do 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:

Note: If you are using Docker or hosting your project in SubQuery Projects, you do can skip this step also. This is because the SubQuery node is already provided in the Docker container and the hosting infrastructure.

Last update: November 24, 2021 02:27