OpsMind is configured entirely through environment variables — there are no config files to edit and no database rows to seed before first run. At startup, the Express application reads variables from the process environment (populated either by aDocumentation Index
Fetch the complete documentation index at: https://mintlify.com/LENINMORENO13/OpsMind/llms.txt
Use this file to discover all available pages before exploring further.
.env file via dotenv or by the container runtime), applies them to the database connection, the JWT signing layer, and the Gemini AI client, and then begins serving requests. This approach makes OpsMind straightforward to deploy in any environment: local Docker Compose, a managed container platform like Render, or a bare VM.
Environment File Reference
Copy.env.example to .env at the project root and fill in your values:
.env
Variable Reference
The TCP port that Express listens on. Defaults to
3000 when the variable is absent. If you change this locally, update the port mapping in docker-compose.yml to match (e.g. "4000:4000").The full PostgreSQL connection string consumed by Prisma. The expected format is:
| Segment | Docker Compose value | Local (non-Docker) value |
|---|---|---|
USER | lenin_dev | Your PostgreSQL user |
PASSWORD | password123 | Your PostgreSQL password |
HOST | db (Compose service name) | localhost |
PORT | 5432 (internal container port) | 5432 (or your custom port) |
DB | opsmind_db | Your database name |
When running inside Docker Compose, the database host must be
db — the service name defined in docker-compose.yml — not localhost. Docker Compose injects the correct value automatically (see below), so the DATABASE_URL in your .env is only used when running the application outside of Docker.The secret key used by
jsonwebtoken to sign and verify all JWT tokens. Any string works, but you should use a long, randomly generated value in production (at least 32 characters). If this value changes, all previously issued tokens are immediately invalidated.Generate a strong secret with:Terminal
Your Google Gemini API key, used by the
@google/genai SDK to generate AI-powered incident analyses and remediation suggestions. Obtain a free key from Google AI Studio.When this variable is missing or invalid, health checks still run normally, but the AIInsight records will not be generated for detected incidents.Docker Compose Environment
Thedocker-compose.yml file defines two services — db (PostgreSQL) and api (the OpsMind Express application) — and injects environment variables directly into the api container, overriding anything in .env:
docker-compose.yml
DATABASE_URLis hardcoded in the Compose file to usedb:5432as the host, which is the correct internal Docker network address for thedbservice. Do not change this unless you rename the service.JWT_SECRETis hardcoded in the Compose file for local development convenience. Replace this value with a secret loaded from a secrets manager or CI/CD environment variable before deploying to production.GEMINI_API_KEYuses${GEMINI_API_KEY}interpolation — Docker Compose reads the value from your local shell environment or your.envfile at the project root and injects it into the container. This means your API key is never hardcoded in the repository; you only need to set it once in.env.
GEMINI_API_KEY without editing .env, export it in your shell before running Compose:
Terminal
Cron Check Interval
OpsMind’s health check worker is defined insrc/services/scheduler.js and is started automatically when the server boots (in non-test environments). The worker uses the following node-cron expression:
src/services/scheduler.js
*/5 * * * * fires every 5 minutes. On each tick the scheduler queries all Monitor records from PostgreSQL and calls executeMonitorCheck for every entry, recording a new Log and — when warranted — triggering a Gemini AI analysis.
The 5-minute interval is currently hardcoded in
src/services/scheduler.js. To change the frequency, edit the cron expression string directly in that file. The Monitor model also stores a checkInterval field (default 300 seconds) which is intended for per-monitor interval configuration in a future release.Test Environment Behaviour
When The
NODE_ENV is set to test, the Express server does not bind to a port and the cron scheduler does not start. This is enforced by a guard in src/app.js:src/app.js
npm test script uses cross-env NODE_ENV=test to set this flag automatically, allowing Jest and Supertest to import the app object directly and run requests in-process — no port conflicts, no background timers interfering with test assertions.