apollo-federation

作成者: apollographql

Apollo Federationは、複数のGraphQL API(サブグラフ)を統合されたスーパーグラフに構成することを可能にします。

npx skills add https://github.com/apollographql/skills --skill apollo-federation

Apollo Federation Schema Authoring

Apollo Federation enables composing multiple GraphQL APIs (subgraphs) into a unified supergraph.

Federation 2 Schema Setup

Every Federation 2 subgraph must opt-in via @link:

extend schema
  @link(url: "https://specs.apollo.dev/federation/v2.12",
        import: ["@key", "@shareable", "@external", "@requires", "@provides"])

Import only the directives your subgraph uses.

Core Directives Quick Reference

DirectivePurposeExample
@keyDefine entity with unique keytype Product @key(fields: "id")
@shareableAllow multiple subgraphs to resolve fieldtype Position @shareable { x: Int! }
@externalReference field from another subgraphweight: Int @external
@requiresComputed field depending on external fieldsshippingCost: Int @requires(fields: "weight")
@providesConditionally resolve external field@provides(fields: "name")
@overrideMigrate field to this subgraph@override(from: "Products")
@inaccessibleHide from API schemainternalId: ID! @inaccessible
@interfaceObjectAdd fields to entity interfacetype Media @interfaceObject

Reference Files

Detailed documentation for specific topics:

  • Directives - All federation directives with syntax, examples, and rules
  • Schema Patterns - Multi-subgraph patterns and recipes
  • Composition - Composition rules, error codes, and debugging

Key Patterns

Entity Definition

type Product @key(fields: "id") {
  id: ID!
  name: String!
  price: Int
}

Entity Contributions Across Subgraphs

# Products subgraph
type Product @key(fields: "id") {
  id: ID!
  name: String!
  price: Int
}

# Reviews subgraph
type Product @key(fields: "id") {
  id: ID!
  reviews: [Review!]!
  averageRating: Float
}

Computed Fields with @requires

type Product @key(fields: "id") {
  id: ID!
  size: Int @external
  weight: Int @external
  shippingEstimate: String @requires(fields: "size weight")
}

Value Types with @shareable

type Money @shareable {
  amount: Int!
  currency: String!
}

Entity Stub (Reference Without Contributing)

type Product @key(fields: "id", resolvable: false) {
  id: ID!
}

Ground Rules

  • ALWAYS use Federation 2.x syntax with @link directive
  • ALWAYS import only the directives your subgraph uses
  • NEVER use @shareable without ensuring all subgraphs return identical values for that field
  • PREFER @key with single ID field for simple entity identification
  • USE rover supergraph compose to validate composition locally
  • USE rover subgraph check to validate against production supergraph

apollographqlのその他のスキル

apollo-client
apollographql
Apollo Clientは、GraphQLを使用してローカルデータとリモートデータの両方を管理できる、JavaScript向けの包括的な状態管理ライブラリです。バージョン4.xでは、キャッシュの改善、TypeScriptサポートの強化、React 19との互換性がもたらされています。
official
apollo-client
apollographql
We need to translate the given text from English to Japanese. The text is a description of an agent skill for apollo-client. We must preserve the name "apollo-client" if it appears, but it does not appear in the text. The text mentions "Apollo Client 4.x" - that should be preserved as is. Also preserve technical terms like useQuery, useLazyQuery, useMutation, useSuspenseQuery, useBackgroundQuery, Vite, CRA, Next.js App Router, React Server Components, React Router 7, streaming SSR, TanStack Start, React 18+, 19. Also preserve numbers and URLs (none here). Do not add any extra commentary or labels. Just translate the text. The text: "Comprehensive guide for building React applications with Apollo Client 4.x, covering queries, mutations, caching, and state management. Supports multiple React frameworks and setups: client-side apps (Vite, CRA), Next.js App Router with React Server Components, React Router 7 with streaming SSR, and TanStack Start Includes hooks
official
apollo-connectors
apollographql
REST APIを@sourceおよび@connectディレクティブを使用してGraphQLスーパーグラフに統合します。構造化された5ステップのプロセスを提供:API構造の調査、ディレクティブを使用したスキーマの実装、rover supergraph composeによる検証、コネクタの実行、テストカバレッジ。ヘッダー、ボディペイロード、N+1パターンのバッチ処理、$envによる環境変数インジェクションを含むリクエスト設定をサポート。フィールド選択、エイリアス、ネストデータのサブセレクション、エンティティ...によるレスポンスマッピングを処理します。
official
apollo-ios
apollographql
Apollo iOSは、Appleプラットフォーム向けの強く型付けされたGraphQLクライアントです。GraphQLの操作とスキーマからSwiftの型を生成し、async/awaitクライアント、正規化キャッシュ(インメモリまたはSQLite対応)、クエリ、ミューテーション、マルチパートサブスクリプションを処理するプラグ可能なインターセプターベースのHTTPトランスポート、および任意の操作タイプを伝送可能なオプションのWebSocketトランスポート(graphql-transport-ws)を搭載しています。
official
apollo-kotlin
apollographql
Apollo Kotlinは、GraphQLの操作とスキーマからKotlinモデルを生成する、強い型付けのGraphQLクライアントであり、Android、JVM、Kotlin Multiplatformプロジェクトで使用できます。
official
apollo-mcp-server
apollographql
Model Context Protocolを通じてAIエージェントをGraphQL APIに接続し、内蔵のイントロスペクションおよび操作ツールを提供します。GraphQL操作をMCPツールとして公開し、ローカルファイル、GraphOS Studioコレクション、永続化クエリマニフェストの3つの操作ソースをサポートします。スキーマ探索やアドホッククエリテストのための4つのイントロスペクションツール(introspect、search、validate、execute)を提供し、ミニフィケーションモードではコンパクトな表記でトークン使用量を削減します。静的ヘッダーを介した設定可能な認証、...
official
apollo-router
apollographql
Apollo Routerは、Apollo Federation 2のスーパーグラフを実行するためにRustで書かれた高性能なグラフルーターです。サブグラフの前に配置され、クエリの計画、実行、レスポンスの合成を処理します。
official
apollo-router-plugin-creator
apollographql
Apollo Router用のネイティブRustプラグインを作成します。
official