npm package: @lucasmarkes/envfy
Description: Simple CLI tool to manage .env environments easily
Author: Lucas Marques
Latest version: 1.0.2

# Envfy 🚀

**Envfy** is a simple and developer-friendly CLI tool to manage multiple `.env` environments for your projects.
It helps developers quickly create, switch, and manage environment files (`.env.local`, `.env.dev`, `.env.stage`, `.env.prod`) and also generates a `.env.example` file for sharing with your team.

> Built with **developer experience (DX)** in mind. Keep your workflow simple, consistent, and hassle-free.

---

## Features ✨

- Interactive creation of `.env.*` files
- Optional environment variable creation
- `.env.example` automatically generated
- Switch between environments easily
- Set or update variables in specific environment files
- Check which environment is currently active
- Custom help command for quick reference

---

## Installation 💻

You can install **Envfy** globally via npm:

```bash
npm install -g @lucasmarkes/envfy
```

Or clone and link locally for development:

```bash
git clone https://github.com/lucasmarkes/envfy.git
cd envfy
npm install
npm run build
npm link
```

---

## Usage 🚀

After installation, you can use `envfy` globally in your terminal.

### Initialize environments

```bash
envfy init
```

- Interactive prompt asks if you want to create environment variables
- Generates `.env.local`, `.env.dev`, `.env.stage`, `.env.prod`
- Generates `.env.example` as a template
- All variable values are empty by default

Example interaction:

```
Do you want to create environment variables now? (y/N) y
How many environment variables do you want to create? 3
Enter name for variable #1: API_URL
Enter name for variable #2: DB_USER
Enter name for variable #3: DB_PASS
✅ Created: .env.local
✅ Created: .env.dev
✅ Created: .env.stage
✅ Created: .env.prod
✅ Created: .env.example
```

---

### List available environments:

```bash
envfy list
```

Example output:

```
Available environments:
  - local
  - dev
  - stage
  - prod
```

---

### Switch environment

```bash
envfy switch dev
```

- Copies `.env.dev` to `.env` in your project root
- Makes switching between environments fast and safe

---

### Set or update variables

```bash
envfy set API_URL https://api.dev --env dev
```

- Sets or updates a variable in a specific `.env.*` file
- Default target environment is `local` if `--env` is not provided

---

### Show active environment

```bash
envfy status
```

Example output:

```
🌱 Active environment (.env):
API_URL=https://api.dev
DB_USER=root
DB_PASS=secret
```

---

### Help command

```bash
envfy help
```

Shows all commands, descriptions, and examples:

```
Envfy - CLI to manage multiple .env environments

Commands:
  init               Create .env files (optional variables)
  list               List available environments
  switch <env>       Switch to the specified environment
  set <key> <value>  Set or update a variable in a specific .env file
  status             Show which environment is currently active
  help               Show this help message

Examples:
  envfy init
  envfy set API_URL https://api.dev --env dev
  envfy switch dev
```

---

## Project Philosophy 💡

Envfy is built with **developer experience in mind**:

- Minimal setup and fast execution
- Optional interactive creation of environment variables
- Encourages best practices with `.env.example`
- Helps teams and open source projects manage environments safely

---

## Contributing 🤝

Contributions are welcome! Feel free to:

- Submit bug reports
- Suggest new features
- Open pull requests

---

## License 📄

MIT License. See [![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](LICENSE) for details.

---

## Stay Connected 🔗

Follow updates, share feedback, and connect on Twitter: [@lucasmarkes\_\_](https://twitter.com/lucasmarkes__)