Timeline for Monorepo dilemma: Where do you store your common business logics?
Current License: CC BY-SA 4.0
9 events
when toggle format | what | by | license | comment | |
---|---|---|---|---|---|
Dec 27, 2023 at 12:33 | comment | added | nishant_boro | They are actually querying the same database and same db queries. Hence the same structure of the APIs but just that few datapoints maybe eliminated from api B. Also in both pages we show different data points. Hence i think it makes sense to create a common type and then use Pick to cherrypick certain data points from the common type in both the apps | |
Dec 27, 2023 at 12:24 | comment | added | Doc Brown | "2 apis from 2 different backend microservices" sounds like those APIs look equal by chance, and not intentionally, in which case duplicate code is usually preferable over the coupling one gets by reuse. You have to use your best judgement - do you expect the APIs to change indepently from each other? Or would it be an error if one of the APIs is changed, but the other one forgotten? | |
Dec 27, 2023 at 12:02 | comment | added | nishant_boro |
Also one more thing, what do you think of code duplication ? Say in app A i have an api response of structure: interface ApiA { managers: object[] } and in app B a different api but same structure: interface ApiB { managers: object[] } . These 2 apis are served from 2 different backend microservices but response strucure is same (for now atleast). Would it be alright to duplicate the types for both the apps or should i move to a common package ?
|
|
Dec 27, 2023 at 11:40 | vote | accept | nishant_boro | ||
Dec 27, 2023 at 11:40 | comment | added | nishant_boro | Sure that helps! Thanks. | |
Dec 27, 2023 at 9:38 | history | edited | Doc Brown | CC BY-SA 4.0 |
added 237 characters in body
|
Dec 27, 2023 at 9:29 | history | edited | Doc Brown | CC BY-SA 4.0 |
deleted 50 characters in body
|
Dec 27, 2023 at 9:17 | history | edited | Doc Brown | CC BY-SA 4.0 |
added 527 characters in body
|
Dec 27, 2023 at 9:06 | history | answered | Doc Brown | CC BY-SA 4.0 |