diff --git a/website/src/pages/en/resources/migration-guides/migrate-from-alchemy.mdx b/website/src/pages/en/resources/migration-guides/migrate-from-alchemy.mdx new file mode 100644 index 000000000000..e9d0d4b34a57 --- /dev/null +++ b/website/src/pages/en/resources/migration-guides/migrate-from-alchemy.mdx @@ -0,0 +1,163 @@ +--- +title: Migrate Your Subgraph From Alchemy to The Graph Network +--- + +## Migrate Your Subgraph From Alchemy to The Graph Network + +## Goal + +Migrate or deploy an existing Subgraph to **The Graph**. + +## Overview + +This guide walks you through: + +1. Preparing your environment and source code +2. Building and testing locally with **Graph Node Dev Mode (`gnd`)** +3. Deploying to [The Graph Studio](https://thegraph.com/studio/). + +--- + +## 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 and Authenticate with CLI + +Install and authenticate the CLI: + +```bash +npm install -g @graphprotocol/graph-cli +graph auth --studio +``` + +--- + +## 3. Prepare and Build Your Subgraph + +If you don’t already have a project, initialize one from a contract: + +```bash +graph init --from-contract +``` + +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: --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: > --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: + +```bash +graph deploy --studio +``` + +This command publishes your Subgraph to The Graph Network via Studio. + +--- + +## 6. Monitor and Manage Your Deployment + +Access your Subgraph dashboard to view logs, indexing progress, and query endpoints: + +**Dashboard:**\ +`https://thegraph.com/studio/` + +List all Subgraph deployments: + +```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/)