Let's say you have a user registration form in your frontend. In both, backend and frontend, password is valited so it has to match a set of requirements: more than 6 characters, no symbols, etc...

Imagine that these rules change. Both, backend and frontend client must be updated.

Does it make sense that the backend informs the frontend about this rules so the frontend can validate it with no need of performing a network request?

2 Answers 2


Depending on your backend / frontend setups, it might be possible to have the two share certain pieces of code by both referencing the same (3rd) library or package holding those rules - eg, an angular frontend and a node backend both referencing from other npm package which provides the functions needed to validate that password. This way you only need to ensure both are running the same version of that package, and then they will both follow the same rules.

this may not always be doable, especially if you are running a backend in a different language to the frontend. Eg, a c# backend and a javascript frontend. Unless you are able to bring the complexity of that functionality given by the backend to a common format usable on multiple languages, like Regex for password validation and then just provide a regex string which may be updated by the backend, then you are likely to run into issues from the increased complexity and likelihood of errors in interpreting whatever is passed.


I don't see why not.

But I would see such exchange as significant increase in complexity, as you need to define interchange format for the rule and implement interpretation of generic rules on client.

It is important question if this added complexity outweights effort of fixing the duplicate rules. And such question needs to be answered on case-by-case basis.


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.