@abyrd9/harbor-cli
v0.0.1
Published
A CLI tool for managing local development services with automatic subdomain routing
Downloads
71
Maintainers
Readme
Harbor CLI
A CLI tool for those small side projects that only run a few services. Harbor allows you to:
- 🛠️ Define your services in a configuration file
- 🔄 Generate a Caddyfile to reverse proxy certain services to subdomains
- 🚀 Launch your services in a tmux session with Caddy and your services automatically proxied
Installation
npm i -g harbor-cli
Prerequisites
Before using Harbor, make sure you have the following installed:
Quick Start
- Initialize your development environment:
harbor dock
- Add new services to your configuration:
harbor moor
- Update your Caddyfile:
harbor anchor
- Launch your services:
harbor launch
Configuration
Harbor uses two main configuration files:
harbor.json
Contains your service configurations that are used to generate the Caddyfile and launch the services:
{
"domain": "localhost",
"services": [
{
"name": "frontend",
"path": "./vite-frontend",
"command": "npm run dev",
"port": 3000,
"subdomain": "app"
},
{
"name": "api",
"path": "./go-api",
"command": "go run .",
"port": 8080,
"subdomain": "api"
},
{
"name": "dashboard",
"path": "./vite-frontend",
"command": "npx drizzle-kit studio",
}
]
}
Note: The dashboard service is a bit special. This is a drizzle studio instance to view your database. There's no subdomain value and no port declared because it typically runs at
local.drizzle.studio
. This will still be running and viewable in your tmux session, but it won't be automatically proxied.
Caddyfile
Automatically generated reverse proxy configuration:
api.localhost {
reverse_proxy localhost:8080
}
app.localhost {
reverse_proxy localhost:3000
}
Commands
harbor dock
: Generate a new harbor.json fileharbor moor
: Add new services to your harbor.json fileharbor anchor
: Update your Caddyfile from the current harbor.json fileharbor launch
: Start all services defined in your harbor.json file in a tmux session
Terminal Multiplexer
Harbor uses tmux for managing your services. Some useful shortcuts:
Ctrl+a d
: Detach from sessionCtrl+a c
: Create new windowCtrl+a n
: Next windowCtrl+a p
: Previous windowCtrl+q
: Quit session
Contributing
Contributions are welcome! Please feel free to submit a Pull Request.
License
MIT