An open API service indexing awesome lists of open source software.

https://github.com/webb1es/dotenvify

Pull, format, and manage .env files — from the terminal or your IDE.
https://github.com/webb1es/dotenvify

cli developer-tools dotenv env go golang productivity utility

Last synced: 3 months ago
JSON representation

Pull, format, and manage .env files — from the terminal or your IDE.

Awesome Lists containing this project

README

          

DotEnvify

# DotEnvify

Convert messy key-value pairs into clean, standardized `.env` files.

License: MIT
 
npm version
 
TypeScript
 
Node.js
 
PRs Welcome


After doing this manually one too many times, this tool was rage-coded into existence. You're welcome.

**Transform this:**

```
API_KEY
a1b2c3d4e5f6g7h8i9j0
DATABASE_URL
postgres://user:password@localhost:5432/db
```

**Into this:**

```env
API_KEY=a1b2c3d4e5f6g7h8i9j0
DATABASE_URL="postgres://user:password@localhost:5432/db"
```

## Installation

```bash
npm install -g @webbies.dev/dotenvify
```

## Quick Start

```bash
# Convert a file to .env
dotenvify vars.txt

# Custom output path
dotenvify vars.txt -o production.env

# Add export prefix
dotenvify vars.txt --export
```

## Features

| | Feature | Description |
|-----------------|--------------------|----------------------------------------------------------------------------------------------------------------|
| **Auto-Detect** | Smart Parsing | Handles `KEY=VALUE`, `KEY VALUE`, key-on-separate-lines, quoted values, `export` prefixes, even mixed together |
| **Backup** | Safe by Default | Automatic backups with incremental counters before any overwrite |
| **Lock** | Preserve Mode | Keep existing values for specific variables when regenerating `.env` files |
| **Filter** | Flexible Filtering | Skip lowercase keys, filter to URLs only, sort alphabetically or keep original order |
| **Quote** | Smart Quoting | Automatically quotes values containing spaces or URLs |

## Supported Input Formats

DotEnvify auto-detects and parses all of these, even when mixed in the same file:

```bash
# KEY=VALUE
API_KEY=a1b2c3d4e5f6g7h8i9j0

# Quoted values
SECRET="my secret value"

# export prefix (stripped automatically)
export NODE_ENV=production

# Space-separated
REDIS_HOST localhost

# Key on one line, value on the next
DATABASE_URL
postgres://user:password@localhost:5432/db
```

> Lines starting with `#` are treated as comments and ignored.

## CLI Reference

```
dotenvify [options]
```

| Option | Alias | Description |
|---------------------|-------|----------------------------------------------------------|
| `--output ` | `-o` | Output file path (default: `.env`) |
| `--export` | `-e` | Add `export` prefix to all variables |
| `--overwrite` | `-f` | Overwrite output without creating a backup |
| `--preserve ` | `-k` | Comma-separated variables to keep existing values for |
| `--skip-sort` | | Maintain original order (default: sorted alphabetically) |
| `--skip-lower` | | Skip variables with lowercase keys |
| `--url-only` | | Include only variables with HTTP/HTTPS URL values |

### Examples

```bash
# Overwrite without backup
dotenvify vars.txt -f

# Preserve DB creds when regenerating
dotenvify vars.txt --preserve "DATABASE_URL,API_SECRET"

# Only extract URLs, skip lowercase keys
dotenvify vars.txt --url-only --skip-lower

# Full pipeline: export-prefixed, custom output, no sorting
dotenvify vars.txt -o .env.local --export --skip-sort
```

## IDE Plugins

Use DotEnvify directly in your editor. Get features the CLI can't offer: Azure DevOps integration, paste-and-format, and
real-time diagnostics.

| Plugin | Highlights | Status |
|--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|------------------------------------------------------------------|------------------------------------------------------------------------------------------------------|
| JetBrains | Azure DevOps variable groups, paste & format, `.env` diagnostics | Available |
| VS Code | Parser, formatter, diagnostics. Built on @dotenvify/core | Coming soon |

> **Migrating from v0.x?** Azure DevOps support has moved from the CLI to
> the [JetBrains plugin](https://plugins.jetbrains.com/plugin/dev.webbies.dotenvify) for a better experience with full IDE
> integration. See the [CLI README](./cli#upgrading-from-v0x-go-version) for the full migration guide.

## Ecosystem

| Package | Description |
|-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------|-----------------------------------------------|
| CLI | File conversion, scripting, CI/CD pipelines |
| Core | Parser, formatter, IO. Powers CLI and plugins |
| Landing | Live demo and docs |

## Development

```bash
npm install # Install dependencies
npm run build # Build all packages
npm run test # Run tests
npm run dev:landing # Dev mode (landing page)
```

Project Structure

```
dotenvify/
├── packages/core/ # @dotenvify/core (shared TS library)
├── cli/ # CLI tool (Commander.js)
├── plugins/
│ ├── jetbrains/ # Kotlin, Gradle build
│ └── vscode/ # VS Code extension
├── landing/ # Product landing page
└── docs/ # Shared docs & assets
```

## Contributing

Found a bug? Have a feature idea? PRs welcome!

Check out
the Issues
or submit
a Pull Requests

## License

MIT License

Go wild, make millions, just don't blame us when it formats your grocery list.

---

"Life's too short for manual formatting."