My setup involves a server (TypeScript, NestJS) and a client (TypeScript, Angular) that communicate with each other.
Right now, I have the API response DTO classes defined in both the server to output data and in the client to decode the responses into a class. This doesn't seem like an efficient solution.
Is there a better way to share the API response DTOs between these two projects? And if not, why is it not a good idea?
Ideally, I want to be able to easily modify the API response format on the server side without causing issues for the client. Since my project is still in its early beta stage and I handle deployment for both client and server, many of these changes can break things.
Currently, the DTOs are stored in separate git repositories, but I'm open to changing this if necessary.