xPulse
πŸ‡¬πŸ‡§ EN

@xpulse/dotenv – Component Spec

Status: CONCEPT Β· Created March 2026 Parent: GLOBAL_concept-ecosystem.md


Overview

Loads .env files and populates process.env. Zero dependencies.

Not a wrapper around dotenv (npm) – a lean, custom implementation. Only what xPulse needs, no overhead.


API

Loading

import dotenv from '@xpulse/dotenv';
// Loads .env from the current working directory
await dotenv.load();
// Explicit path
await dotenv.load({ path: '/app/.env' });

Access

After dotenv.load() all values are available in process.env:

process.env.PORT // '3000'
process.env.CHAT_URL // 'https://chat.xpulse.one'

Additionally directly via dotenv:

dotenv.get('PORT') // '3000'
dotenv.get('PORT', '8080') // '3000' (fallback if not set)
dotenv.get('MISSING', '42') // '42'

Introspection

// Has it already been loaded?
dotenv.loaded;
// β†’ true

.env Format

Standard .env syntax:

# Comments are ignored
PORT=3000
CHAT_URL=https://chat.xpulse.one
# Quotes are stripped
APP_NAME="xPulse Web"
APP_NAME='xPulse Web'
# Empty lines are ignored
# Values with spaces require quotes
GREETING="Hello World"

Behaviour


Package Structure

@xpulse/dotenv/
index.js ← default export: dotenv object
README.md
package.json

Dependencies

None.


Debug Integration

When @xpulse/debug is installed as a devDependency, @xpulse/dotenv automatically provides a DataCollector. @xpulse/debug discovers it via node_modules/@xpulse/dotenv/src/datacollectors/ – no configuration needed.

"optionalDependencies": {
"@xpulse/debug": "^1.0.0"
}

The EnvCollector (name: 'env', icon: '🌍') shows in the Web Profiler:

No toolbar badge.


Open Questions

Question Status
Multiline values in .env? TBD – not for now
Automatically load .env.production / .env.development? TBD
en/spec.md 2026-04-10