We are using Firebase which is probably similar to MongoDB in that it stores arbitrary JSON structures. We are also using Node.js and so the library in question could in theory be used both backend and frontend.So yes we have a models library which has code to create a model and run special validation methods including setters which will validate upon setting model data. After validation, we have objects which we can put in the DB. Firebase also has validation which we will use (and perhaps in the end it will be the only validation we need?).It would be extremely useful to use this validation library everywhere, including the front-end. The problem is that our DB schemas are in the code that needs to be sent to the front-end for the library to work.How bad of an idea is it to send the schemas to the front-end?I believe we are mostly interested in protecting our proprietary information, and given that, I don't think plain code will do.We could send JSON data representing the schemas to the front-end along with the code and then dynamically set the schemas, that adds a layer of obfuscation to my knowledge, but seems complicated.Anyone have experience with this type of problem?Seems like there would be a lot of value added to having the same JS library front-end and back-end.
Putting NoSQL DB schemas on front-end, safely
javascript;node.js;validation;nosql;front end