# NextReport Service AI Agent Instructions (`apps/nextreport`) > **Tech Stack:** Node.js 22, Puppeteer, Chromium, Zod > **Role:** Asynchronous Reporting Engine (PDF Invoice, Receipt & Financial Export Generator) --- ## 1. Runtime & Resource Guidelines 1. **Chromium Sandboxing & Memory**: - NextReport uses headless Chromium (`--no-sandbox`, `--disable-setuid-sandbox`, `--disable-dev-shm-usage`, `--disable-gpu`). - Browser pages must ALWAYS be closed inside a `finally` block to prevent Chromium zombie processes and memory leaks. 2. **Execution & Network Model**: - Internal microservice listening on port 5489 (`http://nextreport:5489`). - NOT exposed publicly; only accessible by `apps/backend` within the Docker internal bridge network. - Resource bounded: `cpus: "0.80"`, `memory: 512M`. --- ## 2. Maintenance & Testing - Syntax & startup check: `node --check server.mjs`. - Docker build test: `docker build -f Dockerfile .` from `apps/nextreport`.