Skip to content

Repository files navigation

🇨🇱 Chilean RUT Validator & Generator API

NestJS Serverless TypeScript License: MIT

A high-speed, zero-dependency NestJS API for validating, formatting, calculating verification digits (Modulo 11 DV), and generating test Chilean national identification numbers (RUT/RUN). Optimized for serverless deployment on Vercel and AWS Lambda.

🌐 English Version (Default) | Versión en Español


⚡ API Endpoints

1. Validate & Format RUT

GET /validate?rut=12.345.678-k

Response:

{
  "rut": "12.345.678-k",
  "isValid": true,
  "formatted": "12.345.678-K",
  "clean": "12345678K",
  "body": "12345678",
  "dv": "K"
}

2. Calculate Verification Digit (DV)

GET /calculate-dv?body=12345678

Response:

{
  "body": "12345678",
  "dv": "K",
  "formatted": "12.345.678-K",
  "clean": "12345678K"
}

3. Generate Valid Test RUTs (QA / Staging)

GET /generate?count=3

Response:

{
  "count": 3,
  "ruts": [
    { "body": "18452391", "dv": "4", "formatted": "18.452.391-4", "clean": "184523914" },
    { "body": "9382104", "dv": "K", "formatted": "9.382.104-K", "clean": "9382104K" },
    { "body": "21048592", "dv": "2", "formatted": "21.048.592-2", "clean": "210485922" }
  ]
}

🚀 Local Development & Deployment

# 1. Install dependencies
npm install

# 2. Run local NestJS dev server
npm run start:dev

# 3. Build production bundle
npm run build

Engineered by Atelier BuscoStrategic technical partner for founders and innovation leaders.

About

A lightweight NestJS API to validate Chilean RUT numbers, designed for serverless deployment.

Resources

Stars

0 stars

Watchers

1 watching

Forks

Releases

Packages

Used by

Contributors

Languages