Graph CLI

Learn how to work with the open-source graph-cli package.

The graph-cli package contains commands that help you create, develop, and publish your subgraph.


npm install -g @graphprotocol/graph-cli

# Yarn
yarn global add @graphprotocol/graph-cli


graph initCreates a new subgraph project
graph codegenGenerates AssemblyScript types for smart contract ABIs and the subgraph schema
graph deployDeploys a subgraph (See Deploying a Subgraph)
graph addAdds a new datasource to the yaml file and updates schema.graphql, abis, and mappings
graph testRuns unit tests with Matchstick

See full specification for additional commands and details.