BT

Facilitating the Spread of Knowledge and Innovation in Professional Software Development

Write for InfoQ

Topics

Choose your language

InfoQ Homepage News The “Backends for Frontends” Pattern at SoundCloud

The “Backends for Frontends” Pattern at SoundCloud

This item in japanese

Lire ce contenu en français

Bookmarks

SoundCloud recently published an article about their implementation of the Backends for Frontends pattern, adopted in 2013 while beginning to migrate towards a microservices-based architecture. SoundCloud tech lead Jorge Creixell concluded that this pattern has significant drawbacks that its adopters must adequately manage while enjoying its advantages.

The Backends for Frontends (BFF) pattern consists of building gateway services tailored to each client’s specific needs. These clients may be frontend applications or external interfaces. At SoundCloud, the BFF services handled API gateway responsibilities, including rate limiting, authentication, header sanitisation, and cache control.

According to the author, the resulting higher number of services "can also be a source of problems if they’re not part of a broader service architecture that’s able to keep complexity and duplication at bay". Feature integrations tend to be implemented in each BFF service, leading to duplicated implementations of shared concerns -- such as authentication -- that diverge over time. 

At SoundCloud, the author saw a tendency to push complex client-side logic to the BFF. This logic shifting to the backend may work well in some cases, but the author points out that it may lead to problems. Giving the example of collecting all parts of a paginated collection to return it in one single request on the server-side, they note that it could lead to "fan-out storms that may bring the entire system down", among other consequences.

The specialisation inherent to BFF services allowed SoundCloud to optimise their APIs for whatever is convenient for each client type without the need for synchronisation points and difficult compromises. Since this pattern kept different clients and interfaces separated, it also allowed SoundCloud to experience improvements in resiliency and a higher pace of development.

The author considered that SoundCloud’s BFF implementation, with multiple, dedicated API gateways for each device or interface type, is different from other approaches and technologies like centralised API gateways and GraphQL. Furthermore, it requires extensive collaboration between front-end and back-end engineers; thus, "the idea of full autonomy for client developers is just an illusion".

Other experts in the field have a different perspective. For example, software architect Glenn Engstrand argued on InfoQ that GraphQL is a sensible choice for BFF services and that these services should behave as orchestrators and be owned by front-end teams.

SoundCloud’s system architecture continued to evolve after identifying the problems associated with their implementation of the BFF pattern. Further articles will be published in SoundCloud’s Backstage Blog detailing that evolution.

 

Rate this Article

Adoption
Style

Hello stranger!

You need to Register an InfoQ account or or login to post comments. But there's so much more behind being registered.

Get the most out of the InfoQ experience.

Allowed html: a,b,br,blockquote,i,li,pre,u,ul,p

Community comments

Allowed html: a,b,br,blockquote,i,li,pre,u,ul,p

Allowed html: a,b,br,blockquote,i,li,pre,u,ul,p

BT