Important: This documentation covers Yarn 1 (Classic).
For Yarn 2+ docs and migration guide, see yarnpkg.com.

Package detail

@bourgils/forward

bourgils43MIT0.6.2

A fast, temporary CLI runtime for JavaScript projects. Run commands without polluting your project.

cli, dev, tooling, vite, nextjs, zero-install, temporary, runtime, project-runner, npm, sandbox, isolated, scripts, pipe, frontend, developer-experience

readme

💻 forward (CLI: fwd)

Isolated, throwaway runtime for modern frontend projects No node_modules, no pollution — just run, dev, and it disappears.

⚠️ Important: Forward (fwd) is not a package manager. It's a command forwarding tool that creates temporary environments with isolated node_modules for your commands. It doesn't manage your project's dependencies permanently.


✨ Features

  • 🧼 Run any project without installing deps locally
  • 🧪 Use vite, react-scripts, next, etc. with hot reload
  • 🔐 Dependencies are installed in a temp session, never your project
  • 🗑️ When the server stops, everything is cleaned
  • 🧙 Supports install, uninstall, and custom commands
  • 🌐 Run remote repositories directly with --repository
  • 🔒 HTTPS support with automatic SSL certificates
  • 📊 Inspect and manage node_modules with modules commands

🚀 Quick Start

npm install -g @bourgils/forward

Inside a project with a package.json

fwd env init      # Initialize environment and detect pipe & package manager
fwd env show      # Show current environment configuration
fwd env set       # Set specific environment configuration
fwd env reset     # Reset environment to default state
fwd doctor        # Check system compatibility and configuration
fwd dev           # → vite dev or next dev
fwd run build     # → npm run build (in temp env)
fwd exec echo Hello
fwd add react react-dom
fwd remove react

Run remote repositories

fwd run dev --repository=https://github.com/user/repo
fwd run dev --repository=https://github.com/user/repo --keep-clone  # Keep the clone after execution

Run with HTTPS

sudo fwd run dev --https
sudo fwd run dev --https --domain=custom-domain.com

Manage node_modules

fwd modules inspect . --also dist,build,.*cache  # Show node_modules content and size
fwd modules prune    # Clean up unused dependencies

🔧 CLI Commands

Command Alias Description
fwd env init i Initialize environment and detect pipe & pkg manager
fwd env show s Show current environment configuration
fwd env set | Set specific environment configuration
fwd env reset r Reset environment to default state
fwd doctor d Check system compatibility and configuration
fwd run [script] | Run npm script from package.json
fwd exec [cmd] [args...] | Execute any raw command in session
fwd add [package] install Add a package
fwd remove [package] uninstall Remove a package
fwd modules inspect [root] | Inspect node_modules content and size from [root] directory
fwd modules prune [root] | Clean up unused dependencies from [root] directory

run Command Options

Option Description
--repository Run from a remote repository (auto-clone & cleanup)
-k, --keep-clone Keep the cloned repository after execution, in current location
-h, --https Enable HTTPS with automatic trsuted SSL certificates
-d, --domain Set custom domain for HTTPS (default: .dev)
-t, --target-port Choose target port to forward traffic to (only with --https)

modules inspect Command Options

Option Description
-i, --ignore-paths Add paths to ignore during inspection
-a, --also Add some files or folders to looking for during inspection (eg, --also build,dist)
--all Remove system paths and hidden files from default ignored paths

modules prune Command Options

Option Description
-i, --ignore-paths Add paths to ignore for prune (eg, --ignore-paths ~/me,~/prod )
-a, --also Add some files or folders to to prune (eg, --also build,dist)
-y, --yes Prevent prompt before prune files
--dry-run Dry run the command
--interactive Allow path selection for prune

⚠️ Important: Please note that HTTPS support may require using the --target-port option in cases where concurrent processes are launched at startup and the detected port is not the target local server port. Additionally, hot-reload support with HTTPS may require configuration to forward WebSocket connections to the final server (e.g., for create-react-app (CRA), WDS_SOCKET_PORT=443 must be set in .env).

📁 How it works

  • Creates an isolated environment for your project
  • Manages dependencies in a temporary location
  • Provides runtime checks for compatibility
  • Launches your scripts as you usually do or any raw command
  • Cleans everything after Ctrl+C
  • Supports remote repository execution with automatic cleanup, HTTPS proxy for local development and

Environment not detected? Just use: fwd env set

🔒 HTTPS Support

⚠️ Important:

  • The --https option requires sudo privileges: sudo fwd run dev --https
  • During first run, the SSL certificate will be added to your keychain and macOS may prompt for your password
  • HTTPS support is fully tested on macOS and implemented (untested) on Linux

Run any command with HTTPS support:

# Run dev script with default .dev domain (e.g., 357289.my-project.dev)
sudo fwd run dev --https

# Run dev script with custom domain
sudo fwd run dev --https --domain=awesome-app.dev

Mapping a .com, .net, .io, etc., which is probably a real domain, generates a warning. You can continue, but your browser's cache may cause problems.

Hot Reload Support

Hot reload is fully supported with the following configurations:

  • Vite: Works out of the box
  • Create React App: Requires a .env file with WDS_SOCKET_PORT=443 for hot reload support
  • Others (Next.js, etc.): Support may vary depending on the framework's configuration

Note: The HTTPS proxy defaults map your project to a .dev domain (e.g., 357289.my-project.dev)


💡 Why?

Because node_modules folders are huge. And every time you clone a project, you run npm install and forget to clean. With fwd, you just run it and forget it — nothing is written in your project unless you want it.


🔄 Dev mode

Want to test locally?

git clone https://github.com/bourgils/forward
cd
cp .env.local .env # For CRA HTTPS support
npm install
npm link

Then go into any project and run:

fwd env init
fwd run dev or fwd run start

🫶 Author

Made with ❤️ by @bourgils


🗺️ Roadmap

The roadmap is currently open for suggestions! Here are some planned improvements:

🧠 Planned Features

  • 🔍 Add ESLint plugin for consistent code style
  • 🔒 Add pre-commit hooks for code validation
  • More coming soon...

Feel free to:

  • Open an issue with your feature request
  • Join the discussion about the future of Forward
  • Share your use cases and needs

Previous roadmap items completed in v0.5.0:

  • 🧹 Code cleanup & architecture: refactor into classes/services for better structure
  • 🌐 Remote execution UX: support for running remote repositories

changelog

📦 CHANGELOG

All notable changes to this project will be documented in this file.

[0.6.2] - Unreleased

Added

  • New --target-port option for HTTPS proxy to specify custom target port
  • Better error handling and user feedback for proxy server setup

Changed

  • Improved WebSocket support in HTTPS proxy
  • Enhanced documentation with HTTPS usage guidelines and warnings
  • Better error messages for proxy server configuration

Fixed

  • Proxy server configuration for concurrent processes
  • WebSocket connection handling in HTTPS mode

[0.6.1]

Added

  • Support for custom domains in HTTPS mode
  • Automatic port detection for local development servers
  • Hot reload support for various frameworks

Changed

  • Improved HTTPS proxy server configuration
  • Enhanced error handling for SSL certificate management
  • Better domain management with .dev TLD support

Fixed

  • SSL certificate generation and trust management
  • Domain resolution and hosts file management
  • WebSocket connection handling for hot reload

[0.6.0]

Added

  • New modules command with inspect and prune subcommands
  • --keep-clone option for repository execution
  • Directory size inspection with human-readable format
  • Support for custom ignore paths in modules commands
  • Interactive mode for modules prune

Changed

  • Improved logging system with better formatting and colors
  • Enhanced error messages and success notifications
  • Better repository management with cleanup options
  • Refactored folder handling with new DirectoryManager
  • Extracted utilities for better code organization

Fixed

  • Repository cleanup after execution
  • Sudo privileges check for HTTPS operations
  • Improved error handling in various commands

[0.5.0]

Added

  • Remote repository support with --repository option in run command
  • Automatic repository cloning and cleanup
  • HTTPS support as a flag (--https) in run command
  • Custom domain support via --domain option

Changed

  • Major architectural refactoring:
    • Split commands and handlers for better separation of concerns
    • New service-based architecture (DetectorService, EnvService, RunnerService)
    • Manager classes for better resource handling (Cert, Domain, Program, Repository, etc.)
    • Reorganized utilities and core modules
  • Improved command organization and user experience
  • Removed dedicated HTTPS command in favor of --https flag

Fixed

  • Repository cleanup after execution
  • Sudo privileges check for HTTPS operations

[0.6.2] - Unreleased

Added

  • New --target-port option for HTTPS proxy to specify custom target port
  • Better error handling and user feedback for proxy server setup

Changed

  • Improved WebSocket support in HTTPS proxy
  • Enhanced documentation with HTTPS usage guidelines and warnings
  • Better error messages for proxy server configuration

Fixed

  • Proxy server configuration for concurrent processes
  • WebSocket connection handling in HTTPS mode

[0.6.1]

Added

  • Support for custom domains in HTTPS mode
  • Automatic port detection for local development servers
  • Hot reload support for various frameworks

Changed

  • Improved HTTPS proxy server configuration
  • Enhanced error handling for SSL certificate management
  • Better domain management with .dev TLD support

Fixed

  • SSL certificate generation and trust management
  • Domain resolution and hosts file management
  • WebSocket connection handling for hot reload

[0.4.0]

Added

  • fwd https: New command for secure local development with HTTPS
    • Automatic SSL certificate generation and management
    • Local domain mapping with .dev TLD support
    • Custom domain support via --domain option
    • Hot reload support for Vite and Create React App
  • New core modules for HTTPS support:
    • Certificate management (src/lib/certs.js)
    • Host file management (src/lib/hosts.js)
    • Port detection (src/lib/port-watcher.js)
    • HTTPS proxy server (src/lib/proxy.js)

Changed

  • Enhanced project documentation with HTTPS usage guidelines
  • Improved README with clearer project description and limitations
  • Updated command aliases for better consistency

Fixed

  • DNS cache flushing on macOS for proper domain resolution
  • Certificate trust management for macOS keychain

[0.3.0]

Changed

  • Renamed fwd env use to fwd env set for better clarity
  • Improved environment initialization feedback with detailed progress messages
  • Enhanced error messages and user guidance
  • Refactored constants into dedicated files for better maintainability
  • Updated logger icons for better visual consistency

Fixed

  • Improved environment reset process with better file handling
  • Enhanced runtime checks with clearer error messages
  • Fixed typos in user-facing messages

[0.2.2]

Enhanced

  • Made all command arguments optional for better UX
  • Added interactive script selection in run command
  • Improved error messages and error handling across commands
  • Enhanced visual feedback with chalk styling
  • Expanded doctor command with more detailed diagnostics

Fixed

  • Argument handling in multiple commands
  • Better handling of edge cases when no arguments provided

[0.2.1]

Added

  • fwd env init: New environment initialization command
  • fwd env show: Display current environment configuration
  • fwd env use: Set specific environment configuration
  • fwd env reset: Reset environment to default state
  • fwd doctor: New command to check system compatibility
  • Runtime environment checks for better compatibility
  • Version management system

Changed

  • Refactored CLI commands structure under env namespace
  • Improved environment variable handling
  • Enhanced project architecture with better separation of concerns
  • Removed session-based management in favor of environment-based approach

Removed

  • fwd init: Replaced by fwd env init
  • fwd show: Replaced by fwd env show
  • fwd use: Replaced by fwd env use
  • fwd reset: Replaced by fwd env reset
  • Session management system

[0.1.1]

Added

  • fwd add: Add package to the project
  • fwd remove: Remove package from the project

Fixed

  • Fixed a crash when running fwd show in a non-initialized project (before fwd env init)

[0.1.0] - Initial Release

Added

  • fwd env init: Auto-detect pipe and package manager
  • fwd show: Show current session info
  • fwd run [script]: run commands in temp environment
  • fwd exec [cli] [cmd [args…]]: Run any shell command inside isolated env
  • fwd use [pipe]: Manually set the pipe (runtime) for the current project
  • fwd reset: Clean current session
  • fwd [cmd] [args…]: Pass through command to the pipe
  • 📁 Sessions are isolated per-project with hashed paths
  • 📦 Symlink strategy to support hot reload
  • 💾 Disk usage tracker + cleanup summary
  • 📦 Linter, Prettier, EditorConfig setup
  • 🗺️ README + roadmap