toku
v0.1.5
Published
Universal schema-driven validation library for both frontend and backend. Backend-oriented, plugin-friendly, and form-library compatible.
Maintainers
Readme
toku
Universal schema-driven validation library for both frontend and backend.
Backend-oriented. Plugin-friendly. Built to power forms, APIs, and databases with a single source of schema truth.
✨ Features
- ✅ Centralized schema definitions
- ✅ Validate on both frontend (Formik, React Hook Form) and backend (Express, Fastify)
- ✅ Plugin-ready: generate DB tables, form inputs, API DTOs from the same schema
- ✅ TypeScript friendly
- ✅ Lightweight and fast
📦 Installation
npm install tokuor with yarn:
yarn add toku🚀 Quick Start
import { defineSchema, validate } from "toku";
const userSchema = defineSchema({
name: "string|min:3|max:20",
age: "number|min:18",
email: "email|required",
});
// validate some data
const result = validate(userSchema, {
name: "Alice",
age: 25,
email: "[email protected]",
});
if (result.success) {
console.log("Valid:", result.data);
} else {
console.log("Errors:", result.errors);
}🔌 Plugins (Coming Soon)
- 🛠️
@toku/sql– Generate SQL migrations from schema - 🧩
@toku/formik– Auto-generate Formik validation logic - 🧪
@toku/test– Generate randomized test data from schema
📚 Docs
Full documentation coming soon.
For now, check the /examples folder and follow updates here: https://github.com/manishgun/toku
👨💻 Author
Manish Gun
💼 manishgun.vercel.app
📧 [email protected]
🐙 github.com/manishgun
📄 License
MIT
