
Research
/Security News
Miasma Mini Shai-Hulud Hits ImmobiliareLabs npm Packages
Miasma Mini Shai-Hulud hits @immobiliarelabs Backstage plugins, targeting GitLab and LDAP auth packages on npm.
@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
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.

Research
/Security News
Miasma Mini Shai-Hulud hits @immobiliarelabs Backstage plugins, targeting GitLab and LDAP auth packages on npm.

Security News
Rolldown paused Rust React Compiler integration after a 5MB binary size increase raised concerns about shipping React-specific code to all Vite users.

Security News
/Research
Mini Shai-Hulud expands into the Go ecosystem after hitting LeoPlatform npm packages and targeting GitHub Actions workflows.