# LIVR for JavaScript and TypeScript > LIVR for JavaScript and TypeScript: validation rules that are just data, the fastest validator in the benchmarks, zero dependencies and type inference from the schema. Essentials: - A schema is plain data: `{ field: rules }`, where rules are a rule name (`'required'`), a rule with arguments (`{ min_length: 8 }`) or a list of them. Rule names work in snake_case and camelCase. - `import LIVR from 'livr'`: `new LIVR.Validator(schema).validate(data)` returns the validated data, or `false` and the errors in `validator.getErrors()`. `import LIVR from 'livr/async'`: `new LIVR.AsyncValidator(schema).validate(data)` returns a promise that rejects with the errors. - TypeScript: write the schema `as const` and get the type with `InferFromSchema` from `livr/types`. - Custom rules: an alias (`registerAliasedRule()`) gives existing rules a name and an error code. A rule function (`registerRules()`) gets the rule arguments and returns `(value, allValues, outputArr) => errorCode | undefined`: it skips empty values (`undefined`, `null`, `''`) and pushes to `outputArr` to change the value. `registerDefaultRules()` and `registerAliasedDefaultRule()` register them for all validators. - Registering a rule does not give it a type. Declare the type of every custom rule and alias in `RuleTypes` with `declare module 'livr/types/inference'`: `As`, a plain type, `AliasType` or an interface that extends `RuleType`. See [Custom rules](https://js.livr-spec.org/guide/custom-rules.md) and [TypeScript](https://js.livr-spec.org/typescript.md). - Strict mode: a misspelled rule or a rule without a type is a compile error, instead of the `unknown` type. Turn it on in a new TypeScript project with `interface TypeOptions { strictRules: true }` in `declare module 'livr/types/inference'`. It is off by default: in an existing project, turn it on only once every rule has a type. See [Strict mode](https://js.livr-spec.org/typescript.md#strict-mode). ## Table of Contents ### Guide - [Getting started](https://js.livr-spec.org/guide/getting-started.md): Install livr, create a validator, read the errors, and get the TypeScript type of the validated data from the schema. - [Usage](https://js.livr-spec.org/guide/usage.md): Validating data, error codes, modifiers, auto-trim, async validation with AsyncValidator, smaller bundles and performance tips. - [Custom rules](https://js.livr-spec.org/guide/custom-rules.md): Your own rules: aliases of existing rules, rule functions, async rules, registering rules for all validators, and the TypeScript types of custom rules. - [Built-in rules](https://js.livr-spec.org/rules.md): The built-in rules of the LIVR specification with the TypeScript type of each rule. ### Reference - [TypeScript Type Inference](https://js.livr-spec.org/typescript.md) - [API](https://js.livr-spec.org/api.md): Validator and AsyncValidator: the constructor and its options, validate(), getErrors(), registering rules and aliases, and the exports of livr and livr/async. - [Changelog](https://js.livr-spec.org/changelog.md): Changes in every version of livr. ### Why LIVR - [Rules are just data](https://js.livr-spec.org/why/schemas-are-data.md): A LIVR schema is a plain JSON structure. Store it in a database, share it across languages, and load it safely from untrusted sources. - [Performance](https://js.livr-spec.org/why/performance.md): LIVR is the fastest JavaScript validator in the benchmarks, with rules fixed in code and with rules built at runtime, and it generates no code. - [Type inference](https://js.livr-spec.org/why/type-inference.md): TypeScript infers the type of the validated data from a LIVR schema, which is plain data. No second definition, no code generator. - [Zero dependencies](https://js.livr-spec.org/why/zero-dependencies.md): livr has no runtime dependencies. About 2 KB for the core and 13 KB with all 68 built-in rules, min+gzip. - [Proven by 13 years and a spec](https://js.livr-spec.org/why/proven.md): Maintained since 2013, built on the cross-language LIVR specification and its shared test suite, which collects edge cases found in every implementation. - [LIVR: Design Decisions](https://js.livr-spec.org/why/design-decisions.md)