A common complaint I hear: "the smart contracts work, but the app feels slow and can't show anything useful." Nine times out of ten it's not the blockchain — it's that the frontend is trying to read from the chain like it's a database. It isn't one.
Why reading from a contract hurts
A blockchain node is built to validate transactions, not to answer questions like "show every listing under $20, newest first." To build a feed, a naive app loops over IDs, makes an RPC call per item, and stitches results together in the browser. That's slow, it hammers your RPC provider, and it simply can't do filtering, sorting or search across history.
What The Graph does
The Graph is an indexing layer. It listens to your contract's events, writes them into a structured store, and exposes a GraphQL API. Instead of hundreds of RPC calls, the frontend makes one query and gets exactly the shape it needs.
Anatomy of a subgraph
Three pieces:
- Schema — the entities you want to query (
Listing,Sale,Credit). - Manifest — which contract and which events to listen to.
- Mappings — small AssemblyScript handlers that turn an event into stored entities.
export function handleListed(event: Listed): void {
let listing = new Listing(event.params.id.toString());
listing.price = event.params.price;
listing.seller = event.params.seller;
listing.active = true;
listing.save();
}
Now the UI can ask for "active listings, sorted by price" and get an instant, paginated answer.
When you need it (and when you don't)
You need an index the moment your UI has to show history, lists, filters or aggregates — a marketplace, a dashboard, a portfolio view. You don't need it for a simple "connect wallet and mint" flow where you only ever read one value.
The takeaway
On-chain data being available isn't the same as it being usable. Contracts handle trust and settlement; an indexer makes the data queryable. Skip that layer and even a perfectly good dApp will feel broken to your users.