How do you keep a demand-oriented GraphQL schema from degenerating into one field per screen?
answer
- Screens are evidence, not units
- Would it survive a redesign?
- Could a differently laid-out client use it?
- Documents and fragments carry view shape
- Named for a thing, not a place
basics
~20 sTreat screens as evidence of domain concepts, not as the units of the schema. Model concepts that several surfaces compose differently, keep root fields as a small set of entry points, and reject any type named after a view.
solid answer
~50 sDemand tells you which concepts exist; it does not tell you to expose one root field per page. The failure looks like `candidateHomeScreen`, `employerDashboardV3`, `applicationDetailPage` — each a type serving exactly one view, each near-duplicating the last, and a redesign becoming a schema change. The discipline is a durability test applied to every proposed entry point: would this field survive a redesign, could a second client with a different layout be served by selecting differently from it, and is it named for a thing in the business rather than a place in the UI? Screens still express their demand — as documents and fragments on the client side, which is exactly where view-specific shape belongs. Where a view genuinely needs a bespoke aggregate, name it for the concept it computes, such as `recommendedJobs`, so it stays meaningful when the page it was built for is retired.
code
graphql · 11 linestype Query {
candidateHomeScreen: CandidateHomeScreen!
savedSearchPage(searchId: ID!): SavedSearchPage!
employerDashboardV3: EmployerDashboardV3!
applicationDetailPage(id: ID!): ApplicationDetailPage!
}
type CandidateHomeScreen {
header: HomeHeader!
sections: [HomeSection!]!
}go deeper
Recognise the smell: a type or root field named after a page. Know that the client expresses a screen's needs in the document it sends, not by asking for a type built for that screen.
Be able to explain the concrete costs — redesigns forcing schema churn, near-duplicate types for similar views, a second client that fits neither — and where view-specific shape belongs instead.
Show the review discipline: the durability questions you ask before a root field is merged, the line between a screen field and a genuine computed aggregate, and an incremental migration plan for a schema already full of them.
Own the governance angle. Decide who reviews new entry points, what evidence clears a removal, and how you keep one vocabulary when several product teams each arrive with their own page and their own deadline.
## The failure mode this question is about Demand-oriented design says: start from what clients need. Taken too literally, it produces a schema that is a directory of the current user interface. On a job-board graph that looks like a `Query` with `candidateHomeScreen`, `savedSearchPage`, `employerDashboardV3`, `applicationDetailPage` — twenty-odd root fields, each returning a type built for exactly one view, each with a `header`, a `sections` list and a `footer` that mirror the layout of that page in the release it was designed for. It feels productive for one quarter. It has three costs that arrive together. **Redesigns become schema changes.** The page is the unit, so moving a widget between pages moves fields between types, and the schema churns at the rate the design churns — which is much faster than the domain does. **Nothing composes.** Two views that are eighty per cent the same get two types with two independent sets of fields, resolved twice, tested twice, and drifting apart. The second client platform — a native app whose layout differs — cannot use either, so it asks for a third. **The schema stops teaching.** A newcomer reading a demand-oriented schema should learn what the business contains: postings, employers, candidates, applications, stages. A screen-shaped schema teaches them what the web app looked like in the release when each field was added, including the pages that no longer exist and whose fields nobody dares remove. ## The durability test The practical guard is a question asked of every proposed root field or type, at review time, before it is merged: 1. **Would it survive a redesign?** If the page were rebuilt from scratch tomorrow, would this field still be the right thing to ask for? `applicationDetailPage` fails. `application(id:)` passes. 2. **Could a second client with a different layout use it?** Not "could it call it" — could it be *served* by selecting a subset or a superset of it. If serving the second surface requires a new entry point rather than a different selection, the first one was a screen. 3. **Is it named for a thing or a place?** A concept from the business domain passes. A noun from the navigation menu fails. This is the cheapest of the three and catches most of them. 4. **Does it already exist under another name?** Screen-shaped fields multiply because nobody notices that the concept is already in the graph. A field that fails these is not necessarily rejected — it is redirected. The demand is real; the shape is wrong. ## Where view-specific shape belongs The pressure behind screen-shaped fields is genuine: a view really does want one request that returns exactly its data and nothing more. GraphQL already provides that, on the client side. The document a client sends *is* the screen-shaped artefact — the selection set names precisely the fields that view needs, and where a component owns part of the view, its demand can be expressed as a named fragment that composes into the document the page sends. That is view shape living in the client's repository, where it changes at the pace of the design and is deleted when the page is. Saying this in an interview is what separates a senior answer from a slogan. "Model concepts, not screens" is a slogan. "Model concepts, and let documents and fragments carry the screen shape" is an architecture, and it explains why the constraint costs the client nothing. ## When a view-specific field is the right answer Be careful not to over-apply the rule; interviewers usually probe this next. A field whose value is a genuine computation the server owns is a concept even if exactly one surface consumes it today. A ranked feed of recommended postings for a candidate is not a screen; it is a domain capability that happens to be shown on the home page, and it belongs in the schema — as `recommendedJobs`, not as `homeFeed`. The distinguishing marks: it computes something a client could not assemble itself from other fields, its name would still make sense if the page were deleted, and a second surface (a weekly digest, an email) could plausibly want the same values. Similarly, a legitimately expensive multi-source aggregate is not a reason for a screen field. One document already spans several backends in one round trip; that composition happens during execution, not by pre-baking a view type into the schema. ## Cleaning up an existing one If you inherit twenty-seven root fields of which nine are screens, do not propose a rewrite. Get per-field usage evidence so you know which are actually selected and by whom; introduce concept fields alongside the screen fields; migrate one client at a time to selecting from the concepts; and only then start the deprecation of the screen fields, oldest and least-used first. The schema shrinks, slowly, without a single coordinated release — which is the only way this ever actually gets done.
- A view needs data from four backend systems in one round trip. Doesn't that justify a screen-shaped field?No, because the composition already happens during execution: one document can select fields backed by four different systems and the client still makes one request. Pre-baking the view into a type buys nothing at the transport level and costs you a field that dies with the page. The multi-source concern is about fan-out and latency, and it is answered by how the fields are resolved, not by how the schema is shaped.
- How do you tell a legitimate aggregate field from a screen field?Ask whether it computes something the client could not assemble from other fields, whether its name still makes sense if the page were deleted, and whether a second surface could plausibly want the same values. A ranked recommendation feed passes all three and belongs in the schema; a `homeFeed` that is just three existing lists concatenated in layout order fails all three.
- You inherit a schema with nine screen-shaped root fields. What is your first move?Get usage evidence per field and per caller, because you cannot plan a removal you cannot measure. Then add concept fields alongside, move one client at a time onto them, and deprecate the screen fields in order of least use. It is deliberately incremental; proposing a rewrite of a live contract is the answer that loses the room.
A library catalogue is organised by subject, not by the reading lists that happen to cite the books. Reading lists change every term; the catalogue should not.
saying these in an interview costs you the question
- Adds a root field for every new page
- Names types after UI components or navigation entries
- Says demand-oriented means the interface dictates the schema
- Duplicates near-identical types for two similar views
- Claims one document cannot span several backend systems
- Proposes rewriting a live schema rather than migrating it