| title | Graph Node Dev Mode |
|---|
Graph Node Developer Mode (GND) is a developer-friendly Graph Node runner designed for local Subgraph development. It simplifies setup by removing the need for IPFS and offering smart defaults like automatic database handling (on Unix) and live Subgraph redeployment.
- PostgreSQL installed and running
- Access to an Ethereum RPC endpoint (e.g., Anvil, Hardhat)
Install gnd using the Graph CLI:
graph node install
This installs the latest gnd binary to:
- Unix:
~/.local/bin - Windows:
%USERPROFILE%\gnd\bin
Ensure this directory is in your system PATH:
gnd --version
Run gnd inside your Subgraph project directory.
gnd --ethereum-rpc mainnet:http://localhost:<PORT>
gnd --ethereum-rpc mainnet:http://localhost:<PORT> --watch
--watch enables automatic Subgraph redeploys when the build directory changes
gnd --ethereum-rpc mainnet:http://localhost:<PORT> --postgres-url "postgre
sql://graph:yourpassword@localhost:5432/graph-node"
After installing PostgreSQL, follow these steps:
psql -U postgres
Replace postgres with your superuser name if different.
create user graph with password 'yourpassword';
create database "graph-node" with owner=graph template=template0 encodi
ng='UTF8' locale='C';
\c graph-node
create extension pg_trgm;
create extension btree_gist;
create extension postgres_fdw;
grant usage on foreign data wrapper postgres_fdw to graph;
Use this URL when running gnd:
--postgres-url "postgresql://graph:yourpassword@localhost:5432/graph-nod
e"
| Flag | Description |
|---|---|
--watch |
(Optional) Watches the Subgraph build directory and redeploys on changes. |
--manifests |
Path(s) to manifest files. Format: [BUILD_DIR:]/manifest. Default: ./subgraph.yaml. |
--sources |
Source manifest aliases for resolving shared data sources. |
--database-dir |
Directory to store temporary Postgres instance (Unix only). Default: ./build. |
--postgres-url |
URL for PostgreSQL DB. Required on Windows. |
--ethereum-rpc |
Format: network[:capabilities]:URL. Required. |
--ipfs |
IPFS endpoint(s). Default: https://api.thegraph.com/ipfs. |
To run a Subgraph:
cd path/to/your-subgraph
gnd --ethereum-rpc mainnet:http://localhost:<PORT>
This will build and start the Subgraph.
http://localhost:8000/subgraphs/name/subgraph-0/
-
On Unix, if
-postgres-urlis not provided,gndautomatically starts a temporary Postgres instance in the-database-dirfolder (default:./build). -
On Windows, you must provide a valid
-postgres-url. -
IPFS is optional;
gnduseshttps://api.thegraph.com/ipfsby default.