portpilot
Version: 
Map local dev ports to custom domains easily
136 lines (98 loc) โข 2.91 kB
Markdown
# ๐ PortPilot
 Pilot your ports like domains, effortlessly map your local apps to custom domains โ no admin headaches, no messy proxy setups.  
**Powered by nginx under the hood.** One config file. Multiple apps. Zero chaos.
[](https://www.npmjs.com/package/portpilot)
[](./LICENSE)
๐ [portpilot.js.org](https://portpilot.js.org)
## โจ Why PortPilot?
- โก Instantly map `myapp.local` to your running apps
- ๐ง  No more editing the `hosts` file โ handled automatically
- ๐ฅ๏ธ Nginx-powered proxy setup (auto-installed if missing)
- ๐ ๏ธ Supports per-app custom nginx configs
- ๐งน Smart cleanup on stop: hosts, configs, rules
- ๐ฆ Lightweight, fast, and made for developers
## ๐ฆ Installation
```bash
# As a dev dependency
pnpm add -D portpilot
# Or install globally
pnpm add -g portpilot
```
Compatible with `npm`, `yarn`, or `pnpm`.
## โ๏ธ Configuration โ `.pilotrc.json`
Create a `.pilotrc.json` in your project root:
```json
{
  "apps": [
    {
      "domain": "test1.local",
      "port": 1010,
      "https": false,
      "customAppConfig": {
        "enabled": true,
        "path": "./conf/conf.nginx"
      }
    },
    {
      "domain": "test2.local",
      "port": 2020,
      "https": false
    },
    {
      "domain": "test3.local",
      "port": 3030,
      "https": false
    }
  ],
  "on": {
    "stop": {
      "cleanNginx": true,
      "cleanHosts": true,
      "cleanConfigs": true
    }
  }
}
```
๐ก Add as many apps as you want โ no limits.
## ๐ Get Started
```bash
# Start mapping domains
npx portpilot start
# Or if installed globally
portpilot start
```
๐ To stop and clean everything up:
```bash
portpilot stop
```
## ๐ง Advanced Usage: Custom Nginx Configs
Need full control?  
You can provide your own nginx block per app via the `customAppConfig.path` key.  
When enabled, your config will override the default generated one.
## ๐ฃ๏ธ Roadmap
- โ
 Host file automation  
- โ
 Nginx-based reverse proxy  
- โ
 Multi-app support  
- โ
 Per-app custom nginx configs  
- โณ HTTPS + auto-cert generation  
- โณ Global nginx config support  
- โณ Live reload on config change  
## ๐ Requirements
- Node.js 20+
- Admin access (`sudo` on macOS/Linux, auto prompt on Windows)
- Some experience with local development
## ๐ License
MIT ยฉ [Abhinav Prakash](https://github.com/rishiyaduwanshi)
## ๐ Support & Feedback
- ๐ [Report issues](https://github.com/rishiyaduwanshi/portpilot/issues)
- ๐ Star this repo if it helped you!
- ๐ [contact@rishiyaduwanshi.me](mailto:contact@rishiyaduwanshi.me)