Best design pattern to use multiple schemas across clients

I’m using Apollo GraphQL and have a Go service with gqlgen where schemas and types are split into multiple files (e.g., appointments.graphql, users.graphql) for better organization and readability. However, Apollo requires a single combined schema file for code generation, which leads to a large, hard-to-maintain file.

I have multiple client projects (Android, iOS) that need to consume these services. Currently, the only way I found is copying all schemas from services into a root schema file, which is error-prone and not scalable since if we do a change on services we also need modify again manually for the other clients.

Is there a better way to share and generate types across multiple services and clients without duplicating schemas?

Hey! :waving_hand:

I’m using Apollo GraphQL and have a Go service

Are you using Apollo Client, right?

At first, I thought you were working with a single GraphQL API where the schema is split into multiple .graphql files (like appointments.graphql, users.graphql, etc.) and then merged during build time, which is a common pattern for schema organization in a monolithic and totally possible with gqlgen.

But after reading your second paragraph, it sounds like you’re actually dealing with multiple GraphQL APIs, each from a separate service. If that’s the case, I’m curious:

Have you ever considered using Apollo Federation to compose those services into a single supergraph?

Is there a specific reason you’re not using Federation, or is it simply something you haven’t explored yet?