Skip to content

Commit 5d37461

Browse files
Migration Guide (#1039)
* Add migration guide for subgraphs to The Graph Network * Modify title * minor fixes * Update website/src/pages/en/resources/migration-guides/migrate-from-alchemy.mdx Co-authored-by: Idalith <[email protected]> * Update website/src/pages/en/resources/migration-guides/migrate-from-alchemy.mdx Co-authored-by: Idalith <[email protected]> * Update website/src/pages/en/resources/migration-guides/migrate-from-alchemy.mdx Co-authored-by: Idalith <[email protected]> * Update website/src/pages/en/resources/migration-guides/migrate-from-alchemy.mdx Co-authored-by: Idalith <[email protected]> * Update website/src/pages/en/resources/migration-guides/migrate-from-alchemy.mdx Co-authored-by: Idalith <[email protected]> * Update website/src/pages/en/resources/migration-guides/migrate-from-alchemy.mdx Co-authored-by: Idalith <[email protected]> * Update website/src/pages/en/resources/migration-guides/migrate-from-alchemy.mdx Co-authored-by: Idalith <[email protected]> * Update website/src/pages/en/resources/migration-guides/migrate-from-alchemy.mdx Co-authored-by: Idalith <[email protected]> * Update website/src/pages/en/resources/migration-guides/migrate-from-alchemy.mdx Co-authored-by: Idalith <[email protected]> * Update website/src/pages/en/resources/migration-guides/migrate-from-alchemy.mdx Co-authored-by: Idalith <[email protected]> * Fix formatting * Update heading level for migration guide title --------- Co-authored-by: Idalith <[email protected]>
1 parent bfeee85 commit 5d37461

File tree

1 file changed

+163
-0
lines changed

1 file changed

+163
-0
lines changed
Lines changed: 163 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,163 @@
1+
---
2+
title: Migrate Your Subgraph From Alchemy to The Graph Network
3+
---
4+
5+
## Migrate Your Subgraph From Alchemy to The Graph Network
6+
7+
## Goal
8+
9+
Migrate or deploy an existing Subgraph to **The Graph**.
10+
11+
## Overview
12+
13+
This guide walks you through:
14+
15+
1. Preparing your environment and source code
16+
2. Building and testing locally with **Graph Node Dev Mode (`gnd`)**
17+
3. Deploying to [The Graph Studio](https://thegraph.com/studio/).
18+
19+
---
20+
21+
## 1. Prerequisites
22+
23+
You’ll need:
24+
25+
- Your subgraph source code (`subgraph.yaml`, `schema.graphql`, `src/mapping.ts`)
26+
- [Node.js](https://nodejs.org), Yarn, and `graph-cli`:
27+
```bash
28+
npm install -g @graphprotocol/graph-cli
29+
```
30+
- A [The Graph Studio](https://thegraph.com/studio) account and access token
31+
32+
---
33+
34+
## 2. Install and Authenticate with CLI
35+
36+
Install and authenticate the CLI:
37+
38+
```bash
39+
npm install -g @graphprotocol/graph-cli
40+
graph auth --studio <YOUR_ACCESS_TOKEN>
41+
```
42+
43+
---
44+
45+
## 3. Prepare and Build Your Subgraph
46+
47+
If you don’t already have a project, initialize one from a contract:
48+
49+
```bash
50+
graph init --from-contract <CONTRACT_ADDRESS> <SUBGRAPH_NAME>
51+
```
52+
53+
Then build it:
54+
55+
```bash
56+
yarn codegen && yarn build
57+
```
58+
59+
---
60+
61+
## 4. Test Locally with Subgraph Dev Mode
62+
63+
`gnd` lets you run a local Graph Node instance for rapid testing—no IPFS or manual database setup required.
64+
65+
### Install `gnd`
66+
67+
```bash
68+
graph node install
69+
gnd --version
70+
```
71+
72+
### Run Locally
73+
74+
From your subgraph directory:
75+
76+
```bash
77+
gnd --ethereum-rpc mainnet:http://localhost:<PORT> --watch
78+
```
79+
80+
Query your subgraph at:\
81+
`http://localhost:8000/subgraphs/name/subgraph-0/`
82+
83+
> On Windows, include a PostgreSQL connection string:
84+
>
85+
> ```bash
86+
> gnd --ethereum-rpc mainnet:http://localhost:<PORT> > --postgres-url "postgresql://graph:yourpassword@localhost:5432/graph-node"
87+
> ```
88+
89+
**Common Flags** | Flag | Description | |------|--------------| | `--watch` | Auto-redeploy when files change | | `--postgres-url` | Required on Windows | | `--ethereum-rpc` | RPC endpoint (required) |
90+
91+
---
92+
93+
## 5. Deploy to The Graph Network
94+
95+
After verifying locally, deploy your subgraph to Studio:
96+
97+
```bash
98+
graph deploy --studio <SUBGRAPH_SLUG>
99+
```
100+
101+
This command publishes your Subgraph to The Graph Network via Studio.
102+
103+
---
104+
105+
## 6. Monitor and Manage Your Deployment
106+
107+
Access your Subgraph dashboard to view logs, indexing progress, and query endpoints:
108+
109+
**Dashboard:**\
110+
`https://thegraph.com/studio/<subgraph-name>`
111+
112+
List all Subgraph deployments:
113+
114+
```bash
115+
graph subgraph list
116+
```
117+
118+
---
119+
120+
## 7. Update Your Application
121+
122+
Your subgraph’s GraphQL endpoint follows this format:
123+
124+
```
125+
https://api.studio.thegraph.com/query/{user_id}/{subgraph_slug}/{version}
126+
```
127+
128+
**Example:**
129+
130+
```
131+
https://api.studio.thegraph.com/query/1234/my-subgraph/v1.0.0
132+
```
133+
134+
Replace your old endpoint with this one in your dApp or backend configuration.
135+
136+
---
137+
138+
## 8. Verify Your Deployment
139+
140+
Run a quick test query:
141+
142+
```graphql
143+
{
144+
transfers(first: 5) {
145+
id
146+
from
147+
to
148+
value
149+
}
150+
}
151+
```
152+
153+
Ensure results match your expectations.
154+
155+
---
156+
157+
## 9. Next Steps
158+
159+
- [Monitor your subgraphs in Studio →](https://thegraph.com/studio)
160+
- [Join The Graph community →](https://discord.gg/graphprotocol)
161+
162+
> Learn more about **Graph Node Dev Mode**\
163+
> [https://thegraph.com/docs/en/subgraphs/developing/creating/graph-node-dev/](https://thegraph.com/docs/en/subgraphs/developing/creating/graph-node-dev/)

0 commit comments

Comments
 (0)