GraphQL Federation for combining multiple services

Our company is engaged in the development, support and maintenance of sites of any complexity. From simple one-page sites to large-scale cluster systems built on micro services. Experience of developers is confirmed by certificates from vendors.
Development and maintenance of all types of websites:
Informational websites or web applications
Business card websites, landing pages, corporate websites, online catalogs, quizzes, promo websites, blogs, news resources, informational portals, forums, aggregators
E-commerce websites or web applications
Online stores, B2B portals, marketplaces, online exchanges, cashback websites, exchanges, dropshipping platforms, product parsers
Business process management web applications
CRM systems, ERP systems, corporate portals, production management systems, information parsers
Electronic service websites or web applications
Classified ads platforms, online schools, online cinemas, website builders, portals for electronic services, video hosting platforms, thematic portals

These are just some of the technical types of websites we work with, and each of them can have its own specific features and functionality, as well as be customized to meet the specific needs and goals of the client.

Our competencies:
Development stages
Latest works
  • image_web-applications_feedme_466_0.webp
    Development of a web application for FEEDME
    1161
  • image_ecommerce_furnoro_435_0.webp
    Development of an online store for the company FURNORO
    1041
  • image_crm_enviok_479_0.webp
    Development of a web application for Enviok
    822
  • image_crm_chasseurs_493_0.webp
    CRM development for Chasseurs
    847
  • image_website-sbh_0.png
    Website development for SBH Partners
    999
  • image_website-_0.png
    Website development for Red Pear
    451

GraphQL Federation: Unifying Microservices into One Graph

GraphQL Federation (Apollo Federation 2) allows different teams to own different parts of a GraphQL schema. Each service publishes its subgraph, a Router combines them into one federated graph. Clients see one entry point, one query language—unaware of internal microservice structure.

Architecture

Client → Router (Apollo Router) → Users Subgraph
                                → Products Subgraph
                                → Orders Subgraph
                                → Reviews Subgraph

Router receives GraphQL queries, builds execution plan, and calls needed subgraphs in parallel or sequence, merging results.

Subgraph: Users Service

# users-service/schema.graphql
extend schema
  @link(url: "https://specs.apollo.dev/federation/v2.3",
        import: ["@key", "@shareable"])

type Query {
  me: User
  user(id: ID!): User
}

type User @key(fields: "id") {
  id: ID!
  name: String!
  email: String!
  createdAt: String!
}
// users-service/server.js
import { ApolloServer } from '@apollo/server'
import { buildSubgraphSchema } from '@apollo/subgraph'

const typeDefs = gql`...` // schema above

const resolvers = {
  Query: {
    me: (parent, args, context) => context.db.users.findById(context.userId),
    user: (parent, { id }, context) => context.db.users.findById(id)
  },

  User: {
    // Reference resolver: Router requests User by id from other service
    __resolveReference: async ({ id }, context) => {
      return context.db.users.findById(id)
    }
  }
}

const server = new ApolloServer({
  schema: buildSubgraphSchema({ typeDefs, resolvers })
})

Subgraph: Products Service

# products-service/schema.graphql
extend schema
  @link(url: "https://specs.apollo.dev/federation/v2.3",
        import: ["@key", "@external", "@requires", "@provides"])

type Query {
  products(categoryId: ID, limit: Int): [Product!]!
  product(id: ID!): Product
}

type Product @key(fields: "id") {
  id: ID!
  name: String!
  price: Float!
  stock: Int!
  categoryId: ID!
}

# Extend User type from users-service
type User @key(fields: "id") {
  id: ID!
  # Add wishlist field to User owned by users-service
  wishlist: [Product!]!
}

Composition and Deployment

# supergraph.yaml
federation_version: =2.3

subgraphs:
  users:
    routing_url: http://users-service:4000
  products:
    routing_url: http://products-service:4000
  orders:
    routing_url: http://orders-service:4000
# Generate composed schema
rover supergraph compose --config supergraph.yaml > supergraph.graphql

# Start router
docker run -p 4000:4000 \
  -v ./supergraph.graphql:/etc/apollo/supergraph.graphql \
  ghcr.io/apollographql/router:latest

Benefits

  • Team autonomy: each team owns their subgraph
  • Incremental adoption: migrate services one by one
  • Shared types: reference types across subgraphs
  • Single endpoint: clients unaware of microservices

Timelines

Basic federation setup (3 subgraphs, Router): 2–3 days. Complex multi-team setup with custom directives, advanced composition: 1–2 weeks.