
Security News
PolinRider: North Korea-Linked Supply Chain Campaign Expands Across Open Source Ecosystems
PolinRider expands across npm, Packagist, Go modules, and Chrome extensions, using hidden loaders to target developer environments.
@br-validators/express
Advanced tools
Express and Fastify middleware for Brazilian document validators — delegates to @br-validators/core
Express and Fastify middleware for Brazilian document validation — delegates to @br-validators/core v1.10.0 validate* functions (BR-GENERATE-001 / BR-VALIDATE parity).
pnpm add @br-validators/express @br-validators/core express
Peer dependencies: express ^4.21.0 || ^5.0.0, @br-validators/core
import express from 'express';
import { brValidate } from '@br-validators/express';
const app = express();
app.use(express.json());
app.post(
'/cliente',
brValidate({
body: { cpf: 'cpf', cnpj: 'cnpj', cep: 'cep' },
uf: { from: 'body', field: 'uf' },
}),
(req, res) => {
res.json({ ok: true });
},
);
Invalid input returns HTTP 400 with a structured body:
{
"ok": false,
"field": "cpf",
"code": "INVALID_CHECK_DIGIT",
"message": "..."
}
import Fastify from 'fastify';
import { brValidateFastify } from '@br-validators/express/fastify';
const app = Fastify();
app.post(
'/cliente',
{
preHandler: brValidateFastify({
body: { cpf: 'cpf', ie: 'inscricao-estadual' },
uf: { from: 'body', field: 'uf' },
}),
},
async () => ({ ok: true }),
);
| Option | Description |
|---|---|
body | Map field names → core validator type id |
query | Same for req.query |
params | Same for req.params |
uf | { from: 'body' | 'query' | 'params', field: 'uf' } or { value: 'SP' } — required for IE and RG |
cpf, cnpj, cep, placa, pis-pasep, pix, telefone, boleto, cartao-credito, cnh, renavam, nfe-chave, titulo-eleitor, processo-judicial, inscricao-estadual, inscricao-estadual-produtor-rural, brcode, rg
Official algorithm sources: docs/OFFICIAL-SOURCES.md.
MIT
FAQs
Express and Fastify middleware for Brazilian document validators — delegates to @br-validators/core
The npm package @br-validators/express receives a total of 1,340 weekly downloads. As such, @br-validators/express popularity was classified as popular.
We found that @br-validators/express demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Security News
PolinRider expands across npm, Packagist, Go modules, and Chrome extensions, using hidden loaders to target developer environments.

Security News
Open source attacks are accelerating as AI coding agents pull in dependencies faster, with less human review.

Research
/Security News
Malicious Chrome and Firefox extensions posed as free VPNs while stealing clipboard data through later extension updates.