apollo-federation

Apollo Federation ermöglicht das Zusammenführen mehrerer GraphQL-APIs (Subgraphen) zu einem einheitlichen Supergraphen.

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. The version shown (v2.12) is illustrative — check the Federation changelog for currently supported versions before copying it verbatim.

A subgraph's @link version is a floor, not the composition version — see Federation versions for the full explanation.

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

Mehr Skills von apollographql

apollo-ios
apollographql
Apollo iOS ist ein stark typisierter GraphQL-Client für Apple-Plattformen. Er generiert Swift-Typen aus Ihren GraphQL-Operationen und Ihrem Schema und enthält einen Async/Await-Client, einen normalisierten Cache (im Arbeitsspeicher oder SQLite-gestützt), einen steckbaren, auf Interceptoren basierenden HTTP-Transport, der Abfragen, Mutationen und Multipart-Abonnements verarbeitet, sowie einen optionalen WebSocket-Transport (graphql-transport-ws), der jeden Operationstyp übertragen kann.
apollo-router
apollographql
Apollo Router ist ein leistungsstarker Graph-Router, der in Rust geschrieben wurde und für den Betrieb von Apollo Federation 2-Supergraphen entwickelt wurde. Er sitzt vor Ihren Subgraphen und übernimmt die Abfrageplanung, -ausführung und Antwortkomposition.
apollo-router-plugin-creator
apollographql
Erstelle native Rust-Plugins für Apollo Router.
apollo-server
apollographql
Vollständiger Leitfaden zum Erstellen von GraphQL-Servern mit Apollo Server 5.x in verschiedenen Frameworks. Behandelt Schema-Definition, Resolver, Kontext-Einrichtung und Fehlerbehandlung mit TypeScript-Unterstützung. Unterstützt Standalone-Modus für Prototyping sowie Integrationen mit Express, Fastify, Koa und serverlosen Umgebungen. Enthält Resolver-Muster, Authentifizierung/Autorisierung, Plugins, DataLoader zur N+1-Vermeidung und Techniken zur Leistungsoptimierung. Bietet Referenzdokumentation für Datenquellen, Fehler...
graphql-operations
apollographql
Leitfaden für Best Practices zum Schreiben effizienter, typsicherer GraphQL-Operationen und deren Organisation mit Fragmenten. Behandelt Queries, Mutationen, Subscriptions und Fragmente mit Namenskonventionen, Variablensyntax und Direktivenverwendung. Betont Kernprinzipien: nur benötigte Felder anfordern, alle Operationen benennen, Variablen statt hartcodierter Werte verwenden und ID-Felder für die Cache-Fähigkeit einfügen. Empfiehlt, Fragmente mit Komponenten zu kollokieren und @include-/@skip-Direktiven für bedingte Felder zu nutzen...
graphql-schema
apollographql
We need to translate the given English text into German. The text is a description of a guide for GraphQL schema design. We must preserve the name "graphql-schema" but it's not in the text, so we don't include it. We must not add any extra commentary, labels, etc. Just translate the text. The text: "Industry best practices guide for designing intuitive, performant, and maintainable GraphQL schemas. Covers core design principles including client-centric type organization, explicit nullability patterns, and backwards-compatible evolution strategies Provides reference documentation on types, naming conventions, cursor-based pagination, error modeling, and security considerations Includes practical patterns for interfaces, unions, input types, mutations, and ID strategies with code examples" Note: There is a missing period after "strategies" and before "Provides". We'll treat it as two sentences. Also "code examples" at the end. Translation to German: "Leitfaden für Branchen-Best Practices zur Gestaltung intuitiver, leistungsfähiger und wartbarer GraphQL-S
rover
apollographql
We need to translate the given English text into German, preserving the name "rover" and any technical terms. The text describes the Apollo Rover CLI. We must not add any extra commentary or labels. The translation should be accurate and natural in German. Let's break down the text: "Apollo Rover CLI for managing GraphQL schemas, federation, and local supergraph development. Publish, fetch, and validate subgraph schemas; compose federated supergraphs locally or via GraphOS Includes schema checking (pre-deploy validation), linting, and introspection from running servers rover dev command starts a local Router with automatic schema composition for development workflows Supports CI/CD patterns with check-before-publish validation and JSON output for scripting Requires..." We need to translate this into German. Keep "rover" as is. Also "GraphQL", "federation", "supergraph", "subgraph", "GraphOS", "Router", "CI/CD", "JSON" are technical terms that should remain in English or be commonly used in German tech contexts. Usually, these are kept as is
rust-best-practices
apollographql
We need to translate the given English text into German, preserving the name "rust-best-practices" if it appears. The text is a description of an agent skill. The instruction says: "Do not include the name unless it appears in the source text." The name "rust-best-practices" does not appear in the provided <text> block. So we should not add it. Also, preserve product names, protocol names, URLs, numbers, technical terms. So "Apollo GraphQL", "clippy", "thiserror", "anyhow", "Result", etc. should remain as is or translated? Technical terms like "clippy linting" might be kept as "Clippy-Linting" or similar. But the instruction says "preserve product names, protocol names, URLs, numbers, and technical terms." So we keep them in original form. However, we are translating to German, so we need to produce a natural German translation. For example, "Idiomatic Rust coding standards" -> "Idiomatische Rust-Codierungsstand