hapijs/joi ? reverse-engineered prompt

Reverse engineered prompt

Build me a JavaScript schema validation library like Joi.

I want to be able to define rules for strings, numbers, objects, arrays, and nested data, then validate input and get clear error messages when something does not match. It should feel easy to use in normal app code, so I can write a schema once and reuse it for request bodies, config, form data, and other inputs. Please include the common kinds of checks people expect, like required fields, minimum and maximum values, pattern matching, allowed values, and custom messages.

Make it work well in Node.js, with good tests and a clean public API. If you need to look up current docs online for expected behavior, go ahead. I also want a small browser friendly build if that fits naturally. Focus on making the library reliable, well documented, and pleasant to use, not just passing a few examples.

Are you gonna build this?

make sure you review the code using coderabbit

Try freeSponsored — opens CodeRabbit in a new tab