A NestJS project uses a ValidationPipe with class-validator to validate POST requests. It would be nice to use the same class-validator DTO in the (react) front-end .
How could the entities in the DTO be linked to react elements ?
This may be similar to How to Sync Front end and back end validation, but more focused on specific tools.
We had exactly the same need a couple of months ago with a NestJS backend and Angular frontend. What we've done is to create a third project called "API-Common" using NestJS where we've gathered all the common DTOs and utilities that are needed in both the backend and frontend. To share it, we create an NPM package from the project so we can import it in both applications.
You can learn more about creating your private NPM registry in the following link: