Skip to main content

Documentation Index

Fetch the complete documentation index at: https://mintlify.com/BladimirGS/judicial-backend/llms.txt

Use this file to discover all available pages before exploring further.

Judicial Backend is a production-grade REST API built with Express, TypeScript, and TypeORM for managing the operations of a second-instance criminal court (Oficialía de Partes Penal de Segunda Instancia). It handles appeal registration, multi-modal search, statistical reporting, and PDF/Excel export — all protected by JWT authentication via an external auth provider.

Quickstart

Clone, configure, and run the server in minutes

Configuration

Environment variables, database, and auth settings

Architecture

Modular design with layered responsibilities

API Reference

Full endpoint reference with request/response schemas

What’s Inside

The API is organized into four domain modules, each fully self-contained:

Apelaciones

Register new judicial appeals (penal and indigenous), manage annexes, and retrieve form catalogs

Búsqueda

Search appeals in full, flat, or historical mode with PDF and Excel export

Estadísticas

Generate flat and grouped statistical reports with Excel export

Authentication

BFF-pattern JWT authentication with RS256/JWKS verification

Key Features

Modular Architecture

Four independent domain modules — apelacion, busqueda, estadistica, auth — each with its own controllers, services, repositories, and DTOs

External Auth via BFF

Proxies login/refresh/logout to an external auth service; verifies RS256 JWTs via JWKS on every protected route

PDF & Excel Reports

Generates downloadable reports using pdfmake and ExcelJS, with shared builders and styles across all modules

SQL Server + Stored Procedures

TypeORM for ORM queries with direct MSSQL stored procedure execution for folio generation, assignment, and statistics

Quick Setup

1

Clone and install

git clone <repo-url>
cd judicial-backend
npm install
2

Configure environment

Copy .env.example to .env and fill in your database credentials and auth settings.
cp .env.example .env
3

Start the server

npm run dev
The API listens on http://localhost:4000 by default. Interactive Swagger docs are at /api-docs.
4

Authenticate and call the API

Obtain a JWT by calling POST /api/auth/login, then include it as Authorization: Bearer <token> on all protected routes.
All routes except /api/auth/* require a valid JWT. See the Authentication guide for the full flow.

Build docs developers (and LLMs) love