Skip to main content

Documentation Index

Fetch the complete documentation index at: https://mintlify.com/MateoNavarroMN/Balsamoa-Backend/llms.txt

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

Balsamoa Backend is configured entirely through environment variables loaded at startup by dotenv. There are only two variables to set — a database connection string and an optional HTTP port — making the configuration surface intentionally minimal. The template file inicializar/.env.example documents all available variables and ships with the repository.

Environment file template

Copy this file to .env at the project root before starting the server for the first time.
inicializar/.env.example
# Cambiar puerto 5432 a 6543
DATABASE_URL=ingresar_url_de_supabase_aqui
PUERTO=3003
Never commit your .env file to version control. It contains your database password in plain text. The .gitignore already excludes .env from commits — verify this before pushing to a shared repository.

Variable reference

DATABASE_URL
string
required
The PostgreSQL connection string used by pg.Pool to connect to your Supabase database. SSL is enabled automatically with rejectUnauthorized: false so no additional certificate configuration is required.You must use the Supabase transaction pooler URL (port 6543), not the direct connection URL (port 5432). The pooler is compatible with environments that open many short-lived connections, such as development workstations and serverless functions on Vercel.
postgresql://postgres.[project-ref]:[password]@aws-0-[region].pooler.supabase.com:6543/postgres
PUERTO
number
default:"3000"
The TCP port that the Express HTTP server binds to when it starts. If this variable is not set or is left empty, the server code defaults to port 3000. The provided .env.example sets this to 3003 — use that value in development to match the configured default.
src/server.mjs
const PUERTO = process.env.PUERTO || 3000

SSL configuration

The database connection pool in src/config/conexion.bd.mjs enforces SSL for all connections to Supabase with rejectUnauthorized set to false. This allows the Node.js pg driver to connect to Supabase’s hosted PostgreSQL without requiring a client-side CA certificate.
src/config/conexion.bd.mjs
const pool = new Pool({
  connectionString: process.env.DATABASE_URL,
  ssl: {
    rejectUnauthorized: false
  }
})

Supabase connection string

Finding the right connection string in the Supabase dashboard takes a few steps. Make sure to select the pooler URL, not the direct URL.
  1. Open your project in the Supabase dashboard.
  2. Go to Project Settings (gear icon) → Database.
  3. Scroll down to the Connection string section.
  4. Select the URI format tab.
  5. In the Connection mode selector, choose Transaction (this gives you the pooler endpoint).
  6. Copy the connection string — it will have port 6543 in the URL.
  7. Replace the [YOUR-PASSWORD] placeholder with your actual database password.
If the copied URL shows port 5432, you are looking at the direct connection string. Change it to 6543 manually, or switch the Connection mode selector to Transaction and copy again.

Development vs production

In development, nodemon watches for file changes and restarts the server automatically. Use a descriptive port to avoid conflicts with other local services and point DATABASE_URL at your Supabase development project or a local PostgreSQL instance.
.env (development)
# Supabase pooler URL — port 6543 required
DATABASE_URL=postgresql://postgres.abcdefghijklmnop:your-dev-password@aws-0-us-east-1.pooler.supabase.com:6543/postgres

# Local dev port — matches .env.example default
PUERTO=3003
Start the server with:
pnpm dev

Build docs developers (and LLMs) love