Installing SubQuery

2021-10-17 Ungefähr 1 min

# Installing SubQuery

There are various components required when creating a SubQuery project. 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) library 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:

# Yarn
yarn global add @subql/cli

# NPM
npm install -g @subql/cli
1
2
3
4
5

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:

# Yarn
yarn global add @subql/node

# NPM
npm install -g @subql/node
1
2
3
4
5

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:

# Yarn
yarn global add @subql/query

# NPM
npm install -g @subql/query
1
2
3
4
5

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 Updated: October 17, 2021 08:07