subsquid
Search…
Hydra CLI
A cli tool for running a Hydra query node

Install

Using npx:
1
$ alias hydra-cli='npx @subsquid/hydra-cli'
Copied!
or install via npm:
1
npm install -g @subsquid/hydra-cli
Copied!
and then
1
$ hydra-cli [COMMAND]
Copied!

Quickstart

Run
1
$ hydra-cli scaffold
Copied!
and answer the prompts. This will generate a sample project and README with setup instructions.

Commands

hydra-cli codegen

Analyze graphql schema and generate model/server files
1
Analyze graphql schema and generate model/server files
2
3
USAGE
4
$ hydra-cli codegen
5
6
OPTIONS
7
-s, --schema=schema [default: ./schema.graphql] Schema path, can be file or directory
Copied!

hydra-cli db:create

Create target database
1
Create target database
2
3
USAGE
4
$ hydra-cli db:create
Copied!

hydra-cli db:create-migration [NAME]

Analyze database state and generate migration to match the current schema
1
Analyze database state and generate migration to match the current schema
2
3
USAGE
4
$ hydra-cli db:create-migration [NAME]
Copied!

hydra-cli db:drop

Drop target database
1
Drop target database
2
3
USAGE
4
$ hydra-cli db:drop
Copied!

hydra-cli db:migrate

Apply database migrations
1
Apply database migrations
2
3
USAGE
4
$ hydra-cli db:migrate
Copied!

hydra-cli db:new-migration [NAME]

Create a file for a new migration
1
Create a file for a new migration
2
3
USAGE
4
$ hydra-cli db:new-migration [NAME]
Copied!

hydra-cli db:revert

Revert the last performed migration
1
Revert the last performed migration
2
3
USAGE
4
$ hydra-cli db:revert
Copied!

hydra-cli help [COMMAND]

display help for hydra-cli
1
display help for <%= config.bin %>
2
3
USAGE
4
$ hydra-cli help [COMMAND]
5
6
ARGUMENTS
7
COMMAND command to show help for
8
9
OPTIONS
10
--all see all commands in CLI
Copied!

hydra-cli scaffold

Starter kit: generates a directory layout and a sample schema file
1
Starter kit: generates a directory layout and a sample schema file
2
3
USAGE
4
$ hydra-cli scaffold
5
6
OPTIONS
7
-a, --appPort=appPort [default: 4000] GraphQL server port
8
-b, --blockHeight=blockHeight [default: 0] Start block height
9
-d, --dir=dir [default: CWD] Project folder
10
-h, --dbHost=dbHost [default: localhost] Database host
11
-i, --indexerUrl=indexerUrl Hydra Indexer endpoint
12
-n, --name=name [default: hydra-scaffold] Project name
13
-p, --dbPort=dbPort [default: 5432] Database port
14
-u, --dbUser=dbUser [default: postgres] Database user
15
-x, --dbPassword=dbPassword [default: postgres] Database user password
16
--rewrite Clear the folder before scaffolding
17
--silent If present, the scaffolder is non-interactive and uses only provided CLI flags
Copied!
Last modified 7d ago