We’re using the Bloomreach SPA SDK with the Bloomreach React SDK for the company I’m currently working at. I’ve worked with numerous SDKs and tools in the past, but this has to be the worst SDK I’ve ever worked with. The lack of developer documentation, the way the SDK is overly complex, and the amount of any
types that are being used within the codebase is very problematic. The Bloomreach React SDK is still using class-based components even though functional components are the default standard. Even the React team has acknowledged that you should use functional components with hooks instead.
The way that the SDK expects the developer to pass the whole page object down the component tree is a terrible design decision and a flaw in the way the SDK has been architected. Why do I need to ask the page to get me the correct link and do I have to pass the page object five components down the tree? Why doesn’t a Bloomreach component simply accept the data that’s being returned from the Bloomreach API and store the rest of the page inside a useBloomreachPage
hook that’s using a context behind the scenes? If a component down the tree needs Bloomreach-specific information, it can simply use the useBloomreachPage
hook to get the data.
The SDK doesn’t allow developers to create type-safe applications as it isn’t even possible to use generics to determine the type of a component. Everything is an any
-type in our codebase because the SDK simply doesn’t allow using generics to type the components, documents, menus, and other elements. Because of this, we have to use empty checks (?.
) all over the place to make sure the data that’s being put inside the components are valid. This is a terrible developer experience and makes using TypeScript in our codebase almost impossible. The SDK should provide a set of simple types that the developers can expand upon.
The lack of documentation also doesn’t help with the state of the SDK. Take a look at the developer docs of Builder.io for instance. This is a golden standard that should be aimed for and makes it clearer how the SDK can be used in React or other frontend frameworks. Instead, you squeeze all the docs inside a single README.md file and call it a day. It shows the lack of care for other developers who want to integrate the SDK into their projects. This is also evident by the fact that you don’t allow the creation of issues in the GitHub project. I get it that the repo is mirrored, but disallowing this and only being able to improve the SDK by adding a lengthy post to these forums creates a more significant division between the developers who want to integrate and use the Bloomreach SDK in their project and its maintainers.
I tried understanding the code, but the level of unnecessary abstractions makes the Bloomreach SDK too complex to understand. Why doesn’t the SDK simply provide the correct types/interfaces and helper functions/hooks that can be used to map the Bloomreach API to component props for instance? Why is the whole page class a God object and has way too many responsibilities? I tried figuring out how the connection between the experience manager and the Bloomreach SDK is established, but after browsing through the code for more than an hour, I still have no clue how this is being done. The SDK is clearly designed by a backend developer who applies their knowledge to the front end and it shows. In my opinion, a frontend package should be procedural and not Object-Oriented. It should consist of a simple set of primitives, functions, and types. Just as with React, Vue, Solid, and/or Svelte.
In my opinion, the SDK should aim for simple-to-use helper functions for various parts of the application. getParametersFromComponent
, mapModelToElementWithPage
, or fetchBloomreachPage
. Small and easy-to-understand functions; each with one goal and one responsibility. I’ve been able to rewrite a huge part of the application using these primitives, so it can be done and I can show how.
I just wanted to voice my concerns about the state of the Bloomreach SPA SDK and hopefully get something done to improve its state.
With kind regards,
Peter