Skip to main content

Documentation Index

Fetch the complete documentation index at: https://mintlify.com/Medinaallan/ContabilidadISV/llms.txt

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

ContabilidadISV uses two separate environment files: backend/.env for the Express.js API server (SQL Server connection, JWT secret, port) and frontend/.env for Vite (API base URL override). Neither file is committed to source control — both are loaded at runtime via dotenv on the backend and Vite’s built-in env system on the frontend.

Backend Environment Variables

These variables are read by backend/src/models/Database.js and the Express server at startup. All SQL Server variables are optional except JWT_SECRET, which must be set before the server will issue valid tokens.
VariableDefaultRequiredDescription
DB_SERVERlocalhostNoHostname or IP of the SQL Server instance
DB_NAMEContabilidadISVNoName of the target database
DB_USER(none)NoSQL Server login username. Omit to use Windows Authentication
DB_PASSWORD(none)NoPassword for DB_USER. Omit when using Windows Authentication
DB_ENCRYPTfalseNoSet to true when connecting to Azure SQL or any TLS-enforced server
DB_TRUST_CERTtrueNoSet to false in production to validate the server certificate chain
DB_INSTANCESQLEXPRESSNoSQL Server named instance. Change to MSSQLSERVER for the default instance
DB_CONNECTION_TIMEOUT30000NoMaximum time in milliseconds to wait for a connection to be established
JWT_SECRET(none)YesSecret key used to sign and verify JSON Web Tokens. Use a long, random string
PORT3002NoHTTP port the Express server listens on

Frontend Environment Variables

VariableDefaultDescription
VITE_API_URL/apiBase URL for all API requests. Defaults to /api, which is rewritten by the Vite dev-server proxy to http://localhost:3002/api. Set to the full backend URL (e.g. http://192.168.1.10:3002/api) when the frontend is served independently of the backend
In the Electron desktop build the API URL is injected via window.electron.env.API_URL at runtime by the Electron main process, so VITE_API_URL is only relevant for web deployments. See Electron deployment for details.

Sample backend/.env File

Copy the block below into backend/.env and fill in your values before starting the server.
# ── SQL Server connection ─────────────────────────────────────────────────────
DB_SERVER=localhost
DB_NAME=ContabilidadISV
DB_INSTANCE=SQLEXPRESS

# SQL Server Auth (comment out both lines to use Windows Authentication instead)
DB_USER=sa
DB_PASSWORD=YourStrongPassword123!

# TLS / encryption settings
DB_ENCRYPT=false          # Set to true for Azure SQL
DB_TRUST_CERT=true        # Set to false in production

# Connection timeout in milliseconds
DB_CONNECTION_TIMEOUT=30000

# ── Application ───────────────────────────────────────────────────────────────
PORT=3002

# ── Security (REQUIRED) ───────────────────────────────────────────────────────
# Generate with: node -e "console.log(require('crypto').randomBytes(64).toString('hex'))"
JWT_SECRET=replace_this_with_a_long_random_secret_at_least_64_characters

Windows Authentication

If your SQL Server is on the same domain as the application server you can omit DB_USER and DB_PASSWORD entirely. When both variables are absent Database.js automatically sets the authentication.type to 'default', which tells the mssql driver to use the current Windows/AD identity:
// Excerpt from backend/src/models/Database.js
if (!this.config.user) {
  this.config.authentication = {
    type: 'default'
  };
}
No additional configuration is needed in .env — simply leave those two lines out.
Never commit either .env file to source control. Add both backend/.env and frontend/.env to your .gitignore. For production deployments, inject secrets via your hosting platform’s environment variable manager or a secrets vault rather than writing them to disk.

Build docs developers (and LLMs) love