Skip to content
Merged
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -0,0 +1,156 @@
---
title: Migrate Your Subgraph From Alchemy to The Graph Network
---

# Migrate Your Subgraph From Alchemy to The Graph Network

Check failure on line 5 in website/src/pages/en/resources/migration-guides/migrate-from-alchemy.mdx

View workflow job for this annotation

GitHub Actions / lint

Element {"type":"heading","depth":1} is restricted

Check failure on line 5 in website/src/pages/en/resources/migration-guides/migrate-from-alchemy.mdx

View workflow job for this annotation

GitHub Actions / lint

Unexpected first heading rank `1`, expected rank `2`

This guide walks you through migrating or deploying an existing subgraph to **The Graph**.
Comment thread
itsjerryokolo marked this conversation as resolved.
Outdated
You’ll learn how to build, test locally with **Graph Node Dev Mode (`gnd`)**, and deploy to **The Graph Studio**.
Comment thread
itsjerryokolo marked this conversation as resolved.
Outdated

---

## 1. Prerequisites

You’ll need:
- Your subgraph source code (`subgraph.yaml`, `schema.graphql`, `src/mapping.ts`)
- [Node.js](https://nodejs.org), Yarn, and `graph-cli`:
```bash
npm install -g @graphprotocol/graph-cli
```
- A [The Graph Studio](https://thegraph.com/studio) account and access token

---

## 2. Install the CLI
Comment thread
itsjerryokolo marked this conversation as resolved.
Outdated

Install and authenticate the CLI:

```bash
npm install -g @graphprotocol/graph-cli
graph auth --studio <YOUR_ACCESS_TOKEN>
```

---

## 3. Prepare and Build
Comment thread
itsjerryokolo marked this conversation as resolved.
Outdated

If you don’t already have a project, initialize one:
Comment thread
itsjerryokolo marked this conversation as resolved.
Outdated

```bash
graph init --from-contract <CONTRACT_ADDRESS> <SUBGRAPH_NAME>
```

Then build it:

```bash
yarn codegen && yarn build
```

---

## 4. Test Locally with Subgraph Dev Mode

`gnd` lets you run a local Graph Node instance for rapid testing—no IPFS or manual database setup required.

### Install `gnd`

```bash
graph node install
gnd --version
```

### Run Locally

From your subgraph directory:

```bash
gnd --ethereum-rpc mainnet:http://localhost:<PORT> --watch
```

Query your subgraph at:
`http://localhost:8000/subgraphs/name/subgraph-0/`

> On Windows, include a PostgreSQL connection string:
> ```bash
> gnd --ethereum-rpc mainnet:http://localhost:<PORT> > --postgres-url "postgresql://graph:yourpassword@localhost:5432/graph-node"
> ```

**Common Flags**
| Flag | Description |
|------|--------------|
| `--watch` | Auto-redeploy when files change |
| `--postgres-url` | Required on Windows |
| `--ethereum-rpc` | RPC endpoint (required) |

---

## 5. Deploy to The Graph Network

After verifying locally, deploy your subgraph to Studio:

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
After verifying locally, deploy your subgraph to Studio:
After verifying locally, deploy your Subgraph to Studio:


```bash
graph deploy --studio <SUBGRAPH_SLUG>
```

This publishes your subgraph to The Graph Network through Studio.
Comment thread
itsjerryokolo marked this conversation as resolved.
Outdated

---

## 6. Monitor and Manage
Comment thread
itsjerryokolo marked this conversation as resolved.
Outdated

View logs, indexing progress, and query endpoints in your dashboard:
Comment thread
itsjerryokolo marked this conversation as resolved.
Outdated

🔗 **Dashboard:**
Comment thread
itsjerryokolo marked this conversation as resolved.
Outdated
`https://thegraph.com/studio/<subgraph-name>`

List all your deployments:
Comment thread
itsjerryokolo marked this conversation as resolved.
Outdated

```bash
graph subgraph list
```

---

## 7. Update Your Application

Your subgraph’s GraphQL endpoint follows this format:

```
https://api.studio.thegraph.com/query/{user_id}/{subgraph_slug}/{version}
```

**Example:**

```
https://api.studio.thegraph.com/query/1234/my-subgraph/v1.0.0
```

Replace your old endpoint with this one in your dApp or backend configuration.

---

## 8. Verify Your Deployment

Run a quick test query:

```graphql
{
transfers(first: 5) {
id
from
to
value
}
}
```

Ensure results match your expectations.

---

## 9. Next Steps
- [Monitor your subgraphs in Studio →](https://thegraph.com/studio)
- [Join The Graph community →](https://discord.gg/graphprotocol)

> Learn more about **Graph Node Dev Mode** →
> [https://thegraph.com/docs/en/subgraphs/developing/creating/graph-node-dev/](https://thegraph.com/docs/en/subgraphs/developing/creating/graph-node-dev/)
Loading