Level 1 · Entry Foundations¶
Goal: understand GraphQL well enough to build a small, correct API from scratch — and to explain exactly what happens between a query string arriving and a JSON response leaving.
Three ideas carry this level:
- The schema is the contract. Types, nullability and arguments decide what clients can ask and what they can rely on. Everything is validated against it before any of your code runs.
- Resolvers chain through
parent. Every field has a resolver; each receives what its parent returned. You never write "the query" — you write small functions the executor composes. - Errors are part of the response. A GraphQL response can carry partial data and errors
together, and
!decides how far a failure spreads.
Modules¶
- What GraphQL Is — one endpoint, a typed schema, client-shaped responses; the same data via REST and GraphQL
- Your First Schema and Query with graphql-js — parse, validate and execute as separate phases; the AST; resolver maps
- The Type System — scalars and their coercion rules, objects, lists, non-null, enums
- Writing Queries — arguments, aliases, fragments, variables, directives, named operations
- Resolvers —
parent,args,context,info; the default resolver; what a throw does - Mutations and Input Types — input objects, absent vs
null, serial execution measured - Serving GraphQL over HTTP with Apollo Server — request shapes, context from headers, CSRF prevention, status codes, production defaults
- Errors, Partial Data & Null Propagation — request vs field errors,
extensions, how!moves a null upward - Introspection, SDL & Tooling —
__schema/__type, dumping a live schema, detecting breaking changes - Project — A Library Catalog API with Tests — loans with real rules, tested through
executeOperation
What you need before starting¶
- JavaScript and Node.js basics: modules,
async/await, objects and arrays. The JavaScript Mastery Path and Node.js Mastery Path cover them. - HTTP and JSON: methods, headers, status codes. If REST is familiar, you're ready; the REST API Mastery Path is a good companion.
- Node.js 22 or newer and
npm.
How the examples were checked¶
Every example in this level was run on Node.js 26.3 with graphql 16.14.2,
@graphql-tools/schema 10.1.3 and Apollo Server 5.5.1, using node:test for tests.
Outputs are pasted exactly as printed, except where a lesson says it trimmed stack traces or
timings. Apollo Server's error responses include stack traces with file paths in development
mode; the lessons shorten those and say so.
What wasn't run
Nothing in Level 1 needs external services. Hosted tools mentioned in passing — Apollo Sandbox, editor plugins — are described, not demonstrated.