bindler 1.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2025
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/README.md ADDED
@@ -0,0 +1,142 @@
1
+ # bindler
2
+
3
+ cli for managing multiple projects behind cloudflare tunnel with nginx and pm2.
4
+
5
+ ## install
6
+
7
+ ```bash
8
+ npm install -g bindler
9
+ ```
10
+
11
+ you'll also need:
12
+ - node.js 18+
13
+ - nginx - `brew install nginx` (mac) or `apt install nginx` (linux)
14
+ - pm2 - `npm install -g pm2`
15
+ - cloudflared (optional) - `brew install cloudflared` or see https://pkg.cloudflare.com
16
+
17
+ run `bindler setup` to install missing dependencies automatically.
18
+
19
+ ## usage
20
+
21
+ ```bash
22
+ # check your system
23
+ bindler doctor
24
+
25
+ # create a project (interactive)
26
+ bindler new
27
+
28
+ # or with flags
29
+ bindler new --name mysite --hostname mysite.local --local
30
+ bindler new --name api --type npm --hostname api.example.com --start "npm start"
31
+
32
+ # apply nginx config
33
+ bindler apply
34
+
35
+ # start npm apps
36
+ bindler start myapp
37
+
38
+ # check status
39
+ bindler status
40
+ ```
41
+
42
+ ## commands
43
+
44
+ **projects:** `new`, `list`, `status`, `update <name>`, `edit <name>`, `remove <name>`
45
+
46
+ **processes:** `start <name>`, `stop <name>`, `restart <name>`, `logs <name>`
47
+
48
+ **system:** `apply`, `doctor`, `ports`, `info`, `check <hostname>`, `setup`
49
+
50
+ use `--all` with start/stop/restart to manage all npm projects at once.
51
+
52
+ ## local development
53
+
54
+ for local-only projects (no cloudflare), use the `--local` flag:
55
+
56
+ ```bash
57
+ bindler new --local
58
+ ```
59
+
60
+ then add the hostname to /etc/hosts:
61
+ ```bash
62
+ echo "127.0.0.1 myapp.local" | sudo tee -a /etc/hosts
63
+ ```
64
+
65
+ access at `http://myapp.local:8080`
66
+
67
+ ## vps / direct mode
68
+
69
+ if you have a vps and don't need cloudflare tunnel, use direct mode:
70
+
71
+ ```bash
72
+ bindler setup --direct
73
+ ```
74
+
75
+ this will:
76
+ - set nginx to listen on port 80 directly
77
+ - skip cloudflare dns routing
78
+ - optionally set up ssl with let's encrypt (certbot)
79
+
80
+ your projects will be accessible at `https://app.yourdomain.com` (no port needed).
81
+
82
+ ```bash
83
+ # add a project
84
+ bindler new --name myapp --hostname app.yourdomain.com
85
+
86
+ # apply config + get ssl certificate
87
+ sudo bindler apply
88
+ ```
89
+
90
+ ## how it works
91
+
92
+ **tunnel mode** (default):
93
+ ```
94
+ internet -> cloudflare -> cloudflared tunnel -> nginx (:8080) -> your projects
95
+ ```
96
+
97
+ **direct mode** (vps):
98
+ ```
99
+ internet -> nginx (:80/:443) -> your projects
100
+ ```
101
+
102
+ nginx routes by hostname. static sites serve files directly, npm apps run via pm2 and get proxied.
103
+
104
+ ## config
105
+
106
+ stored in `~/.config/bindler/config.json`
107
+
108
+ ```json
109
+ {
110
+ "defaults": {
111
+ "nginxListen": "127.0.0.1:8080",
112
+ "tunnelName": "homelab"
113
+ },
114
+ "projects": []
115
+ }
116
+ ```
117
+
118
+ ## cloudflare tunnel setup
119
+
120
+ ```bash
121
+ cloudflared tunnel login
122
+ cloudflared tunnel create homelab
123
+ ```
124
+
125
+ create `~/.cloudflared/config.yml`:
126
+ ```yaml
127
+ tunnel: homelab
128
+ credentials-file: ~/.cloudflared/<tunnel-id>.json
129
+ ingress:
130
+ - service: http://localhost:8080
131
+ ```
132
+
133
+ run it:
134
+ ```bash
135
+ cloudflared tunnel run homelab
136
+ ```
137
+
138
+ bindler will auto-create dns routes when you run `bindler apply`.
139
+
140
+ ## license
141
+
142
+ mit