dotenv let's assume we have different .env files and need to access it in the root import dotenv from 'dotenv' import { dirname, join } from 'path' import { fileURLToPath } from 'url' const thisFilePath = fileURLToPath(import.meta.url) const thisDirName = dirname(thisFilePath) const filePathToFrontendEnv = join(thisDirName, 'frontend', '.env') const filePathToBackendEnv = join(thisDirName, 'backend', '.env') dotenv.config({ path: [filePathToFrontendEnv, filePathToBackendEnv] }) console.log('🚀 ~ process.env.BACKEND_BASE_URL:', process.env.BACKEND_BASE_URL) console.log('🚀 ~ process.env.FRONTEND_BASE_URL:', process.env.FRONTEND_BASE_URL)