Tuesday, March 15, 2022

Frontend and GraphQL

 But there are still GraphQL and disadvantages that can make development difficult:

Incompatibility with old backend applications. Developer resources are limited, and getting programmers to remake an old architecture requires a lot of negotiation time. Also, there are still concerns that GraphQL will eventually lose relevance and all the work will be in vain.


GraphQL responses are large. If a standard JSON response with similar data weighs 100 KB, then its GraphQL counterpart can reach several megabytes. Therefore, in some cases, you have to use the good old JSON.


As the number of clients increases, the Node. js can be overloaded. This can be fixed by running it in multiple threads. True, then there will be a problem with synchronization, but it can also be solved.


Each developer can evaluate for himself what will outweigh in the case of his project: the advantages of GraphQL or its disadvantages. The X5 team decided for themselves that they would continue to use this system, as the wide choice of tools makes it flexible enough for their development area.

GraphQL technology

 Assortment Pyaterochka is an application based on GraphQL technology (API is based on Apollo Server), with the help of which sellers decide how to arrange goods more efficiently. There are 4,000 products per 17,000 stores, and each product can have up to 100 columns with different parameters, so the requirements for the application are quite high.

GraphQL technology has a number of advantages:

  • You can work in a declarative style and specify in each request which fields and operations are required. When you need to get only a few fields from 100 product columns, this helps a lot.
  • It is possible to transfer very complex data that includes redundant type information.
  • In one request, you can access many resources at once, collecting a complex structure from several entities. If a traditional REST API were used, then several consecutive requests would have to be made, each time extracting a piece of useful information for the next request in the chain.
  • Apollo Server has a subscription system and a built-in cache.

Frontend and GraphQL

 But there are still GraphQL and disadvantages that can make development difficult: Incompatibility with old backend applications. Developer...