# NODEJS: PM2 -Improve .env file support and integration in node/Nuxt3 projects

**Project:** Sites | **Board:** Planned | **Votes:** 3
**URL:** https://roadmap.ploi.io/projects/2-site-level-requests/items/359-nodejs-pm2-load-variables-from-env-file-in-the-pm2-sh-script

---

I have encountered an issue when using the .env file for certain projects in Node, specifically in the context of Nuxt3. The current workaround is to run Nuxt3 using node -r dotenv/config .output/server/index.mjs via PM2. However, this approach does not fully integrate "the  nuxt" way.


**Expected behavior:**

- The application should be able to read the .env file variables and apply them during execution.
- Users should be able to modify variables, such as the PORT number, directly in the .env file.


**Actual behavior:**

-The .env file variables are not automatically added during the node execution.
- Nuxt Users have to manually provide variables like the PORT number in the start command.

**Additional context:**

- It would be beneficial to have the PORT number and other variables automatically added from the .env file.

**Possible solution:**

- Improve the integration of .env files in Nuxt3 projects with PM2, allowing for seamless usage and configuration.

Example script to add to .sh file
```
#!/usr/bin/env sh

# Load variables from .env file. (only need to add the path to site dir here)
export $(cat ./.env | grep -v ^# | xargs) >/dev/null
```

// Talk to Ling for details.
