---
title: Subgraphs
sidebarTitle: Overview
---

## What is a Subgraph?

A Subgraph is a custom, open API that extracts data from a blockchain, processes it, and stores it so it can be easily queried via GraphQL.

### 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

To learn more about each Subgraph component, check out [creating a Subgraph](/developing/creating-a-subgraph/).

## Subgraph Lifecycle

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

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

## 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](/subgraphs/developing/deploying-publishing/publishing-a-subgraph/)
5. [Signal on a Subgraph](/subgraphs/developing/deploying-publishing/publishing-a-subgraph/#adding-signal-to-your-subgraph)

### Build locally

Great Subgraphs start with a local development environment and unit tests. Developers use [Graph CLI](https://github.com/graphprotocol/graph-tooling/tree/main/packages/cli), a command-line interface tool for building and deploying Subgraphs on The Graph. They can also use [Graph TypeScript](/subgraphs/developing/creating/graph-ts/README/) and [Matchstick](/subgraphs/tooling/unit-testing-framework/) to create robust Subgraphs.

### Deploy to Subgraph Studio

Once defined, a Subgraph can be [deployed to Subgraph Studio](/deploying/deploying-a-subgraph-to-studio/). In Subgraph Studio, you can do the following:

- Use its staging environment to index the deployed Subgraph and make it available for review.
- Verify that your Subgraph doesn't have any indexing errors and works as expected.

### Publish to the Network

When you're happy with your Subgraph, you can [publish it](/subgraphs/developing/deploying-publishing/publishing-a-subgraph/) to The Graph Network.

- This is an onchain action, which registers the Subgraph and makes it discoverable by Indexers.
- Published Subgraphs have a corresponding NFT, which defines the ownership of the Subgraph. You can [transfer the Subgraph's ownership](/subgraphs/developing/managing/transferring-a-subgraph/) by sending the NFT.
- Published Subgraphs have associated metadata, which provides other network participants with useful context and information.

### Add Curation Signal for Indexing

Published Subgraphs are unlikely to be picked up by Indexers without curation signal. To encourage indexing you should add signal to your Subgraph. Learn more about signaling and [curating](/resources/roles/curating/) on The Graph.

#### What is signal?

- Signal is locked GRT associated with a given Subgraph. It indicates to Indexers that a given Subgraph will receive query volume and it contributes to the indexing rewards available for processing it.
- Third-party Curators may also signal on a given Subgraph, if they deem the Subgraph likely to drive query volume.

### Querying & Application Development

Subgraphs on The Graph Network receive 100,000 free queries per month, after which point developers can either [pay for queries with GRT or a credit card](/subgraphs/providers/subgraph-studio/introduction/).

Learn more about [querying Subgraphs](/subgraphs/querying/introduction/).

### Updating Subgraphs

To update your Subgraph with bug fixes or new functionalities, initiate a transaction to point it to the new version. You can deploy new versions of your Subgraphs to [Subgraph Studio](https://thegraph.com/studio/) for development and testing.

- If you selected "auto-migrate" when you applied the signal, updating the Subgraph will migrate any signal to the new version and incur a migration tax.
- This signal migration should prompt Indexers to start indexing the new version of the Subgraph, so it should soon become available for querying.

### Deleting & Transferring Subgraphs

If you no longer need a published Subgraph, you can [delete](/subgraphs/developing/managing/deleting-a-subgraph/) or [transfer](/subgraphs/developing/managing/transferring-a-subgraph/) it. Deleting a Subgraph returns any signaled GRT to [Curators](/resources/roles/curating/).
