// ecosystem.config.cjs // This file is the standard way to configure applications for PM2. // It allows us to define all the settings for our application in one place. // The .cjs extension is required because the project's package.json has "type": "module". module.exports = { apps: [{ name: 'flyer-crawler-api', // The name of our application in PM2 // Explicitly set the working directory. This is crucial for reliability. cwd: '/var/www/flyer-crawler.projectium.com', // Instead of using 'npm run start', we call the 'tsx' executable directly from node_modules. // This avoids PATH issues within the PM2 environment. script: './node_modules/.bin/tsx', args: '--env-file .env server.ts', env_production: { NODE_ENV: 'production', // Set the Node.js environment to production }, }], };