- Node.js ESM TypeScript backend service for the Globalping API. Supports Node.js 22, 24, and 26.
- Production uses
docker-compose.ymlfor databases andcompose-stack.ymlfor the API; local development runs Redis, MariaDB, and TimescaleDB withdocker-compose.dev.ymlwhile the Node.js app runs directly on the host. - Development measurement flows also require a running Globalping Probe.
- Install:
npm ci - Download required runtime data:
npm run download:files - Start required development and test services:
docker compose -f docker-compose.dev.yml up -d
- Create worktrees under
.worktrees/(already git-ignored). - Create
config/local.envandconfig/local.cjsfiles with unique ports immediately when creating a worktree (already git-ignored). config/local.envis for Docker Compose. SetCOMPOSE_PROJECT_NAMEby adding the branch as a suffix (for example,globalping-gh-123) and assign unique values to every service and Redis Cluster bus port variable indocker-compose.dev.yml.config/local.cjsis for Node config. Set a uniqueserver.port, matching ports in all three Redis URLs and the first three Redis cluster nodes, and matchingdashboardDb.connection.port,measurementStoreDb.connection.port, andtimeSeriesDb.connection.portvalues.- Run
npm ciand start services withdocker compose --env-file config/local.env -f docker-compose.dev.yml up -d. Bring them down with the matchingdocker compose --env-file config/local.env -f docker-compose.dev.yml downcommand when finished.
- Use tabs for code indentation and spaces for Markdown.
- Keep the project ESM-only. Use explicit
.jsextensions in relative TypeScript imports. - Use the existing scoped logger instead of
console.*. - Use camelCase database column names and avoid redundant schema fields.
- Keep interfaces direct. Avoid getters, factories, optional dependency parameters, or test-only methods unless production code needs them.
- Keep async behavior intentional. Await work when callers need the result; use
.catch()for intentional fire-and-forget work.
- Ensure Worktree Setup was done properly if using worktrees, and that the development Docker services are running for integration and contract tests.
- For all test-related commands, set the following environment variables:
MOCHA_OPTIONS="--reporter=min"unless you specifically need details about passing tests,LOG_LEVEL=60unless you specifically need app log output at lower levels.
- Add or update tests when changing already-tested behavior.
- For existing untested code, keep fixes targeted and do not add tests unless asked.
- For normal verification, run sequentially:
npm run lint,npm run test:mocha,npm run test:portman. - Run
npm run test:distwhen changes affect the build, package contents, or startup path. - Run
npm run test:e2ewhen changes affect probe/API integration or when explicitly requested.
- Prefer behavior-focused tests over tests that assert implementation details.
- Integration tests should exercise application behavior across real dependencies.
- Unit tests should cover logic that integration tests cannot reasonably cover.
- Shared test mocks are fine for background noise. Tests that assert specific behavior should own and restore their own mocks.