Interactive GraphQL SDL reference. Browse every schema type definition — queries, mutations, enums, scalars, interfaces, unions, inputs, and directives — with syntax examples and copy-ready code.
Select a schema type to see its SDL syntax, rules, and real-world examples. Copy-ready for Apollo Server, graphql-java, AWS AppSync, or any GraphQL implementation.
Built-in scalar types available in every GraphQL implementation, plus common custom scalars used in production schemas.
| Scalar | GraphQL Type | Serializes As | Use Case | Kind |
|---|---|---|---|---|
| Int | Int | 32-bit signed integer | Counts, IDs, numeric values | Built-in |
| Float | Float | Double-precision decimal | Prices, coordinates, ratios | Built-in |
| String | String | UTF-8 string | Names, descriptions, text | Built-in |
| Boolean | Boolean | true / false | Flags, toggles, active states | Built-in |
| ID | ID | String (serialized) | Unique identifiers, primary keys | Special |
| Date | scalar Date | ISO 8601 string | Dates without time | Custom |
| DateTime | scalar DateTime | ISO 8601 datetime string | Timestamps, created/updated at | Custom |
| JSON | scalar JSON | Any JSON value | Unstructured data, metadata blobs | Custom |
| URL | scalar URL | String (validated URL) | Links, image URLs, endpoints | Custom |
| scalar Email | String (validated email) | User email fields | Custom | |
| UUID | scalar UUID | String (UUID format) | Globally unique record IDs | Custom |
| Upload | scalar Upload | Multipart form data | File upload mutations | Custom |
| BigInt | scalar BigInt | String (large integer) | 64-bit IDs, financial amounts | Custom |
Every scalar (and type) can be wrapped in two modifiers: ! for non-null (required) and [] for lists. They can be combined:
| Syntax | Meaning | Example value |
|---|---|---|
| String | Nullable string | "hello" | null |
| String! | Required string | "hello" |
| [String] | Nullable list of nullable strings | ["a", null] | null |
| [String!] | Nullable list of required strings | ["a", "b"] | null |
| [String!]! | Required list of required strings | ["a", "b"] |
| [String]! | Required list of nullable strings | ["a", null] |
Two fundamentally different approaches to defining a GraphQL schema. The choice affects your workflow, tooling, type safety, and team collaboration model.
| Library | Approach | Language | Notes |
|---|---|---|---|
| Apollo Server | Schema-first | Node.js | Industry standard, typeDefs + resolvers pattern |
| GraphQL Yoga | Schema-first | Node.js | Lightweight alternative to Apollo Server |
| TypeGraphQL | Code-first | TypeScript | Decorator-based, mirrors NestJS patterns |
| Pothos | Code-first | TypeScript | Plugin-based, no decorators, fully type-safe |
| Nexus | Code-first | TypeScript | Prisma-friendly, generates SDL from code |
| graphql-java | Both | Java | Schema-first via SDL files or runtime wiring |
| Strawberry | Code-first | Python | Dataclass + decorator approach |
| Hot Chocolate | Code-first | .NET / C# | Annotations and fluent builder API |
| AWS AppSync | Schema-first | SDL + VTL | Managed GraphQL with resolver mapping templates |
Practical rules for designing production-ready GraphQL schemas that scale with your API.
A GraphQL schema is the contract between your server and every client that consumes it. Once a field is published in a schema, removing or renaming it is a breaking change. Design schemas with this permanence in mind — add fields liberally, remove them carefully, and use deprecation (@deprecated) before removal.
GraphQL schemas follow consistent naming conventions across the ecosystem: types use PascalCase (UserProfile), fields and arguments use camelCase (createdAt), enum values use SCREAMING_SNAKE_CASE (ACTIVE_USER). Mutations use verb-noun naming: createUser, updatePost, deleteComment.
A key schema design decision is when to use non-null (!). The GraphQL spec allows nullable by default. A common production pattern is to make fields nullable unless you are certain the resolver will always return a value — this prevents schema errors from propagating into client null-pointer exceptions. Input arguments required for mutation should always be non-null.
Lists in GraphQL schemas should almost never be plain arrays. Use the Relay Connection pattern (UserConnection, UserEdge, PageInfo) for cursor-based pagination, or add limit and offset arguments for offset pagination. Never expose unlimited list fields in production — they become performance liabilities as data grows.
GraphQL schemas evolve without version numbers (unlike REST /v1, /v2). Add new fields instead of modifying existing ones. Mark old fields with @deprecated(reason: "Use newField instead"). Monitor field usage in Apollo Studio or similar tools before removing deprecated fields. This allows continuous schema evolution without breaking existing clients.
Tools in this suite for GraphQL schema development, SDL reference, and type generation.