diff --git a/website/src/pages/en/subgraphs/querying/graph-client/README.md b/website/src/pages/en/subgraphs/querying/graph-client/the-graph-client.mdx similarity index 86% rename from website/src/pages/en/subgraphs/querying/graph-client/README.md rename to website/src/pages/en/subgraphs/querying/graph-client/the-graph-client.mdx index 416cadc13c6f..65647814c5cf 100644 --- a/website/src/pages/en/subgraphs/querying/graph-client/README.md +++ b/website/src/pages/en/subgraphs/querying/graph-client/the-graph-client.mdx @@ -1,14 +1,56 @@ -# The Graph Client Tools +--- +title: The Graph Client Tools +--- -This repo is the home for [The Graph](https://thegraph.com) consumer-side tools (for both browser and NodeJS environments). +The Graph Client is a toolkit for querying Subgraphs using GraphQL. It supports browser and Node.js environments, and includes features like multi-indexer support, fetch strategies, client-side composition, and TypeScript typings. ## Background -The tools provided in this repo are intended to enrich and extend the DX, and add the additional layer required for dApps in order to implement distributed applications. +The Graph's architecture is built on the principle of decentralized indexing, where multiple indexers process and serve blockchain data. However, this decentralized nature introduces unique challenges for dapp developers. The Client Tools emerged as a solution to these challenges, providing an abstraction layer that handles the complexities of interacting with a distributed network of Indexers. -Developers who consume data from [The Graph](https://thegraph.com) GraphQL API often need peripherals for making data consumption easier, and also tools that allow using multiple indexers at the same time. +Think of The Graph Client Tools as a smart routing system for your data requests. Just as a modern GPS system might route you through multiple paths to reach your destination based on traffic and road conditions, these tools intelligently manage your data requests across multiple indexers to ensure optimal performance and reliability. -## Features and Goals +## Core Concepts and Architecture + +### Distributed Data Access + +The fundamental principle behind the Client Tools is distributed data access. Unlike traditional APIs where you interact with a single endpoint, The Graph's ecosystem requires a more sophisticated approach. The tools handle multiple indexers simultaneously, implementing various strategies to ensure data reliability and availability. + +### Fetch Strategies + +Fetch strategies represent different approaches to handling data requests across multiple indexers. These strategies are analogous to different investment portfolio management techniques: + +- The "fallback" strategy works like a backup plan, similar to having multiple insurance policies +- The "race" strategy parallels the concept of market competition, where multiple providers compete to deliver the fastest service +- The "highestValue" strategy resembles seeking the best offer among multiple vendors + +### Client-Side Composition + +Client-side composition is a powerful concept that allows developers to unify data from multiple subgraphs into a coherent whole. This is similar to how a database view combines data from multiple tables, but at the GraphQL API level. This approach enables developers to: + +- Create unified data models across multiple data sources +- Handle cross-chain data relationships +- Build more maintainable and scalable applications + +## Design Philosophy and Trade-offs + +The Graph Client Tools are built around several key philosophical principles: + +### Build-time vs Runtime + +The tools emphasize build-time processing over runtime execution. This design decision mirrors the compilation vs interpretation trade-off in programming languages, where more work is done upfront to ensure better runtime performance. + +### Flexibility vs Complexity + +While the tools offer significant flexibility in data access patterns, this comes with increased complexity in configuration and setup. This trade-off is intentional, prioritizing power and control over initial simplicity. + +### Decentralization Impact + +The decentralized nature of The Graph introduces unique challenges that the Client Tools must address: + +- Data consistency across multiple indexers +- Network latency and reliability variations +- Cost and performance optimizations This library is intended to simplify the network aspect of data consumption for dApps. The tools provided within this repository are intended to run at build time, in order to make execution faster and performant at runtime.