Installation
Requirements
- Node.js 18 or later
- NestJS >= 9
You can install the backend package either via the init wizard or manually.
Backend: init wizard (recommended)
From the root of your NestJS project:
npm
npx -p @planetmoondrop/centralized-logger planetmoondrop initWhat the wizard does:
- Detects your package manager (pnpm, yarn, bun, npm).
- Asks for:
serviceName(used as Lokiapplabel and Prometheus label).lokiHost(e.g.http://loki:3100).- Whether to enable OpenTelemetry tracing (Tempo).
- Paths to
main.tsandapp.module.ts.
- Installs core dependencies into your project (not just the npx cache):
@planetmoondrop/centralized-loggerwinstonuuid
- If tracing is enabled, installs optional OTEL packages:
@opentelemetry/sdk-node@opentelemetry/exporter-trace-otlp-http@opentelemetry/auto-instrumentations-node@opentelemetry/resources@opentelemetry/semantic-conventions
The wizard uses --ignore-scripts for installs where supported to avoid monorepo postinstall/husky failures, especially on Windows.
If your project already depends on @planetmoondrop/centralized-logger, you can run:
npx planetmoondrop initWhen npx planetmoondrop init works
npx planetmoondrop initwithout the-pflag only works when the package is already in yourpackage.json. There is no separateplanetmoondroppackage on npm – the binary lives inside@planetmoondrop/centralized-logger.
Backend: manual install
If you prefer to wire things yourself:
npm
npm install @planetmoondrop/centralized-logger winston uuidRequired NestJS peer dependencies (usually already present in your app):
npm
npm install @nestjs/common @nestjs/core reflect-metadata rxjsOptional peers you may want:
@nestjs/axios– to useLokiHttpModule/LokiHttpServicefor traced outgoing HTTP calls.typeorm– to use theTypeOrmLokiLoggeradapter.- OpenTelemetry SDK packages (if you want Tempo traces):
@opentelemetry/sdk-node@opentelemetry/exporter-trace-otlp-http@opentelemetry/auto-instrumentations-node@opentelemetry/resources@opentelemetry/semantic-conventions
What to do next
- Configure backend — register
LokiLoggerModule, enable CORS headers, and callapply(app). - Setup frontend — attach the Axios interceptor so trace IDs continue from the browser.
- Run Docker stack — start Loki, Tempo, Prometheus, and Grafana with Docker Compose.
Need help or want to support the project? Visit Support us.