For example in Symfony I always prefer to make the hard validation in the backend, to prevent some errors in the front validation. For example i make all the validation commonly in the yml files, and if i want in the front i can put some validation in the forms for example in jQuery or the used javascript framework. If you want you can take a look at Validation component