gnd is designed as a drop-in replacement for graph-cli. This guide covers the differences and how to migrate your workflow.
For most users, migration is straightforward:
# Instead of:
graph codegen
graph build
graph deploy --studio my-subgraph
# Use:
gnd codegen
gnd build
gnd deploy my-subgraph # defaults to Studio| graph-cli | gnd | Notes |
|---|---|---|
graph init |
gnd init |
Identical flags |
graph codegen |
gnd codegen |
Identical flags |
graph build |
gnd build |
Identical flags |
graph deploy |
gnd deploy |
Defaults to Studio if --node not provided |
graph create |
gnd create |
Identical flags |
graph remove |
gnd remove |
Identical flags |
graph auth |
gnd auth |
Identical flags |
graph add |
gnd add |
Identical flags |
graph test |
gnd test |
Identical flags |
graph clean |
gnd clean |
Identical flags (new in graph-cli 0.80+) |
graph publish |
gnd publish |
Identical flags |
graph indexer |
gnd indexer |
Delegates to graph-indexer — requires indexer-cli installed |
graph local |
N/A | Not implemented - use graph-node's test infrastructure |
graph node |
N/A | Not implemented - use graphman |
All flags use the same names, short forms, and defaults:
# Both work identically
graph codegen -o generated/ --skip-migrations
gnd codegen -o generated/ --skip-migrations
graph build -t wasm --network mainnet
gnd build -t wasm --network mainnet
graph deploy -l v1.0.0 --ipfs http://localhost:5001 my-subgraph
gnd deploy -l v1.0.0 --ipfs http://localhost:5001 my-subgraphSame success checkmarks, step descriptions, and progress indicators:
✔ Generate types for data source: Gravity (...)
✔ Write types to generated/Gravity/Gravity.ts (...)
0for success1for any errorgnd indexerpasses through the exit code fromgraph-indexer
gnd uses the same configuration files as graph-cli:
~/.graph-cli.json- Deploy keys (fromgnd auth)networks.json- Network-specific addresses
Your existing auth keys work with both tools.
Code generation produces identical AssemblyScript output (after formatting). Your existing subgraph code will work without changes.
gnd indexer provides access to indexer management commands via indexer-cli. Requires graph-indexer on $PATH:
npm install -g @graphprotocol/indexer-cli
gnd indexer status --network arbitrum-one
gnd indexer rules get all --network mainnet
gnd indexer allocations get --network arbitrum-oneNote: gnd indexer --help shows gnd's own help and works without graph-indexer installed. Use gnd indexer help to see the full list of graph-indexer commands.
Not implemented in gnd. Use graph-node's built-in integration test infrastructure or Docker compose setups instead.
Not implemented. Use graphman for node management operations:
# Instead of graph node commands, use graphman:
graphman info subgraph-name
graphman reassign subgraph-name shard# graph-cli uses:
DEBUG=graph-cli:* graph codegen
# gnd uses:
RUST_LOG=gnd=debug gnd codegenThe --uncrashable flag on codegen (Float Capital's uncrashable helper generation) is not implemented. This is a third-party feature that most subgraphs don't use.
These differences are intentional and documented:
-
Int8 import:
gndalways importsInt8in generated code for simplicity, even when not used. This doesn't affect functionality. -
Trailing commas:
gnduses trailing commas in multi-line constructs:// gnd output new Foo( param1, param2, // trailing comma ) // graph-cli output new Foo( param1, param2 )
-
2D array accessors:
gnduses the correcttoStringMatrix()method for 2D GraphQL arrays, fixing a bug in graph-cli that usedtoStringArray().
Build from source in the graph-node repository:
cargo build -p gnd --release
# Binary at target/release/gndYour existing ~/.graph-cli.json works with both tools. Verify with:
# Check stored keys
cat ~/.graph-cli.json
# Or just run a deploy dry-run to see if auth is working
gnd deploy --helpRun your normal workflow with gnd:
gnd codegen
gnd buildCompare the output to graph-cli if you want to verify:
# graph-cli
graph codegen -o generated-graph/
graph build -o build-graph/
# gnd
gnd codegen -o generated-gnd/
gnd build -o build-gnd/
# Compare (should be identical after formatting)
diff -r generated-graph generated-gnd
diff -r build-graph build-gndReplace graph with gnd in your CI configuration:
# Before
- run: graph codegen
- run: graph build
- run: graph deploy --studio ${{ secrets.SUBGRAPH_NAME }}
# After
- run: gnd codegen
- run: gnd build
- run: gnd deploy ${{ secrets.SUBGRAPH_NAME }}If you have npm scripts calling graph-cli:
{
"scripts": {
"codegen": "gnd codegen",
"build": "gnd build",
"deploy": "gnd deploy"
}
}Make sure the gnd binary is in your PATH:
export PATH="$PATH:/path/to/graph-node/target/release"gnd codegen shells out to prettier for formatting. Install it:
npm install -g prettier
# or
pnpm add -g prettiergnd build shells out to the AssemblyScript compiler. Install it:
npm install -g assemblyscript
# or have it in your subgraph's node_modules
npm install --save-dev assemblyscriptIf you notice differences in generated code:
- Check if it's one of the documented differences (Int8 import, trailing commas)
- Run prettier on both outputs to normalize formatting
- Report any unexpected differences as a bug
Keys stored by graph-cli work with gnd and vice versa. If you have issues:
# Re-authenticate
gnd auth YOUR_DEPLOY_KEY
# Verify the key was saved
cat ~/.graph-cli.json- Native performance: Rust implementation is faster for large subgraphs
- Integrated with graph-node: Same codebase, consistent behavior
- Better error messages: Leverages graph-node's validation
gnd devcommand: Run graph-node in development mode
- If you need multi-protocol support (NEAR, Cosmos, Arweave, Substreams) - gnd currently focuses on Ethereum
- If you use the
--uncrashableflag - If you need the
graph localorgraph nodecommands
- File issues at: https://github.com/graphprotocol/graph-node/issues
- Check gnd version:
gnd --version