title: Where in the MEAN stack should validation rules be created?
body: <p>I'm creating an application using the MEAN stack, which has a lot of form data entry that is persisted to the database from both authenticated and anonymous users.</p>
  
  <p>Where in the stack should I create all my validation rules? Should they be in AngularJS? But I would like my server side API to be secure, so perhaps they should be in Express and then get bubbled up to AngularJS? Or should they be all the way down at the MongoDB layer (I'll be using using Mongoose, so it's easy to create validation there). </p>
  
  <p>Currently I have them spread all over, and am finding myself duplicating rules. I'd like to avoid that and create the rules in one place. So what are the general rules for defining validation in a MVW application, and which layer is it best to have them at (especially for a MEAN application)?</p>