# specma

> Simple, reusable and composable validation

Latest version **3.1.1** (published 2026-02-05) · ISC license · 0 weekly downloads

## Install

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

## Health

**Score 45/100 (D)** — status: stable.

Positive: no vulnerabilities.

Warnings: low downloads; no types; no esm support.

## Facts

| | |
|---|---|
| Version | 3.1.1 |
| Published | 2026-02-05 |
| First published | 2020-10-01 |
| Weekly downloads | 0 |
| License | ISC |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 0 |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 0 |
| Author | David Savoie |
| Maintainers | davidsavoie1 |
| Keywords | spec, schema, validation, composition, ensure, conform, validate, predicates |

## Links

- npm: https://www.npmjs.com/package/specma
- Repository: https://github.com/davidsavoie1/specma
- Homepage: https://davidsavoie1.github.io/specma
- Issues: https://github.com/davidsavoie1/specma/issues
- npm.io page: https://npm.io/package/specma

## Alternatives

- [vest](https://npm.io/package/vest.md) — 50.1K weekly downloads
- [@regle/core](https://npm.io/package/@regle/core.md) — 47.0K weekly downloads
- [typeof-arguments](https://npm.io/package/typeof-arguments.md) — 12.5K weekly downloads
- [@lokalise/projects-engine-contracts](https://npm.io/package/@lokalise/projects-engine-contracts.md) — 978 weekly downloads
- [@osjwnpm/nam-laboriosam-quibusdam](https://npm.io/package/@osjwnpm/nam-laboriosam-quibusdam.md) — 70 weekly downloads

## Recent versions

- 3.1.1 (latest) — 2026-02-05
- 3.1.0 — 2022-01-07
- 3.0.1 — 2021-10-22
- 3.0.0 — 2021-10-20
- 2.3.5 — 2021-01-14
- 2.3.4 — 2021-01-12
- 2.3.3 — 2020-12-07
- 2.3.2 — 2020-11-26
- 2.3.1 — 2020-11-24
- 2.3.0 — 2020-11-19
- 2.2.1 — 2020-11-17
- 2.2.0 — 2020-11-16
- 2.1.5 — 2020-11-13
- 2.1.4 — 2020-11-09
- 2.1.3 — 2020-11-09
- … 10 more at https://npm.io/package/specma/versions

## README

# Specma

_Simple, reusable and composable validation_

Specma is a Javascript library to validate any type of value against a **simple, reusable and composable spec**.

- Collection specs defined with the exact **same shape as the value**!
- Based on **predicate functions** of type `true || "reason"`
- **Composable specs** with intuitive `and`/`or` operators
- Easy **cross-validation** between multiple fields
- User defined **customized invalid reasons**
- **Async validation** out of the box
- Very **small footprint**

[View complete documentation](https://davidsavoie1.github.io/specma)

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