Monitor API is configured exclusively through environment variables, loaded at process startup viaDocumentation Index
Fetch the complete documentation index at: https://mintlify.com/sheeplettuce/Monitor/llms.txt
Use this file to discover all available pages before exploring further.
dotenv/config (the import "dotenv/config" call at the top of src/server.ts). Place your variables in a .env file at the project root — this file is read before any other initialization code runs. All required variables must be present before starting the server; missing values will cause Prisma or the auth middleware to throw at startup.
Environment Variables
PostgreSQL connection string passed directly to Prisma. Must point to a running PostgreSQL instance with a database that has had the Monitor schema applied via Prisma supports the full
prisma migrate deploy or prisma db push.postgresql:// URI syntax including SSL parameters, connection pool size overrides, and Unix socket paths. Refer to the Prisma connection URL docs for advanced options.Secret key used to sign and verify all JWT tokens issued by Tokens are signed with the HS256 algorithm and expire after 8 hours. In production this value must be a cryptographically random string of at least 32 characters. See the warning below.
POST /api/auth/login. Any request to a protected route is rejected if its token was signed with a different secret.Filesystem path where uploaded evidence files (photos, documents) are stored by Point this to a directory with sufficient storage and appropriate backup coverage. The directory does not need to exist before starting the server — Monitor will attempt to create it if it’s missing. The health check at startup (
multer. Resolved relative to process.cwd() at the time the server starts.Default: ../evidenciascheckEvidencias) will warn if the path is inaccessible.Port
The server always listens on port3000 bound to 0.0.0.0 (all network interfaces). This is hardcoded in src/server.ts:
PORT constant in src/server.ts and rebuild.
Logging
Monitor API uses a custom structured logger (src/utils/logger.ts) that writes to two destinations simultaneously on every log call:
-
logs/app.log— A plain-text append-only log file. Each line contains an ISO 8601 timestamp, log level, context label, message, and optional JSON-serialized data on the same line separated by|. Thelogs/directory is created automatically at startup if it does not exist. -
stdout — Color-coded output for interactive terminals, using ANSI escape codes. When a log call includes structured data, it is pretty-printed on the following lines prefixed with
→:Context labels are printed in magenta and timestamps in grey for quick visual scanning.Level Color INFOCyan WARNYellow ERRORRed SUCCESSGreen
logs/app.log entries (file format — compact single-line):
logs/app.log with a log-rotation tool such as logrotate (Linux) or route stdout to a log aggregator.
mDNS / Bonjour Discovery
On every startup, Monitor API publishes a Bonjour (mDNS) service so that other devices on the local network can discover the server without a static IP:| Property | Value |
|---|---|
| Service name | Monitor API |
| Service type | _monitor._tcp |
| Port | 3000 |
TXT record — ipv4 | Local IPv4 address of the server interface |
bonjour-service package. Any Bonjour-compatible client (Safari, Finder, dns-sd, Avahi, etc.) will see Monitor API._monitor._tcp.local resolve to the server’s IP on port 3000.
An unauthenticated HTTP endpoint provides the same discovery information for non-mDNS clients:
ips array lists all non-loopback IPv4 addresses found on the server’s network interfaces at the time of the request.