Questions
17 of 25
1How do you bootstrap a NestJS GraphQL application in code-first mode?
2How do you define a GraphQL object type, enum, and union in code-first NestJS?
3How does NestJS schema-first approach differ in setup and when would you choose it over code-first?
4How do you implement a subscription using PubSub in NestJS GraphQL?
5What is the N+1 problem in GraphQL and how does DataLoader solve it?
6How do you make a DataLoader available in the GraphQL context so every resolver can access it in NestJS?
7How do you handle DataLoader cache invalidation and avoid serving stale data in NestJS?
8How do you pass arguments to a GraphQL query and validate them using @Args and input types in NestJS?
9How do you define a GraphQL mutation in NestJS and what input type conventions should you follow?
10What is the difference between @ObjectType() and @InputType() in NestJS GraphQL and why can't you reuse the same class for both?
11How do you add authorization guards to GraphQL resolvers in NestJS?
12How do you implement query complexity analysis to prevent expensive GraphQL queries in NestJS?
13How do you test a NestJS GraphQL resolver with TestingModule?
14How do you implement and use a custom GraphQL scalar type in NestJS?
15How do you handle GraphQL errors and return partial results for mutations in NestJS?
16How do you filter subscription events so each client only receives events relevant to them in NestJS?
17How do you implement schema stitching or federation for a micro-frontend GraphQL architecture in NestJS?
18What is the difference between code-first and schema-first approaches in NestJS GraphQL?
19What is a resolver in NestJS GraphQL and how do you define a root query resolver?
20What are field resolvers in NestJS GraphQL and when do you use them instead of fetching all data in the root query?
21How do you access the GraphQL context including the authenticated user inside a resolver in NestJS?
22What is a GraphQL subscription and how do you enable it in NestJS?
23How do you scale GraphQL subscriptions across multiple NestJS instances?
24How do you implement a DataLoader in NestJS and scope it correctly per request?
25How do you implement cursor-based pagination in NestJS GraphQL using the Relay Connection spec?
17 / 25

How do you implement schema stitching or federation for a micro-frontend GraphQL architecture in NestJS?

Difficulty: 8/10
schema stitching, Apollo federation, NestJS micro‑frontend

Use Apollo Federation where each NestJS service declares its own subgraph schema. Mark federated entities with @Directive('@key') and implement @ResolveReference() so the gateway can fetch them by ID. The gateway uses ApolloGatewayDriver with IntrospectAndCompose to stitch all subgraph schemas into a unified supergraph.

Apollo Federation subgraph and gateway setup
Apollo Federation key concepts:
  1. 1

    @key(fields: 'id') — marks an entity that can be referenced and resolved across subgraphs.

  2. 2

    @ResolveReference() — the method the gateway calls when it needs to resolve an entity by its key.

  3. 3

    @extends and @external — used in subgraphs that extend an entity defined in another subgraph.

  4. 4

    IntrospectAndCompose — gateway introspects running subgraph schemas and composes a unified supergraph.

  5. 5

    Each service is independently deployable — the gateway handles schema composition at query time.

Scenario Questions

0-2 years experience

  1. 1You have two small NestJS services, one exposing a User profile schema and another a Product catalog schema. How would you expose a single GraphQL endpoint that lets a client query both types in one request using schema stitching?
  2. 2If you add a new field to the Product schema but forget to update the stitched gateway, what error would a client see and how would you troubleshoot it?
  3. 3What steps would you take to configure a NestJS gateway module to use Apollo Server's `mergeSchemas` function?

2-5 years experience

  1. 1A new micro‑frontend team is adding an Orders GraphQL service. How would you extend an existing Apollo Federation gateway built with NestJS to incorporate this service without downtime?
  2. 2During a load test the gateway starts returning partial data for some queries. What could cause this in a federated setup and how would you debug it?
  3. 3Explain the trade‑offs between using schema stitching versus Apollo Federation in a NestJS monorepo when services evolve at different speeds.

5-8 years experience

  1. 1Design a strategy for versioning and deprecating fields across multiple federated subgraphs in a NestJS architecture while ensuring backward compatibility for existing micro‑frontend clients.
  2. 2How would you handle authentication and authorization propagation from the NestJS gateway to downstream services when some services use JWT and others use API keys?
  3. 3Discuss the performance implications of resolver delegation versus schema merging in a high‑traffic NestJS gateway and how you would mitigate latency spikes.

8+ years experience

  1. 1Our organization plans to migrate from a stitched GraphQL gateway to Apollo Federation across dozens of NestJS micro‑frontends. What migration path would you propose to minimize risk and maintain service contracts?
  2. 2How would you structure team ownership and CI/CD pipelines for a federated GraphQL ecosystem built with NestJS to prevent breaking changes and enable independent deployments?
  3. 3If a single subgraph becomes a bottleneck under heavy load, what architectural changes at the gateway level could you introduce to isolate failures and preserve overall system availability?

Follow-up Questions

  • How would you test schema composition locally before deploying the gateway?
  • What metrics would you monitor to detect stitching or federation failures in production?
  • If two subgraphs have circular type references, how do you resolve them?
Share

Share via WhatsApp, X, Facebook, LinkedIn or copy link. Open Graph preview enabled.