Answer the question
In order to leave comments, you need to log in
Frontend and backend on TS in one repository?
Hello, there is a backend on nestjs, a frontend on vue, in both cases everything is on typescript, I would like to reuse types on both the frontend and backend, that is, some kind of local package types. Googling on this topic, I found a solution in the form of npm workspaces. But how, for example, to be in a situation when the local types package has been updated, to update the version in the frontend and backend at once? Or maybe I'm not looking in the right place?
Answer the question
In order to leave comments, you need to log in
Yes, npm and yarn have workspaces. npm workspaces has been working since version 15 of the node, but now the stable version of the node is considered to be version 14. That is, formally dragging npm 7 into production is not yet the most reliable solution. Yarn in this case will be more stable.
When the package has been updated - yes, update both the backend and the frontend at once.
Alternative approach: you can develop a backend in a separate turnip, in a separate frontend. Types should be published as a package of dependencies and installed in the frontend turnip.
On the other hand, any changes to the backend should not break backward compatibility. Otherwise, you roll out a back release with an unupdated front - the application stops working. And if changes to the backend are backwards compatible, then you won’t have to immediately adapt the frontend code from changing types, even if everything lives in the same repository and is managed through workspaces.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question