Docs
Launch GraphOS Studio

GraphQL as an abstraction layer

architecture-patterns

One of the advantages of using GraphQL is that it provides an abstraction between service consumers and the teams maintaining the backend services.

In a backend-for-frontend (BFF) architecture, each BFF connects to any number of backend services. As you add new BFFs for each application, the number of connections proliferates, and changes to any backend services have major implications.

🖥️ App
📱 App
📱 App
🖥️ App
🖥️ App
BFF
BFF
BFF
BFF
BFF
REST Service 1
REST Service 2
REST Service 3
REST Service 4
REST Service 5
SOAP Service 1
SOAP Service 2
SOAP Service 3
SOAP Service 4
SOAP Service 5
gRPC Service 1
gRPC Service 2
gRPC Service 3
gRPC Service 4
gRPC Service 5

Service migration example

Suppose a company has an architecture with ten applications, each with its own BFF. The company is migrating one of many backend APIs to a different technology. As a result of the BFFs owning data orchestration, the organization must update ten different BFFs.

To avoid breaking changes, clients must:

  • be aware of what is happening during those change,
  • track timelines,
  • and track changes to names.
🖥️ App
📱 App
📱 App
🖥️ App
🖥️ App
🖥️ App
📱 App
📱 App
🖥️ App
🖥️ App
BFF
BFF
BFF
BFF
BFF
BFF
BFF
BFF
BFF
BFF
❌ Old Service ❌
✨ New Service ✨

If the company used GraphQL as an abstraction layer, the consumers wouldn't need to know about this change because the organization has abstracted backend APIs behind a graph . The only change needed is at the GraphQL layer.

🖥️ App
📱 App
📱 App
🖥️ App
🖥️ App
🖥️ App
📱 App
📱 App
🖥️ App
🖥️ App
❌ Old Service ❌
✨ New Service ✨
✅ GraphQL ✅

As a company grows, this could eliminate hundreds of updates, deployments, and dependencies due to the reduced impact of changes to backend services.

Conclusion

GraphQL is a powerful tool for abstracting away the complexities of your backend services from front-end consumers. It can shield your consumers from major changes to those services while reducing the impact of those changes across your architecture. Ultimately, it provides choice and control to your consumers without negatively impacting your backend services.

Next
Home
Edit on GitHubEditForumsDiscord