Monitor API is a Node.js/TypeScript REST backend built for Mexican auto-body shops that handle insurance repair claims. Shop administrators, service advisors, and technicians use it to track every claim — called an expediente — from the moment a vehicle arrives through final delivery, while adjusters can retrieve damage surveys, photos, and checklist data at any stage of the workflow. By centralizing claim state, evidence storage, and user roles in a single API, Monitor eliminates the spreadsheets and paper forms that traditionally slow repair-to-payment cycles.Documentation Index
Fetch the complete documentation index at: https://mintlify.com/sheeplettuce/Monitor/llms.txt
Use this file to discover all available pages before exploring further.
Key Features
Authentication & Roles
JWT-based auth with three roles — Administrador, Operador, and Técnico — so each user sees and modifies only what they’re permitted to.
Data Model
A PostgreSQL schema managed by Prisma ORM covers expedientes, aseguradoras, evidencias, checklists, levantamiento de daños, and full estado change history.
Managing Expedientes
Create, update, and advance claims through four workflow states — Ingreso → Restauración → Pendiente de salida → Salida — with every transition logged in an immutable audit trail.
Evidence Uploads
Attach photos and documents to any expediente via multipart upload. Files are stored locally (or flagged for cloud), referenced by claim number, and attributed to the uploading user.
Levantamiento de Daños
Record a structured damage survey per expediente, including vehicle details, affected systems, and line-item repair concepts with costs.
Health Monitoring
Built-in status checks run at startup and every five minutes, verifying the backend, database connection, disk space, evidence directory, and optional frontend service.
How It Works
Monitor API is built on a small, production-tested stack:- Express 5 — HTTP routing and middleware. CORS is open to all origins by default; tighten this in production via the
corsconfiguration. - Prisma ORM — Type-safe database access against a PostgreSQL 15+ instance. The schema is version-controlled in
prisma/schema.prismaand applied via Prisma Migrate. - PostgreSQL — The single source of truth for all claim, user, and evidence metadata.
- JWT authentication — Tokens are issued at
/api/auth/login, signed withJWT_SECRET, and expire after 8 hours. Every protected route validates theAuthorization: Bearer <token>header. - Insurer seed data — On every startup,
seedAseguradoras()runs before the server begins accepting requests. It upserts the three built-in insurers (AXA, HDI, Qualitas) from logo assets in theassets/directory, so the database is always consistent with the bundled reference data. - mDNS / Bonjour discovery — On startup the server publishes a
_monitor._tcpservice namedMonitor APIon port 3000, so shop computers can locate the API without configuring static IPs. TheGET /discoveryendpoint exposes the same information over HTTP. - Structured logging — All server events are written to
logs/app.logand to stdout with a color-coded format (see Configuration for details). - TypeScript (ES2022, NodeNext modules) — The entire codebase is strictly typed. The production build compiles to
dist/viatsc; development runs viatsx watchfor instant reloads.
Many field and endpoint names in Monitor API are in Spanish. This is intentional — terms like
expediente, no_siniestro, aseguradora, and levantamiento_danios directly mirror the vocabulary used in Mexican auto-body shop workflows and insurance paperwork. The domain language is preserved in the API to reduce translation friction for the teams who use it every day.