{"id":14156626,"url":"https://github.com/AlexJPotter/fluentvalidation-ts","last_synced_at":"2025-08-06T03:31:00.610Z","repository":{"id":38428936,"uuid":"183819395","full_name":"AlexJPotter/fluentvalidation-ts","owner":"AlexJPotter","description":"A TypeScript-first library for building strongly-typed validation rules","archived":false,"fork":false,"pushed_at":"2024-03-05T16:48:00.000Z","size":1375,"stargazers_count":87,"open_issues_count":17,"forks_count":6,"subscribers_count":3,"default_branch":"main","last_synced_at":"2024-11-14T08:57:28.012Z","etag":null,"topics":["fluent","fluentvalidation","form","form-validation","formik","typescript","validation"],"latest_commit_sha":null,"homepage":null,"language":"TypeScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/AlexJPotter.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"License.txt","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}},"created_at":"2019-04-27T20:36:28.000Z","updated_at":"2024-11-03T15:57:45.000Z","dependencies_parsed_at":"2024-03-05T18:03:29.964Z","dependency_job_id":null,"html_url":"https://github.com/AlexJPotter/fluentvalidation-ts","commit_stats":null,"previous_names":[],"tags_count":26,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/AlexJPotter%2Ffluentvalidation-ts","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/AlexJPotter%2Ffluentvalidation-ts/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/AlexJPotter%2Ffluentvalidation-ts/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/AlexJPotter%2Ffluentvalidation-ts/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/AlexJPotter","download_url":"https://codeload.github.com/AlexJPotter/fluentvalidation-ts/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":228835541,"owners_count":17979163,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","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":["fluent","fluentvalidation","form","form-validation","formik","typescript","validation"],"created_at":"2024-08-17T08:07:25.456Z","updated_at":"2025-08-06T03:31:00.593Z","avatar_url":"https://github.com/AlexJPotter.png","language":"TypeScript","readme":"# fluentvalidation-ts\n\n[![CI](https://github.com/AlexJPotter/fluentvalidation-ts/actions/workflows/ci.yml/badge.svg?branch=main)](https://github.com/AlexJPotter/fluentvalidation-ts/actions/workflows/ci.yml)\n![Coverage](https://badgen.net/badge/coverage/100%25/green?icon=codecov)\n![Dependencies](https://badgen.net/badge/dependencies/none/green)\n[![GZIP Size](https://img.badgesize.io/https://unpkg.com/fluentvalidation-ts@latest/dist/index.js?compression=gzip)](https://unpkg.com/fluentvalidation-ts@latest/dist/index.js)\n\n[![NPM Version](https://badgen.net/npm/v/fluentvalidation-ts?icon=npm)](https://www.npmjs.com/package/fluentvalidation-ts)\n![License](https://badgen.net/npm/license/fluentvalidation-ts)\n![Last Commit](https://badgen.net/github/last-commit/alexjpotter/fluentvalidation-ts/main?icon=github)\n[![Open Issues](https://badgen.net/github/open-issues/alexjpotter/fluentvalidation-ts?icon=github)](https://github.com/AlexJPotter/fluentvalidation-ts/issues)\n\n## Strong, simple, extensible validation.\n\nVisit [https://fluentvalidation-ts.alexpotter.dev](https://fluentvalidation-ts.alexpotter.dev) to get started.\n\n## Overview\n\nFront-end validation is a must-have for any project that involves forms, but the requirements vary hugely. You might have a simple sign-up form with a few text fields, or a complex configuration page with collections and deeply nested fields.\n\nThere are plenty of libraries out there which help you to solve the problem of front-end validation, but all the ones I've tried have felt lacking in one aspect or another - whether that's TypeScript support, their capacity to handle complex requirements, or the ability to define your own reusable validation logic.\n\nSo I wrote **fluentvalidation-ts**, a tiny library that is:\n\n- Designed for **TypeScript**\n- Simple yet powerful\n- Fully extensible\n\nWhatever your validation needs, **fluentvalidation-ts** can handle them.\n\n## Docs\n\nFull documentation, including a tutorial and a number of useful guides, is available on the [documentation website](https://fluentvalidation-ts.alexpotter.dev).\n\n- [Overview](https://fluentvalidation-ts.alexpotter.dev/docs/overview)\n- [Tutorial](https://fluentvalidation-ts.alexpotter.dev/docs/tutorial)\n- [Guides](https://fluentvalidation-ts.alexpotter.dev/docs/guides/customrules)\n- [Core API Reference](https://fluentvalidation-ts.alexpotter.dev/docs/api/core/validator)\n- [Validation Rules API Reference](https://fluentvalidation-ts.alexpotter.dev/docs/api/rules/emailaddress)\n- [Releases](https://github.com/AlexJPotter/fluentvalidation-ts/releases)\n\n### Requirements\n\nThis library has been written in, and for, **TypeScript**. You can still use **fluentvalidation-ts** without TypeScript, but the primary benefit of having strongly-typed validation rules is lost.\n\nIf using TypeScript (strongly recommended), you must be on TypeScript version **`2.9`** or later.\n\n### Installation\n\nUsing NPM:\n\n```\nnpm i --save fluentvalidation-ts\n```\n\nUsing Yarn:\n\n```\nyarn add fluentvalidation-ts\n```\n\n\u003e [!TIP]\n\u003e There's no need to install types separately - **fluentvalidation-ts** has been written with first-class support for TypeScript!\n\n### Example Usage\n\n```typescript\nimport { Validator } from 'fluentvalidation-ts';\n\ntype Person = {\n  name: string;\n  age: number;\n};\n\nclass PersonValidator extends Validator\u003cPerson\u003e {\n  constructor() {\n    super();\n\n    this.ruleFor('name') // This is type-safe! (Argument is of type 'name' | 'age')\n      .notEmpty()\n      .withMessage('Please enter your name');\n\n    this.ruleFor('age').greaterThanOrEqualTo(0).withMessage('Age cannot be negative');\n  }\n}\n\nconst validator = new PersonValidator();\n\nvalidator.validate({ name: '', age: 25 });\n// { name: 'Please enter your name' }\n\nvalidator.validate({ name: 'Alex', age: -1 });\n// { age: 'Age cannot be negative' }\n\nvalidator.validate({ name: '', age: -1 });\n// { name: 'Please enter your name', age: 'Age cannot be negative' }\n```\n\n### Test Coverage\n\n**fluentvalidation-ts** has 100% test coverage via unit tests written with [Jest](https://jestjs.io/).\n\n\u003e [!NOTE]\n\u003e Some branches are incorrectly reported as uncovered due to the following issue: [https://github.com/gotwarlost/istanbul/issues/690](https://github.com/gotwarlost/istanbul/issues/690).\n\n### Issues\n\nPlease report issues via [GitHub](https://github.com/AlexJPotter/fluentvalidation-ts/issues).\n\n### License\n\n**fluentvalidation-ts** is provided under the terms of an [Apache-2.0](https://www.apache.org/licenses/LICENSE-2.0) license.\n\n### Development\n\nClone the repo and run `npm install`, then run `npm run watch` in the root of the project to start the TypeScript compiler in watch mode. You can run the tests with `npm test`.\n\n### About the Author\n\nAlex Potter is a full-stack Software Engineer, currently working as a Technical Lead at [Ghyston](https://www.ghyston.com), an award-winning software development company based in Bristol.\n","funding_links":[],"categories":["typescript"],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2FAlexJPotter%2Ffluentvalidation-ts","html_url":"https://awesome.ecosyste.ms/projects/github.com%2FAlexJPotter%2Ffluentvalidation-ts","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2FAlexJPotter%2Ffluentvalidation-ts/lists"}