npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

rjs-api

v2.0.0

Published

API para suporte de projetos RJS.

Downloads

20

Readme

📦 rjs-api

npm version downloads license typescript

Uma coleção de utilitários para Node.js/TypeScript com foco em produtividade, segurança e suporte a documentos brasileiros.
Inclui ferramentas para:

  • 📑 Documentos (CPF/CNPJ)
  • Datas com timezone
  • 🔐 Segurança (tokens, UUID, criptografia)
  • 🔑 Hash de senha
  • 🧱 Middlewares Express e Fastify

🚀 Instalação

npm install rjs-api

Ou:

yarn add rjs-api

📚 Recursos Inclusos


✨ 1. Documentos (CPF e CNPJ)

Arquivo: src/utils/documents.ts

Funções disponíveis:

  • formatCPF(cpf)
  • validateCPF(cpf)
  • unformatCPF(cpf)
  • formatCNPJ(cnpj)
  • validateCNPJ(cnpj)
  • unformatCNPJ(cnpj)

Exemplo:

import { documents } from "rjs-api";

documents.formatCPF("12345678901");
documents.validateCNPJ("12.345.678/0001-99");

✨ 2. Datas e Timezone

Baseado em moment-timezone

Funções:

  • formatDate(date, format, timezone?)
  • current(timezone?)

Exemplo:

import { time } from "rjs-api";

const agora = time.current();
const dataBR = time.formatDate(new Date(), "DD/MM/YYYY");

✨ 3. Segurança

Pasta: src/utils/security/

🔐 Criptografia (AES-256)

import { security } from "rjs-api";

const cipher = security.encryption.encrypt("texto", "chave-secreta");
const text = security.encryption.decrypt(cipher, "chave-secreta");

🔑 Hash de Senha (bcrypt)

const hash = await security.password.hashPassword("senha123");
const ok = await security.password.comparePassword("senha123", hash);

🧵 Tokens & UUID

security.tokens.generateToken(32);
security.tokens.generateUUID();

✨ 4. Middlewares (Express + Fastify)

Arquivos:

  • src/utils/security/middleware/express.ts
  • src/utils/security/middleware/fastify.ts

Exemplo com Express:

import express from "express";
import { security } from "rjs-api";

const app = express();
app.use(security.middleware.express.apiKey("MINHA-KEY"));

Exemplo com Fastify:

import Fastify from "fastify";
import { security } from "rjs-api";

const app = Fastify();
app.register(security.middleware.fastify.apiKey, { key: "MINHA-KEY" });

📁 Estrutura do Projeto

src/
 ├─ index.ts
 ├─ utils/
 │   ├─ documents.ts
 │   ├─ time.ts
 │   └─ security/
 │       ├─ encryption.ts
 │       ├─ index.ts
 │       ├─ password.ts
 │       ├─ tokens.ts
 │       └─ middleware/
 │            ├─ express.ts
 │            ├─ fastify.ts
 │            └─ index.ts

🧩 Importação Completa

import * as rjs from "rjs-api";

rjs.documents.validateCPF("123...");
rjs.time.current();
rjs.security.tokens.generateUUID();
rjs.security.password.hashPassword("abc");

📝 Tipos TypeScript

Total suporte a IntelliSense e tipagem automática. Todos os módulos possuem .d.ts.


📜 Licença

MIT — livre para uso pessoal e comercial.