All questions
Showing of 60What are the main benefits of using GraphQL?
Answer it yourself first - out loud, or typed below.
How should your speech become text?
Listening… your words appear above as you speak - tap Stop when you're done.
Recording · cr - tap Stop & transcribe when you're done.
Transcribing with AI…
Voice:
Last attempt -
GraphQL lets each client fetch exactly the data it needs in one request, from a typed schema that describes the API.
- No over-fetching. The client names the fields it wants and gets only those.
- No under-fetching. Related data, like a user and their posts, comes in one request instead of several round trips.
- A typed contract. The schema defines every type and field, and the server rejects queries for fields that do not exist.
- Self-documenting. Introspection lets tools read the schema, which powers editor tooling, documentation and debugging.
- Web and mobile clients can ask the same endpoint for different fields.
- The API evolves without versions. New fields do not break old queries, and old fields are deprecated instead of removed.
This answer doesn't lend itself to a diagram - it reads best . No credits were charged.
Why there's no diagram: “”
The interactive diagram is below the answer - jump to diagram ↓ · Below it, the related concept . Jump to it ↓
What are the three main operation types in GraphQL?
Answer it yourself first - out loud, or typed below.
How should your speech become text?
Listening… your words appear above as you speak - tap Stop when you're done.
Recording · cr - tap Stop & transcribe when you're done.
Transcribing with AI…
Voice:
Last attempt -
GraphQL has three operation types: query for reading, mutation for writing, and subscription for real-time updates. Each starts at its own root type in the schema, Query, Mutation or Subscription, whose fields are that operation's entry points.
- A query reads data. The server can resolve its fields in parallel.
- A mutation writes data. Its top-level fields run one after another, so two writes in one request never race.
- A subscription keeps a long-lived request open, and the server pushes new data each time an event happens.
query GetUser {
user(id: "123") { name }
}
mutation CreateUser {
createUser(input: { name: "John" }) {
name
}
}
subscription UserUpdates {
userUpdated(id: "123") {
name
}
}
This answer doesn't lend itself to a diagram - it reads best . No credits were charged.
Why there's no diagram: “”
The interactive diagram is below the answer - jump to diagram ↓ · Below it, the related concept . Jump to it ↓
What is a GraphQL schema?
Answer it yourself first - out loud, or typed below.
How should your speech become text?
Listening… your words appear above as you speak - tap Stop when you're done.
Recording · cr - tap Stop & transcribe when you're done.
Transcribing with AI…
Voice:
Last attempt -
A GraphQL schema is the contract between client and server. It defines every type and its fields, how the types relate, and which operations a client can run.
The server checks each request against the schema before running it, so a query for a missing field fails early. That makes the schema the single source of truth for what data can be fetched and how.
Schemas are usually written in the Schema Definition Language (SDL). Here Query lists the entry points for reading, and User.posts links each user to their posts.
type User {
id: ID!
name: String!
email: String!
posts: [Post!]!
}
type Query {
user(id: ID!): User
users: [User!]!
}
This answer doesn't lend itself to a diagram - it reads best . No credits were charged.
Why there's no diagram: “”
The interactive diagram is below the answer - jump to diagram ↓ · Below it, the related concept . Jump to it ↓
What are GraphQL scalars?
Answer it yourself first - out loud, or typed below.
How should your speech become text?
Listening… your words appear above as you speak - tap Stop when you're done.
Recording · cr - tap Stop & transcribe when you're done.
Transcribing with AI…
Voice:
Last attempt -
Scalars are the primitive data types in GraphQL, and they represent leaf values. A scalar field has no sub-fields to select, so the query stops there. Scalars also type arguments and variables.
The five built-in scalars are:
String: a UTF-8 character sequence.Int: a 32-bit signed integer.Float: a double-precision floating-point number.Boolean:trueorfalse.ID: a unique identifier. It is serialized like aStringand often used as a cache key.
You can also define custom scalars such as Date or Email, and the server supplies the code that serializes, parses and validates them. @specifiedBy can link one to its format specification.
scalar Date
scalar Email
scalar URL
type User {
id: ID!
email: Email!
birthDate: Date
}
This answer doesn't lend itself to a diagram - it reads best . No credits were charged.
Why there's no diagram: “”
The interactive diagram is below the answer - jump to diagram ↓ · Below it, the related concept . Jump to it ↓
Explain the difference between nullable and non-nullable fields in GraphQL
Answer it yourself first - out loud, or typed below.
How should your speech become text?
Listening… your words appear above as you speak - tap Stop when you're done.
Recording · cr - tap Stop & transcribe when you're done.
Transcribing with AI…
Voice:
Last attempt -
Every field in GraphQL is nullable by default, so it may return null. An exclamation mark after the type, as in String!, makes the field non-nullable, which promises it will never be null.
The default exists because many things can fail in a networked service. A database can go down or a permission check can fail. A nullable field lets that one field come back as null while the rest of the response still arrives.
A non-nullable field trades that safety for a stronger promise. If its resolver fails or returns null, the null propagates to the nearest nullable parent field, which becomes null instead.
Lists combine both markers. [Post!]! means neither the list nor its items can be null, while [String] allows both to be null.
type User {
id: ID! # Required field
name: String! # Required field
email: String # Optional field (can be null)
age: Int # Optional field
posts: [Post!]! # Required array of required Posts
tags: [String] # Optional array of optional strings
}
This answer doesn't lend itself to a diagram - it reads best . No credits were charged.
Why there's no diagram: “”
The interactive diagram is below the answer - jump to diagram ↓ · Below it, the related concept . Jump to it ↓
What are GraphQL object types and how do you define them?
Answer it yourself first - out loud, or typed below.
How should your speech become text?
Listening… your words appear above as you speak - tap Stop when you're done.
Recording · cr - tap Stop & transcribe when you're done.
Transcribing with AI…
Voice:
Last attempt -
An object type describes one kind of entity in your domain, like a user or a post. It lists the named fields a client can ask for. Object types are the most common type in a GraphQL schema.
You define one in the Schema Definition Language (SDL) with the type keyword, a name and typed fields. A field can return a scalar like String! or another object type like User!. That is how types link: User.posts returns posts, and Post.author returns a user.
The root Query type is an object type too. Its fields are the entry points for reading data.
type User {
id: ID!
name: String!
email: String!
posts: [Post!]!
createdAt: String!
}
type Post {
id: ID!
title: String!
content: String!
author: User!
published: Boolean!
}
This answer doesn't lend itself to a diagram - it reads best . No credits were charged.
Why there's no diagram: “”
The interactive diagram is below the answer - jump to diagram ↓ · Below it, the related concept . Jump to it ↓
What are GraphQL enums and when would you use them?
Answer it yourself first - out loud, or typed below.
How should your speech become text?
Listening… your words appear above as you speak - tap Stop when you're done.
Recording · cr - tap Stop & transcribe when you're done.
Transcribing with AI…
Voice:
Last attempt -
An enum is a type whose value must be one of a fixed list of names, such as ADMIN or GUEST. It adds type safety and validation in both directions.
For input, the server rejects an argument outside the list before any resolver runs. For output, clients know the field holds only those values. They can handle each case, and code generators can produce matching types.
Use an enum for a small set of values known ahead of time, like roles, statuses or sort orders. If the values change often or come from data, use a String or an object type instead.
enum UserRole {
ADMIN
MODERATOR
USER
GUEST
}
type User {
id: ID!
name: String!
role: UserRole!
}
This answer doesn't lend itself to a diagram - it reads best . No credits were charged.
Why there's no diagram: “”
The interactive diagram is below the answer - jump to diagram ↓ · Below it, the related concept . Jump to it ↓
What are input types and how do they differ from regular types?
Answer it yourself first - out loud, or typed below.
How should your speech become text?
Listening… your words appear above as you speak - tap Stop when you're done.
Recording · cr - tap Stop & transcribe when you're done.
Transcribing with AI…
Voice:
Last attempt -
An input type is an object you pass in as an argument, while a regular object type is what the server returns. You declare an input type with the input keyword instead of type.
The two cannot be mixed. An input type's fields can only be scalars, enums or other input types, and lists of those. Input fields also cannot take arguments. An object type's fields, by contrast, can return other object types and can each have a resolver.
Input types are used for arguments in mutations and queries. They group many values into one structured argument. A common pattern is one input per mutation. CreateUserInput has required fields, while UpdateUserInput has optional ones, so a client sends only the fields it changes.
input CreateUserInput {
name: String!
email: String!
age: Int
}
input UpdateUserInput {
name: String
email: String
age: Int
}
type Mutation {
createUser(input: CreateUserInput!): User!
updateUser(id: ID!, input: UpdateUserInput!): User!
}
This answer doesn't lend itself to a diagram - it reads best . No credits were charged.
Why there's no diagram: “”
The interactive diagram is below the answer - jump to diagram ↓ · Below it, the related concept . Jump to it ↓
What are arguments in GraphQL queries?
What are aliases in GraphQL?
What are variables in GraphQL?
How do mutations differ from queries?
What are resolvers in GraphQL?
What are the four resolver arguments?
What is Apollo Server?
What is Apollo Client?
What is GraphQL Playground?
What is GraphQL, and how is it different from REST?
Answer it yourself first - out loud, or typed below.
How should your speech become text?
Listening… your words appear above as you speak - tap Stop when you're done.
Recording · cr - tap Stop & transcribe when you're done.
Transcribing with AI…
Voice:
Last attempt -
GraphQL is a query language for APIs, and a runtime that executes those queries against a typed schema. The client describes the data it wants, and gets exactly that shape back.
The main differences:
- REST exposes many URLs, one per resource. GraphQL usually exposes one endpoint.
- A REST endpoint returns a fixed shape, so clients over-fetch unused fields or under-fetch and make extra calls. A GraphQL query gets related data in one request.
- A GraphQL schema is typed, and tools can read it through introspection, a query that returns the schema. REST APIs describe themselves with separate documentation.
- REST APIs often add versions such as
/v2. GraphQL APIs usually add fields and deprecate old ones.
REST is easier to cache over HTTP, because each URL is a natural cache key.
This answer doesn't lend itself to a diagram - it reads best . No credits were charged.
Why there's no diagram: “”
The interactive diagram is below the answer - jump to diagram ↓ · Below it, the related concept . Jump to it ↓
What are interfaces in GraphQL?
What are union types in GraphQL?
What are fragments in GraphQL?
What are inline fragments?
What are directives in GraphQL?
What is the best practice for mutation input design?
How do you handle errors in mutations?
What are GraphQL subscriptions?
How are subscriptions typically implemented?
What is the resolver chain?
How do you handle asynchronous operations in resolvers?
What is the N+1 query problem in GraphQL?
How do you solve the N+1 problem with DataLoader?
What are some GraphQL caching strategies?
How do you implement authentication in GraphQL?
How do you implement authorization in GraphQL?
How do you prevent introspection attacks?
What is the difference between schema-first and code-first development?
What are some popular GraphQL code generators?
How do you handle file uploads in GraphQL?
What are GraphQL middlewares and how do you use them?
How do you version a GraphQL API?
What is the difference between GraphQL and gRPC?
What are some GraphQL testing strategies?
How do you implement cursor-based pagination?
How do you handle errors and logging in a GraphQL server?
What are the limitations of GraphQL?
How does a normalized client cache like Apollo Client's work?
How would you handle optimistic UI after a mutation?
How does GraphQL work over HTTP?
What is query complexity analysis?
How do you implement query timeout and rate limiting?
What are some common GraphQL security vulnerabilities?
What is GraphQL Federation?
What is schema stitching?
How do you implement real-time features with subscriptions?
What are persisted queries and query allowlisting?
How do you implement custom directives?
How do you handle database transactions in GraphQL?
What is the difference between Apollo Federation and schema stitching?
How do you migrate from REST to GraphQL?
What is the GraphQL execution algorithm?
This answer is part of Pro.
The full written answer, with the trade-offs and follow-ups an interviewer will probe.
No matches
Try a different filter or search term.
GraphQL in pictures.
A quick recap of GraphQL in 36 short animated pictures, one idea at a time. About 9 min to get the whole topic back in your head before you walk in. Pause any picture, slow it down, or step through it.
Pro The first chapter is free to play. The other 32 pictures come with Pro.
This picture is part of Pro. The first chapter is free to play; the other 32 pictures come with Pro.
Get Pro · $10/mo Already Pro? Sign in51 of 60 GraphQL answers are in Pro.
Full answers, code samples, and AI explanations that go simpler or deeper. Cancel anytime.
- Full answers + code
- AI explanations, simpler or deeper
- 1,000 AI credits / month
- Cancel anytime
Change topic
Pick a different technology or stack. Your current topic stays put until you choose a new one.
MEAN
MongoDB, Express, Angular, Node.jsMERN
MongoDB, Express, React, Node.jsDjango
Python Full-Stack DevelopmentRuby on Rails
Convention over ConfigurationServerless on AWS
Serverless Architecture on AWSInterviewers also test these - they're common to every stack, whichever one you picked above.
Flutter Mobile
Flutter Cross-Platform Mobile DevelopmentInterviewers also test these - they're common to every stack, whichever one you picked above.
Spring Boot
Enterprise Java Development.NET
Microsoft EcosystemVue
Vue.js, Vite, TypeScript, Tailwind, Node.jsGo Backend
Golang, gRPC, PostgreSQL, Redis, RabbitMQInterviewers also test these - they're common to every stack, whichever one you picked above.
FastAPI
Python, FastAPI, SQLAlchemy, PostgreSQLReact Native
React, TypeScript, Redux, FirebaseiOS Native
Swift, SwiftUI, UIKit, FirebaseAndroid Native
Java, Jetpack Compose, FirebaseDevOps / Platform
Docker, Kubernetes, Terraform, CI/CDInterviewers also test these - they're common to every stack, whichever one you picked above.
AI Engineer
LLMs, RAG, Agents, EvalsAI-Powered Developer
Claude Code, Copilot, Agentic WorkflowsCore SWE Interview Prep
Data structures, algorithms, OS, concurrency, networking, gitInterviewers also test these - they're common to every stack, whichever one you picked above.
Interviewers also test these - they're common to every stack, whichever one you picked above.