D
D
drowzeenico2019-05-20 18:26:37
Node.js
drowzeenico, 2019-05-20 18:26:37

Grapqhl backend and React native app. Is it worth merging?

Good day. There is a project project: backend + mobile application.
It is just beginning, therefore the architecture has not yet settled down. The backend is written in Node.js + GraphQL(apollo), the front is written in React Native + Apollo-client.
It turns out that the types used in GrqphQL are the same on the back as on the front. Teamlead says that it is worth rebuilding these two projects into one, because:

  • since certain GraphQL types are the same
  • all types were in the same place
  • they could be reused without duplicating code (both on the back and front)

I, however, feel something is wrong with this approach, because:
  • These are different projects and their areas of responsibility are different.
  • shared code adds mutual dependency and breaks flexibility
  • in my experience I have not seen such a combination: the code was duplicated everywhere (but those were microservices)

Actually, now the question is: is it worth it to collect all this in one project? I hope for adequate criticism and arguments.

Answer the question

In order to leave comments, you need to log in

1 answer(s)
R
Robur, 2019-05-20
@Robur

Normally, the team leader tells you if you do it correctly. Single Source Of Truth rules.
- different projects may well remain different projects using the same common code for both. There are many ways to do this. monorepa, module, schema registry e.g.
- you already have a mutual dependency - a common GraphQL API. You can hardly change the scheme in one project and leave it old in another. Being able to store a schema separately and change it independently is not flexibility, it's a direct road to tons of problems and a lot of wasted time. Doesn’t it bother you that every time you change the scheme in one place, you must definitely go and change it in another so that they are always synchronized, and if you don’t do this / forget / typo / copy-paste it wrong, then something somewhere will definitely break? It was at this moment that one should feel something was wrong.
- if you did not see something - this does not mean that what you did not see is bad, but what you saw is good.
In general, it is worth doing - the main thing is to do it correctly. If you now dump all the code in one heap, then of course nothing good will come of it.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question