Salud IA Bot is a NestJS application that reads health data exclusively from a pre-seeded SQLite database (Documentation Index
Fetch the complete documentation index at: https://mintlify.com/RubenDarioGuerreroNeira/Ecosistema-IA-Colombia/llms.txt
Use this file to discover all available pages before exploring further.
data/salud-ia-bot.db). Because XML is never parsed at runtime, the production process is straightforward: build the TypeScript source, supply environment variables, ensure the database file is present, and start the compiled output. This page walks through every step.
Prerequisites
Before deploying, confirm the following are in place:- Node.js 20+ and npm installed on the target host
- A pre-seeded
data/salud-ia-bot.dbfile (see Data Seeding) - A Telegram bot token obtained from @BotFather
- An OpenRouter API key from openrouter.ai
- (Optional) A persistent disk or volume mount if deploying to a platform-as-a-service provider
Build Process
Thebuild script in package.json delegates to the NestJS CLI:
nest build, which compiles all TypeScript sources under src/ into the dist/ directory using the configuration defined in tsconfig.json (target: ES2022, outDir: ./dist). The NestJS CLI option deleteOutDir: true in nest-cli.json ensures any previous build artefacts are removed before each compile.
Once the build succeeds, start the server with either of these commands:
start:prod is defined in package.json as node dist/main.
Environment Variables
All required and optional configuration is read from environment variables at startup. In local development these are loaded from a.env file; in production, set them directly in your hosting platform’s dashboard or secrets manager.
| Variable | Required | Default | Description |
|---|---|---|---|
TELEGRAM_BOT_TOKEN | ✅ Yes | - | Token issued by @BotFather for your Telegram bot |
OPENROUTER_API_KEY | ✅ Yes | - | API key for OpenRouter (routes requests to LLaMA 3.1) |
OPENROUTER_MODEL | No | meta-llama/Meta-Llama-3.1-70B-Instruct | Override the LLM model slug |
PORT | No | 3000 | HTTP port exposed by the NestJS server |
TELEGRAM_PROXY_URL | No | - | HTTP/SOCKS proxy URL for restricted networks |
TELEGRAM_API_TIMEOUT | No | - | Request timeout (ms) for Telegram API calls |
Deploying to Render
Render is the recommended platform-as-a-service for Salud IA Bot because it supports persistent disks, which are required to preserve the SQLite database file across deployments.Create a new Web Service
Log in to render.com and click New -> Web Service.
Connect your GitHub repository
Authorize Render to access your GitHub account and select the
Ecosistema-IA-Colombia repository.Add environment variables
In the Render dashboard, navigate to Environment and add all required variables:
TELEGRAM_BOT_TOKEN, OPENROUTER_API_KEY, and any optional overrides.Mount a persistent disk
Under Disks, add a new disk and mount it at the project root so that the
data/ directory — and therefore data/salud-ia-bot.db — persists across deploys and restarts. Without this, the database file is lost whenever the service restarts.Upload or seed the database
Before the first deploy completes, transfer your locally seeded
data/salud-ia-bot.db to the mounted disk via Render’s shell or by using a pre-deploy script. The application will not start correctly without this file present.Deploying to Railway
Railway can also host Salud IA Bot. The steps mirror Render:- Create a new project and link your repository.
- Set the same build (
npm install && npm run build) and start (npm run start:prod) commands in the service settings. - Add environment variables under Variables.
- Use a Volume attached to the service at the path containing
data/to persist the SQLite file.
Self-Hosted Node.js Server
For a VPS or dedicated server running Ubuntu/Debian:Health Check
The NestJS application exposes an HTTP server onPORT (default 3000). A GET / request returns 200 OK from the root AppController. Use this endpoint for uptime monitoring and platform health checks.
Memory Considerations
The application usesbetter-sqlite3 (version ^12.11.1), a synchronous, high-performance SQLite binding for Node.js. Because XML is parsed only during the one-time seed step — never at runtime — the production process has a very small startup footprint. Expected resident memory usage is approximately 150-300 MB depending on total dataset size and the number of concurrent requests being served.