Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Adding Subgraphs Page #795

Merged
merged 7 commits into from
Oct 15, 2024
Merged
Show file tree
Hide file tree
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
2 changes: 1 addition & 1 deletion website/next-env.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,4 @@
/// <reference types="next/image-types/global" />

// NOTE: This file should not be edited
// see https://nextjs.org/docs/pages/building-your-application/configuring/typescript for more information.
// see https://nextjs.org/docs/basic-features/typescript for more information.
1 change: 1 addition & 0 deletions website/pages/en/_meta.js
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ export default {
title: 'Subgraphs',
},
'quick-start': '',
subgraphs: '',
developing: 'Developing',
deploying: 'Deploying',
publishing: 'Publishing',
Expand Down
41 changes: 41 additions & 0 deletions website/pages/en/subgraphs.mdx
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
---
title: Subgraphs
---

## What is a Subgraph?

A custom, open API that extracts data from a blockchain, processes it, and stores it so it can be easily queried via GraphQL.
idalithb marked this conversation as resolved.
Show resolved Hide resolved

### Subgraph Capabilities

- **Access Data:** Subgraphs enable the querying and indexing of blockchain data for web3.
- **Build:** Developers can build, deploy, and publish subgraphs to The Graph Network. To get started, check out the subgraph developer [Quick Start](quick-start/).
- **Index & Query:** Once a subgraph is indexed, anyone can query it. Explore and query all subgraphs published to the network in [Graph Explorer](https://thegraph.com/explorer).

## Inside a Subgraph

The subgraph manifest, `subgraph.yaml`, defines the smart contracts & network your subgraph will index, the events from these contracts to pay attention to, and how to map event data to entities that Graph Node stores and allows to query.

The **subgraph definition** consists of the following files:

- `subgraph.yaml`: Contains the subgraph manifest

- `schema.graphql`: A GraphQL schema defining the data stored for your subgraph and how to query it via GraphQL

- `mapping.ts`: [AssemblyScript Mappings](https://github.com/AssemblyScript/assemblyscript) code that translates event data into entities defined in your schema (e.g. `mapping.ts` in this guide)
idalithb marked this conversation as resolved.
Show resolved Hide resolved

To learn more about each of subgraph component, check out [creating a subgraph](/developing/creating-a-subgraph/).
idalithb marked this conversation as resolved.
Show resolved Hide resolved

## Subgraph Development

1. [Create a subgraph](/developing/creating-a-subgraph/)
2. [Deploy a subgraph](/deploying/deploying-a-subgraph-to-studio/)
3. [Test a subgraph](/deploying/subgraph-studio/#testing-your-subgraph-in-subgraph-studio)
4. [Publish a subgraph](/publishing/publishing-a-subgraph/)
5. [Signal on a subgraph](/publishing/publishing-a-subgraph/#adding-signal-to-your-subgraph)

## Subgraph Lifecycle

Here is a general overview of a subgraph’s lifecycle:

![Subgraph Lifecycle](/img/subgraph-lifecycle.png)
Loading