Skip to main content

SSP Backend API Documentation

Complete REST API backend for managing beneficiaries, activities, and health profiles in the Sistema de Servicio Penal/Social platform. Built with NestJS, TypeORM, and PostgreSQL.

Quick Start

Get your SSP Backend API running in minutes

1

Clone the repository

Clone the SSP Backend repository and install dependencies.
git clone https://github.com/SSPEstadias/SSP-BACK.git
cd SSP-BACK
npm install
2

Configure environment variables

Create a .env file with your database credentials and JWT secret.
DB_HOST=localhost
DB_PORT=5432
DB_USERNAME=your_username
DB_PASSWORD=your_password
DB_NAME=ssp_db
JWT_SECRET=your_jwt_secret_key
PORT=3000
See the Environment Variables guide for all available configuration options.
3

Set up the database

Create your PostgreSQL database and run migrations.
npm run seed:admin
npm run start:dev
The seeding script will create an initial admin user for you to get started.
4

Authenticate and make your first request

Login to get a JWT token and make your first API call.
curl -X POST http://localhost:3000/auth/login \
  -H "Content-Type: application/json" \
  -d '{"nomUsuario":"admin","contrasena":"your_password"}'
{
  "access_token": "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9...",
  "user": {
    "id": 1,
    "nombre": "Admin User",
    "rol": "Admin"
  }
}

Explore by Topic

Navigate through our comprehensive documentation

Authentication

Learn about JWT-based authentication and role-based access control with four user roles.

Beneficiarios API

Manage beneficiary records including time assignments and intake dates.

Actividades API

Create and manage activities by category with activation controls.

Salud API

Track health profiles and physical fitness assessments for beneficiaries.

Database Setup

Configure PostgreSQL with TypeORM, migrations, and entity relationships.

Development Guide

Set up your local development environment and testing workflow.

Key Features

Everything you need to build on the SSP platform

Role-Based Access Control

Four user roles (Admin, Psicologo, TrabajoSocial, Guia) with granular permissions using JWT guards and decorators.

PostgreSQL + TypeORM

Robust database layer with entity definitions, migrations, and automatic relationship management.

Request Validation

Automatic request validation using class-validator and class-transformer with DTOs for type safety.

RESTful Design

Clean, consistent REST API endpoints following best practices with proper HTTP methods and status codes.

Resources

Additional resources to help you succeed

GitHub Repository

View the source code, report issues, and contribute to the project.

API Reference

Complete reference for all API endpoints with request/response examples.

Ready to get started?

Follow our quickstart guide to set up your development environment and make your first API call in minutes.

Get Started Now

Build docs developers (and LLMs) love