Skip to main content
The Backup and Restore section contains two independent tools accessible from /panel/configuracion:

Backup

Download a full copy of the database or storage buckets.

Restore accounts

Generate a new password for a user and send it to their email.

Backup — /panel/configuracion/respaldo

Allows downloading a complete dump of the Supabase database in SQL format, or a ZIP archive of all storage bucket files. The process can take several minutes depending on data volume.

Backup types

The POST /api/admin/generate-backup endpoint accepts a type field:
TypeOutputFormat
databaseFull SQL dump of all public tables and views.sql file
imagesZIP archive of all Supabase Storage bucket files.zip file

What the database backup contains

The generated .sql file includes:
  1. Schema (CREATE TABLE): definition of all public tables with columns, data types, and primary keys.
  2. Views (CREATE OR REPLACE VIEW): recreation of all views in the public schema.
  3. Data (INSERT INTO): all records from each table in batches of 1,000 rows.
The backup does not include database functions, triggers, RLS policies, or data from schemas other than public. Only BASE TABLE type tables are covered.

Generating a database backup

1

Go to the backup section

Navigate to /panel/configuracion/respaldo. Ensure you have the config:backup area enabled in your role.
2

Click Generate backup

Click the Generate backup button under the database icon. A loading notification appears: “Generating backup…”
3

Wait for the download

The process may take several minutes. Once complete, the browser automatically downloads a file named:
backup-database-YYYY-MM-DDTHH-MM-SS.sql
The notification changes to “Backup ready.”

Backup endpoint

POST /api/admin/generate-backup
Content-Type: multipart/form-data
FieldValueDescription
typedatabase or imagesType of backup to generate
Response for database: .sql file attachment with headers:
Content-Type: application/sql; charset=utf-8
Content-Disposition: attachment; filename="backup-database-<timestamp>.sql"
Response for images: .zip file attachment with headers:
Content-Type: application/zip
Content-Disposition: attachment; filename="backup-images-<timestamp>.zip"
The backup generation process is resource-intensive. Avoid running it during peak user activity hours to prevent performance impact on the server.
FrequencyRecommended scenario
WeeklyNormal platform operation
Before updatesAlways before structural database changes
Monthly minimumPlatforms with low activity

Restore accounts — /panel/configuracion/restaurar-cuentas

Lets you generate and send a new password to an existing user in the system. Useful when a user has lost access and cannot recover it themselves.
This process cannot be reversed once executed. The user’s previous password is invalidated immediately.

Users that can be restored

Role (UI)DB tableLogin URL
Alumnousers/auth/alumno
Tutortutors/auth/tutor
Maestroteachers/auth/maestro
AdministradoradminsAdmin panel
The account admin@montero.com cannot be restored through this tool. It returns a 403 Forbidden error.

Restore workflow

1

Select the user role

In the dropdown, choose the user type whose account you want to restore: Alumno, Tutor, Maestro, or Administrador.
2

Enter the email address

Type the user’s registered email address. It must be a valid email format.
3

Click Restore

The button is disabled during processing to prevent duplicate submissions. A loading spinner with the text “Processing…” appears.
4

Email confirmation

If the restoration is successful, the system:
  1. Generates a random 12-character password.
  2. Hashes it with bcrypt (10 salt rounds).
  3. Updates the password field in the corresponding table.
  4. Sends an email to the user with the new password and a direct link to their login page.
The notification shows “Account restored and email sent.”

Restore endpoint

POST /api/admin/restore-account
Content-Type: multipart/form-data
FieldTypeDescription
rolestringUser role in lowercase: alumno, tutor, maestro, or administrador
emailstringUser’s email address
Response on success:
{ "success": true, "message": "Cuenta restaurada y correo enviado." }
Possible errors:
CodeMessageCause
400Datos incompletos.Missing role or email
400Correo electrónico inválido.Invalid email format
400Rol inválido.Role does not match any table
403Esta cuenta no puede ser restaurada.Attempt to restore admin@montero.com
404La cuenta no existe.Email not found in the role’s table
502La contraseña fue actualizada, pero no se pudo enviar el correo.Email service error
If the server returns a 502 error, the password has already been updated in the database. Inform the user of their new password manually, or retry sending from the email service.