# spekvet

> A runtime validation and assertion library for server-side invariants.

Latest version **2026.9.24** (published 2026-09-23) · 0 weekly downloads

## Install

```sh
npm install spekvet
pnpm add spekvet
yarn add spekvet
bun add spekvet
```

## Health

**Score 60/100 (C)** — status: active.

Positive: esm support; no vulnerabilities; recently updated; high maintenance score.

Warnings: low downloads; no types.

## Facts

| | |
|---|---|
| Version | 2026.9.24 |
| Published | 2026-09-23 |
| First published | 2026-09-23 |
| Weekly downloads | 0 |
| TypeScript types | none |
| Module format | ESM + CommonJS |
| Dependencies | 0 |
| Unpacked size | 33.6 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| Maintainers | datafilter |
| Keywords | spec, validation, invariants |

## Links

- npm: https://www.npmjs.com/package/spekvet
- npm.io page: https://npm.io/package/spekvet

## Alternatives

- [@sindresorhus/slugify](https://npm.io/package/@sindresorhus/slugify.md) — 3.7M weekly downloads
- [solid-js](https://npm.io/package/solid-js.md) — 2.7M weekly downloads
- [expo-glass-effect](https://npm.io/package/expo-glass-effect.md) — 2.5M weekly downloads
- [nanoassert](https://npm.io/package/nanoassert.md) — 780.8K weekly downloads
- [@ffmpeg/ffmpeg](https://npm.io/package/@ffmpeg/ffmpeg.md) — 529.5K weekly downloads

## Recent versions

- 2026.9.24 (latest) — 2026-09-23
- 2026.9.23 — 2026-09-23

## README

# spekvet

Spekvet is a backend-focused JavaScript validator with a compact, composable API. Its single small module suits serverless functions while supporting arbitrary executable schemas, including recursive ones. It keeps validation strict and transparent: schemas validate rather than transform, and callers control coercion and security limits.

## Features

- One small, dependency-free module with no compilation
- Strict validation without coercion
- Synchronous predicates and fail-fast behavior
- Composable executable schemas
- Machine-readable `.diff()` results and throwing `.assert()` checks

## Example

```javascript
import { spec } from 'spekvet';

const user = spec({
  name: spec.string,
  age: spec.number.min(0),
});

user.diff({ name: 42, age: 20 });
// { kind: 'type', expected: 'string', input: 42, path: ['name'] }

user.assert({ name: 'Ada', age: 36 });
// Returns the input unchanged.
```

See the [walkthrough](./docs/walkthrough.md) for the complete API, recursive validation, error shapes, and practical recipes.

---
_Source: https://npm.io/package/spekvet · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
