{"id":46569476,"url":"https://github.com/siyavuyachagi/vuesanity","last_synced_at":"2026-03-07T08:08:58.768Z","repository":{"id":278772691,"uuid":"936723843","full_name":"siyavuyachagi/vuesanity","owner":"siyavuyachagi","description":"A lightweight and flexible Vue/Nuxt validation utility designed to simplify model validations in Vue applications. Built with TypeScript for type safety and performance.","archived":false,"fork":false,"pushed_at":"2026-03-07T06:46:44.000Z","size":15688,"stargazers_count":2,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2026-03-07T06:48:31.279Z","etag":null,"topics":["backend","form-validation","forms","frontend","model-validation","nuxt","typescript","validations","validator","vue"],"latest_commit_sha":null,"homepage":"https://www.npmjs.com/package/@siyavuyachagi/vuesanity?activeTab=readme","language":"HTML","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/siyavuyachagi.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":".github/funding.yml","license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null,"notice":null,"maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null},"funding":{"github":"siyavuyachagi","custom":["https://paypal.me/siyavuyachagi","https://buymeacoffee.com/siyavuyachagi"]}},"created_at":"2025-02-21T15:19:27.000Z","updated_at":"2026-03-07T06:29:40.000Z","dependencies_parsed_at":"2025-10-17T09:14:24.771Z","dependency_job_id":"81a42478-7786-4cbe-b02c-2bf5c3dd774e","html_url":"https://github.com/siyavuyachagi/vuesanity","commit_stats":null,"previous_names":["ceejayviii/vuesanity","siyavuyachagi/vuesanity"],"tags_count":7,"template":false,"template_full_name":null,"purl":"pkg:github/siyavuyachagi/vuesanity","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/siyavuyachagi%2Fvuesanity","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/siyavuyachagi%2Fvuesanity/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/siyavuyachagi%2Fvuesanity/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/siyavuyachagi%2Fvuesanity/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/siyavuyachagi","download_url":"https://codeload.github.com/siyavuyachagi/vuesanity/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/siyavuyachagi%2Fvuesanity/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":30209516,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-03-07T05:23:27.321Z","status":"ssl_error","status_checked_at":"2026-03-07T05:00:17.256Z","response_time":53,"last_error":"SSL_read: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["backend","form-validation","forms","frontend","model-validation","nuxt","typescript","validations","validator","vue"],"created_at":"2026-03-07T08:08:58.318Z","updated_at":"2026-03-07T08:08:58.760Z","avatar_url":"https://github.com/siyavuyachagi.png","language":"HTML","funding_links":["https://github.com/sponsors/siyavuyachagi","https://paypal.me/siyavuyachagi","https://buymeacoffee.com/siyavuyachagi","https://patreon.com/siyavuyachagi"],"categories":[],"sub_categories":[],"readme":"# VueSanity\n\n[![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT)\n[![npm version](https://img.shields.io/npm/v/@siyavuyachagi/vuesanity.svg)](https://www.npmjs.com/package/@siyavuyachagi/vuesanity)\n[![npm downloads](https://img.shields.io/npm/dm/@siyavuyachagi/typesharp.svg?label=Downloads)](https://www.npmjs.com/package/@siyavuyachagi/typesharp)\n[![GitHub stars](https://img.shields.io/github/stars/siyavuyachagi/typesharp?label=Stars)](https://github.com/siyavuyachagi/typesharp/stargazers)\n[![Sponsor](https://img.shields.io/badge/Sponsor-💖-ff69b4)](https://github.com/sponsors/siyavuyachagi)\n\nA lightweight and flexible Vue3/Nuxtjs validation utility designed to simplify form validation and state management in Vue applications. Built with TypeScript for enhanced type safety and optimal performance.\n\n## Why VueSanity?\n\nUnlike Vuelidate, VueSanity lets you wrap your model with both props and validations in one place — no separate rules objects, no boilerplate, no headaches.\n- ✅ All-in-one reactive model + validation\n- ✅ Clean, type-safe, and ready for FormData\n- ✅ Immediate validation feedback\n- ✅ Generic typing with `createModel\u003cT\u003e` for fully type-safe forms\n\nIt's faster to set up, easier to read, and simpler to maintain, so you can focus on building features, not wiring forms.\n\n## Features\n\n- **Type-Safe Validation**: Built entirely with TypeScript for robust type checking and developer experience\n- **Generic Form Models**: `createModel\u003cT\u003e` infers field types directly from your DTO interfaces\n- **Reactive Model Management**: Seamlessly integrates with Vue 3's reactivity system\n- **Comprehensive Validators**: 27+ built-in validators for booleans, strings, files, numbers, and dates\n- **Real-time Validation**: Provides immediate feedback with detailed error messages\n- **FormData Generation**: Automatically converts your validated models into FormData objects for API submissions\n- **Custom Validation Rules**: Easily extend with your own validation rules\n- **Zero Dependencies**: Lightweight library with Vue 3 as the only peer dependency\n\n## Installation\n\n```bash\nnpm install @siyavuyachagi/vuesanity\n```\n\nor\n\n```bash\nyarn add @siyavuyachagi/vuesanity\n```\n\n## Quick Start\n\n### With `createModel\u003cT\u003e` (Recommended)\n\n```typescript\nimport VueSanity, { createModel, required, email, minChars } from '@siyavuyachagi/vuesanity';\n\ninterface LoginDto {\n  email: string;\n  password: string;\n}\n\nconst loginForm = createModel\u003cLoginDto\u003e({\n  email: {\n    value: '',\n    validations: [required('Email is required'), email()]\n  },\n  password: {\n    value: '',\n    validations: [required('Password is required'), minChars(8)]\n  }\n});\n\nconst form = new VueSanity(loginForm);\n\nconsole.log(form.isValid);           // boolean\nconsole.log(form.errors);            // { email: [...], password: [...] }\nconsole.log(form.normalizedModel);   // { email: '...', password: '...' }\nconsole.log(form.formData);          // FormData instance\n```\n\n### With `reactive\u003cModelConfig\u003cT\u003e\u003e` (Manual)\n\n```typescript\nimport { reactive } from 'vue';\nimport VueSanity, { required, email, minChars } from '@siyavuyachagi/vuesanity';\nimport type { ModelConfig } from '@siyavuyachagi/vuesanity';\n\ninterface LoginDto {\n  email: string;\n  password: string;\n}\n\nconst loginForm = reactive\u003cModelConfig\u003cLoginDto\u003e\u003e({\n  email: {\n    value: '',\n    validations: [required('Email is required'), email()],\n    errors: []\n  },\n  password: {\n    value: '',\n    validations: [required('Password is required'), minChars(8)],\n    errors: []\n  }\n});\n\nconst form = new VueSanity(loginForm);\n```\n\n\n## Available Validators\n\n### Boolean Validators\n\n| Validator | Description | Example |\n|-----------|-------------|---------|\n| `mustBeTrue(message?)` | Value must be true | `mustBeTrue('You must accept the terms')` |\n| `mustBeFalse(message?)` | Value must be false | `mustBeFalse()` |\n\n### Date Validators\n\n| Validator | Description | Example |\n|-----------|-------------|---------|\n| `minDate(date, message?)` | Minimum date validation | `minDate(new Date('2024-01-01'))` |\n| `maxDate(date, message?)` | Maximum date validation | `maxDate(new Date())` |\n| `rangeDate(minDate, maxDate, message?)` | Date range validation | `rangeDate(min, max)` |\n\n### File Validators\n\n| Validator | Description | Example |\n|-----------|-------------|---------|\n| `fileExtension(exts, message?)` | Validates file extensions | `fileExtension(['pdf', 'docx'])` |\n| `maxFileSize(sizeMB, message?)` | Validates maximum file size | `maxFileSize(5, 'Max 5MB')` |\n| `minFileSize(sizeMB, message?)` | Validates minimum file size | `minFileSize(0.1)` |\n| `fileSize(sizeMB, message?)` | Validates exact file size | `fileSize(2)` |\n| `fileType(allowedTypes, message?)` | Validates file MIME types | `fileType([\"image/*\", \"application/pdf\"], 'Only images and pdf')` |\n\n### Number Validators\n\n| Validator | Description | Example |\n|-----------|-------------|---------|\n| `minNumber(value, message?)` | Minimum number value | `minNumber(0, 'Must be positive')` |\n| `maxNumber(value, message?)` | Maximum number value | `maxNumber(100)` |\n| `rangeNumber(min, max, message?)` | Number range validation | `rangeNumber(1, 100)` |\n\n### String Validators\n\n| Validator | Description | Example |\n|-----------|-------------|---------|\n| `alpha(allowSpaces?, message?)` | Alphabetic characters only | `alpha(true, 'Letters only')` |\n| `alphanumeric(allowSpaces?, message?)` | Letters and numbers only | `alphanumeric()` |\n| `chars(length, message?)` | Validates exact character length | `chars(10, 'Exactly 10 chars')` |\n| `differentFrom(compareValue, message?)` | Ensures value differs from another | `differentFrom(() =\u003e model.oldPass.value, 'New password must be different')` |\n| `email(domains?, message?)` | Validates email format with optional domain restrictions | `email(['gmail.com'], 'Invalid email')` |\n| `maxChars(length, message?)` | Ensures maximum character length | `maxChars(50, 'Max 50 chars')` |\n| `minChars(length, message?)` | Ensures minimum character length | `minChars(8, 'Min 8 chars')` |\n| `numeric(allowDecimals?, allowNegative?, message?)` | Numbers only | `numeric(true, false)` |\n| `password(message?)` | Validates password strength | `password('Password must be stronger')` |\n| `phone(locale?, message?)` | Validates phone number format (E.164) | `phone('ZA', 'Invalid phone')` |\n| `regex(pattern, message?)` | Custom regex pattern matching | `regex(/^[A-Z]{3}\\d{3}$/)` |\n| `required(message?)` | Ensures field is not empty | `required('Field required')` |\n| `sameAs(compareValue, message?)` | Compares with another field | `sameAs(() =\u003e form.password.value)` |\n| `url(message?)` | Validates URL format | `url('Invalid URL')` |\n\n## Documentation\n\nFor detailed usage instructions and advanced examples:\n\n* Export Structure \u0026 Organization: [/docs/export-structure-organization.md](./docs/export-structure-organization.md)\n* Project Statistics: [/docs/project-stats.md](./docs/project-stats.md)\n* Quick Reference Commands: [/docs/quick-reference-commands.md](./docs/quick-reference-commands.md)\n* Usage Guide: [/docs/usage.md](./docs/usage.md)\n\n## License\n\nThis project is licensed under the MIT License - see the [LICENSE](LICENSE) file for details.\n\n## Author\n\nChagi Siyavuya (CeeJay) - [@siyavuyachagi](https://github.com/siyavuyachagi)\n\n## 💖 Sponsor VueSanity\n\nVueSanity is an open-source form validation and utility library for Vue/Nuxt — built and maintained by [@siyavuyachagi](https://github.com/siyavuyachagi).\n\nYour sponsorship helps me dedicate more time to improving the library, adding new validators, maintaining documentation, and providing ongoing support.\n\n### ☕ Ways to Support\n\nIf VueSanity has saved you time or made your project better, consider sponsoring the work behind it:\n\n- 💖 **GitHub Sponsors:** [Sponsor@siyavuyachagi](https://github.com/sponsors/siyavuyachagi)\n- ☕ **Buy Me a Coffee:** [buymeacoffee.com/siyavuyachagi](https://buymeacoffee.com/siyavuyachagi)\n- 💸 **PayPal:** [paypal.me/siyavuyachagi](https://paypal.me/siyavuyachagi)\n- 🎯 **Patreon:** [patreon.com/siyavuyachagi](https://patreon.com/siyavuyachagi)\n\n---\n\n### 🧠 Why Sponsor?\n\nVueSanity is designed for **clean, reusable, and declarative validation in Vue**.  \nIf you or your team depend on it, your contribution ensures it continues to evolve sustainably.\n\nEvery sponsor, no matter the amount, makes a difference.  \nThank you for supporting open source 💚","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsiyavuyachagi%2Fvuesanity","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fsiyavuyachagi%2Fvuesanity","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsiyavuyachagi%2Fvuesanity/lists"}