Skip to main content

Documentation Index

Fetch the complete documentation index at: https://mintlify.com/ChrisCore1/inventario_sud/llms.txt

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

Inventario SUD reads its configuration from a .env.local file in the project root. This file is never committed to source control — create it manually before running the development server or deploying. The variables below are required for the application to start and for all features to function correctly.

Required variables

DATABASE_URL
string
required
Neon PostgreSQL connection string. Must point to a database where the pgvector extension is enabled. Use the pooled connection string from the Neon dashboard for serverless and edge environments.
postgresql://user:[email protected]/neondb?sslmode=require
Always use the pooled connection string from Neon (the one labeled “Connection pooling” in the dashboard), not the direct connection string. Direct connections are not compatible with serverless environments and will exhaust the connection limit under load.
NEXTAUTH_URL
string
required
The canonical URL of your application. NextAuth uses this to construct callback URLs and CSRF tokens. In development, set this to http://localhost:3000. In production, set it to your deployed domain.
http://localhost:3000
NEXTAUTH_SECRET
string
required
A random secret used to sign and encrypt NextAuth session tokens and cookies. Must be at least 32 bytes of entropy.
your-random-secret-here
Generate a secure secret with OpenSSL:
openssl rand -base64 32
Copy the output directly into your .env.local file.

Email variables (password reset)

These variables configure the SMTP transport used by actions/reset-actions.ts to send six-digit PIN codes for password recovery. All four are required if you want to use the password reset feature.
SMTP_HOST
string
Hostname of your SMTP server. Defaults to smtp.gmail.com if not set.
smtp.gmail.com
SMTP_PORT
string
Port for the SMTP connection. Defaults to 587 (STARTTLS) if not set.
587
SMTP_USER
string
SMTP authentication username — typically the sender email address. Also used as the from address in outgoing reset emails.
SMTP_PASS
string
SMTP authentication password or app-specific password for the sender account.

Example .env.local

.env.local
# Neon PostgreSQL — use the pooled connection string
DATABASE_URL=postgresql://user:[email protected]/neondb?sslmode=require

# NextAuth
NEXTAUTH_URL=http://localhost:3000
NEXTAUTH_SECRET=replace-with-output-of-openssl-rand-base64-32

# SMTP — password reset emails
SMTP_HOST=smtp.gmail.com
SMTP_PORT=587
[email protected]
SMTP_PASS=your-app-password

Seed the database

After your environment variables are in place and the database schema has been applied, run the seed script to create the first user.
npm run db:seed
This runs scripts/add-user.ts via tsx. The script does the following:
1

Create the role if it does not exist

The script checks whether the role Consejero already exists in the Rol table. If not, it inserts it.
2

Check for a duplicate user

It queries the Usuario table for an existing row with the hardcoded email. If one is found, the script exits without making changes.
3

Hash the password

The plaintext password is hashed with bcryptjs using 10 salt rounds before being stored.
4

Insert the user

A new row is inserted into Usuario with the following values:
FieldValue
nombre_usuarioJuan
email[email protected]
password_hashbcrypt hash of 123
id_rolID of the Consejero role
The seed script contains hardcoded credentials ([email protected] / 123) and creates a Consejero (standard user) role — not an Obispo. To get an administrator account, edit scripts/add-user.ts and change nombreRol to "Obispo", set a real email address, and use a strong password before running the script.

Build docs developers (and LLMs) love