graphql-schema

tarafından apollographql

Endüstriyel en iyi uygulamalar rehberi; sezgisel, yüksek performanslı ve sürdürülebilir GraphQL şemaları tasarlamak için. İstemci odaklı tip organizasyonu, açık nullability desenleri ve geriye dönük uyumlu evrim stratejileri dahil olmak üzere temel tasarım ilkelerini kapsar. Tipler, adlandırma kuralları, imleç tabanlı sayfalama, hata modelleme ve güvenlik hususları hakkında referans dokümantasyonu sağlar. Kod örnekleriyle arayüzler, birleşimler, girdi tipleri, mutasyonlar ve ID stratejileri için pratik desenler içerir...

npx skills add https://github.com/apollographql/skills --skill graphql-schema

GraphQL Schema Design Guide

This guide covers best practices for designing GraphQL schemas that are intuitive, performant, and maintainable. Schema design is primarily a server-side concern that directly impacts API usability.

Schema Design Principles

1. Design for Client Needs

  • Think about what queries clients will write
  • Organize types around use cases, not database tables
  • Expose capabilities, not implementation details

2. Be Explicit

  • Use clear, descriptive names
  • Make nullability intentional
  • Document with descriptions

3. Design for Evolution

  • Plan for backwards compatibility
  • Use deprecation before removal
  • Avoid breaking changes

Quick Reference

Type Definition Syntax

"""
A user in the system.
"""
type User {
  id: ID!
  email: String!
  name: String
  posts(first: Int = 10, after: String): PostConnection!
  createdAt: DateTime!
}

Nullability Rules

PatternMeaning
StringNullable - may be null
String!Non-null - always has value
[String]Nullable list, nullable items
[String!]Nullable list, non-null items
[String]!Non-null list, nullable items
[String!]!Non-null list, non-null items

Best Practice: Use [Type!]! for lists - empty list over null, no null items.

Input vs Output Types

# Output type - what clients receive
type User {
  id: ID!
  email: String!
  createdAt: DateTime!
}

# Input type - what clients send
input CreateUserInput {
  email: String!
  name: String
}

# Mutation using input type
type Mutation {
  createUser(input: CreateUserInput!): User!
}

Interface Pattern

interface Node {
  id: ID!
}

type User implements Node {
  id: ID!
  email: String!
}

type Post implements Node {
  id: ID!
  title: String!
}

Union Pattern

union SearchResult = User | Post | Comment

type Query {
  search(query: String!): [SearchResult!]!
}

Reference Files

Detailed documentation for specific topics:

  • Types - Type design patterns, interfaces, unions, and custom scalars
  • Naming - Naming conventions for types, fields, and arguments
  • Pagination - Connection pattern and cursor-based pagination
  • Errors - Error modeling and result types
  • Security - Security best practices for schema design

Key Rules

Type Design

  • Define types based on domain concepts, not data storage
  • Use interfaces for shared fields across types
  • Use unions for mutually exclusive types
  • Keep types focused (single responsibility)
  • Avoid deep nesting - flatten when possible

Field Design

  • Fields should be named from client's perspective
  • Return the most specific type possible
  • Make expensive fields explicit (consider arguments)
  • Use arguments for filtering, sorting, pagination

Mutation Design

  • Use single input argument pattern: mutation(input: InputType!)
  • Return affected objects in mutation responses
  • Model mutations around business operations, not CRUD
  • Consider returning a union of success/error types

ID Strategy

  • Use globally unique IDs when possible
  • Implement Node interface for refetchability
  • Base64-encode compound IDs if needed

Ground Rules

  • ALWAYS add descriptions to types and fields
  • ALWAYS use non-null (!) for fields that cannot be null
  • ALWAYS use [Type!]! pattern for lists
  • NEVER expose database internals in schema
  • NEVER break backwards compatibility without deprecation
  • PREFER dedicated input types over many arguments
  • PREFER enums over arbitrary strings for fixed values
  • USE ID type for identifiers, not String or Int
  • USE custom scalars for domain-specific values (DateTime, Email, URL)

apollographql tarafından daha fazla skill

apollo-client
apollographql
Apollo Client, JavaScript için kapsamlı bir durum yönetimi kütüphanesidir ve GraphQL ile hem yerel hem de uzak verileri yönetmenizi sağlar. 4.x sürümü, geliştirilmiş önbellekleme, daha iyi TypeScript desteği ve React 19 uyumluluğu sunar.
official
apollo-client
apollographql
We need to translate the given text from English to Turkish, preserving the name "apollo-client" and any technical terms like "queries", "mutations", "caching", "state management", "React", "Apollo Client 4.x", "Vite", "CRA", "Next.js App Router", "React Server Components", "React Router 7", "streaming SSR", "TanStack Start", "useQuery", "useLazyQuery", "useMutation", "useSuspenseQuery", "useBackgroundQuery", "Suspense", "React 18+", "19". Also preserve URLs if any (none here). Do not add any extra commentary or labels. Just output the translated 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'lerini @source ve @connect yönergelerini kullanarak GraphQL süper grafiklerine entegre eder. Yapılandırılmış 5 adımlı bir süreç sunar: API yapısını araştırma, yönergelerle şema uygulama, rover supergraph compose ile doğrulama, bağlayıcıları çalıştırma ve test kapsamı. Başlıklar, gövde yükleri, N+1 desenleri için toplu işleme ve $env aracılığıyla ortam değişkeni enjeksiyonu dahil olmak üzere istek yapılandırmasını destekler. Alan seçimi, takma adlandırma, iç içe veriler için alt seçimler ve varlık... ile yanıt eşlemesini yönetir.
official
apollo-federation
apollographql
Apollo Federation, birden fazla GraphQL API'sini (alt grafikler) birleşik bir süper grafik halinde oluşturmayı sağlar.
official
apollo-ios
apollographql
We need to translate the given English text into Turkish, preserving the name "apollo-ios" and technical terms like GraphQL, Swift, async/await, SQLite, HTTP, WebSocket, graphql-transport-ws. The instruction says to translate only the text inside <text>, and not include the name unless it appears in the source text. The name "apollo-ios" does not appear in the source text; the source says "Apollo iOS" (with a space). The instruction says "Name to preserve: apollo-ios" but the source has "Apollo iOS". We should preserve the exact name as given? The instruction says "preserve product names" and the name to preserve is "apollo-ios". However, the source text uses "Apollo iOS". I think we should keep "Apollo iOS" as is because that's the product name in the source. But the instruction says "Name to preserve: apollo-ios" - that might be a key. To be safe, I'll keep "Apollo iOS
official
apollo-kotlin
apollographql
Apollo Kotlin, GraphQL işlemlerinizden ve şemanızdan Kotlin modelleri oluşturan, Android, JVM ve Kotlin Multiplatform projelerinde kullanılabilen, güçlü türde bir GraphQL istemcisidir.
official
apollo-mcp-server
apollographql
AI ajanlarını, Model Context Protokolü aracılığıyla yerleşik içgözlem ve işlem araçlarıyla GraphQL API'lerine bağlayın. GraphQL işlemlerini MCP araçları olarak sunar; üç işlem kaynağını destekler: yerel dosyalar, GraphOS Studio koleksiyonları ve kalıcı sorgu bildirimleri. Şema keşfi ve geçici sorgu testi için dört içgözlem aracı (introspect, search, validate, execute) sağlar; küçültme modu, kompakt notasyonla token kullanımını azaltır. Statik başlıklar aracılığıyla yapılandırılabilir kimlik doğrulama,...
official
apollo-router
apollographql
Apollo Router, Apollo Federation 2 süper grafiklerini çalıştırmak için Rust dilinde yazılmış yüksek performanslı bir grafik yönlendiricisidir. Alt grafiklerinizin önünde yer alır ve sorgu planlaması, yürütme ve yanıt birleştirme işlemlerini yönetir.
official