Reuse same validation logic on client and server

With the uncertain future of Blitz.js and RedwoodJS already for some time on my radar, I think about migrating a nearly ready to release form heavy medical application to RedwoodJS. One thing I would miss when using RedwoodJS is to reuse the same form/data validation logic on the client and the server. With Blitz, I use the wonderful Zod validation library together with the form resolvers of React Hook Form. That way I could reuse the same validation logic on the client and the server.

Unfortunately, there seems to be no such feature in RedwoodJS. Here the client side form validation seems to be completely independent (and not reusable) from the server side service validation. I wonder a bit why RedwoodJS does not use something like Zod or a different validation library that is supported by React Hook Form resolvers. At least this would be possible then.

6 Likes