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 toku
or 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",
});
const result = validate(userSchema, {
name: "Alice",
age: 25,
email: "alice@example.com",
});
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
📧 mail.cto.manish@gmail.com
🐙 github.com/manishgun
📄 License
MIT