
Security News
The Hidden Blast Radius of the Axios Compromise
The Axios compromise shows how time-dependent dependency resolution makes exposure harder to detect and contain.
AuthJSON es un servidor RESTful inspirado en json-server, pero con una capa de autenticación basada en JWT (JSON Web Tokens). Permite crear una API RESTful a partir de un archivo db.json, con operaciones CRUD y autenticación integrada.
db.json en tiempo real.json-server.Puedes instalar AuthJSON globalmente usando npm:
npm install -g authjson
O como dependencia en tu proyecto:
npm install authjson
db.jsonCrea una carpeta data en la raíz de tu protecto y un archivo db.json con la estructura de datos que desees. Por ejemplo:
{
"users": [
{ "id": 1, "userId": "123", "name": "Daniel", "email": "daniel@example.com" }
],
"posts": [
{ "id": 1, "userId": "123", "title": "Mi primer post", "content": "Hola mundo" }
]
}
DB_PATH: Ruta al archivo db.json.
PORT: Puerto en el que se ejecutará el servidor (por defecto: 3001).
SECRET_JWT_SEED: Clave secreta para la generación de tokens JWT. Si no se configura, se usará una clave predeterminada ('default-secret-key').
--db <ruta>: Especifica la ruta al archivo db.json.
Puedes iniciar el servidor especificando la ruta de db.json como argumento de línea de comandos:
authjson --db ./ruta/al/db.json
O configurando la variable de entorno DB_PATH:
DB_PATH=./ruta/al/db.json
El servidor se iniciará en el puerto 3001 (o el que especifiques en la variable de entorno PORT).
Al iniciar el servidor, se mostrarán en la consola los endpoints disponibles. Por ejemplo:
🔗 **AuthJSON Endpoints:**
📌 Base URL: http://localhost:3001/
🔑 **Autenticación:**
✅ POST http://localhost:3001/api/auth/login
✅ POST http://localhost:3001/api/auth/register
🛠️ **Recursos Generados Automáticamente:**
✅ GET http://localhost:3001/api/users
✅ POST http://localhost:3001/api/users
✅ GET http://localhost:3001/api/users/:id
✅ PUT http://localhost:3001/api/users/:id
✅ DELETE http://localhost:3001/api/users/:id
✅ GET http://localhost:3001/api/posts
✅ POST http://localhost:3001/api/posts
✅ GET http://localhost:3001/api/posts/:id
✅ PUT http://localhost:3001/api/posts/:id
✅ DELETE http://localhost:3001/api/posts/:id
Para registrar un nuevo usuario, realiza una solicitud POST a /api/auth/register:
curl -X POST http://localhost:3001/api/auth/register \
-H "Content-Type: application/json" \
-d '{
"userId": "123",
"name": "Daniel",
"email": "daniel@example.com"
}'
Para iniciar sesión, realiza una solicitud POST a /api/auth/login:
curl -X POST http://localhost:3001/api/auth/login \
-H "Content-Type: application/json" \
-d '{
"email": "daniel@example.com"
}'
Una vez autenticado, puedes realizar operaciones CRUD en los recursos. Por ejemplo, para obtener todos los posts:
curl -X GET http://localhost:3001/api/posts \
-H "Authorization: Bearer <tu-token-jwt>"
Si te gustó AuthJSON deja tu estrella en GitHub. Gracias!
FAQs
Un servidor RESTful con autenticación JWT, inspirado en json-server.
We found that authjson 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
The Axios compromise shows how time-dependent dependency resolution makes exposure harder to detect and contain.

Research
A supply chain attack on Axios introduced a malicious dependency, plain-crypto-js@4.2.1, published minutes earlier and absent from the project’s GitHub releases.

Research
Malicious versions of the Telnyx Python SDK on PyPI delivered credential-stealing malware via a multi-stage supply chain attack.