supabase-selfhosted-cli 0.1.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) 2026 supabase-selfhosted-cli contributors
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,173 @@
1
+ # Supabase Selfhosted CLI
2
+
3
+ CLI for **self-hosted Supabase** — on a VPS, in Docker on a remote server, or running locally on your machine. Wraps the repetitive work you do by hand: deploy edge functions, restart the runtime, push migrations, and regenerate TypeScript types.
4
+
5
+ Inspired by the official Supabase CLI, but built for self-hosted layouts on your own VPS (Docker, Docker Compose, or bare metal) instead of Supabase Cloud.
6
+
7
+ ## Install
8
+
9
+ ```bash
10
+ npm install -g supabase-selfhosted-cli
11
+ ```
12
+
13
+ Or run from source:
14
+
15
+ ```bash
16
+ git clone https://github.com/spykesocial/supabase-selfhosted-cli.git
17
+ cd supabase-selfhosted-cli
18
+ npm install
19
+ npm link
20
+ ```
21
+
22
+ You still need the [Supabase CLI](https://supabase.com/docs/guides/cli) installed for `db push` and `gen types` (this package shells out to it). Supabase CLI also uses docker to create its own copy of the remote instance so you'll need docker installed when generating types.
23
+
24
+ ## Quick start
25
+
26
+ From your project root (where `supabase/migrations` lives):
27
+
28
+ ```bash
29
+ supabase-selfhosted-cli setup
30
+ ```
31
+
32
+ The wizard asks where your instance runs:
33
+
34
+ - **Local machine** — Docker / Docker Compose on this computer (copies files directly to your volume mount, runs restart locally)
35
+ - **Remote server** — VPS or cloud VM over SSH (SFTP upload + remote restart)
36
+
37
+ ### Remote server (VPS) example
38
+
39
+ | Setting | Example |
40
+ | --- | --- |
41
+ | SSH user | `root` |
42
+ | Server IP | `203.0.113.10` |
43
+ | Functions destination | `/etc/supabase/volumes/functions` |
44
+ | SSH password | stored once in `~/.supabase-selfhosted-cli/` |
45
+ | Postgres tenant id | `your-tenant-id` (from `postgres.your-tenant-id`) |
46
+ | DB password | your pooler password |
47
+ | Migration port | `5453` |
48
+ | Types port | `6438` |
49
+ | Restart command | e.g. `docker restart <edge-container>` |
50
+
51
+ ### Local Docker example
52
+
53
+ | Setting | Example |
54
+ | --- | --- |
55
+ | Functions destination | `/path/to/supabase/docker/volumes/functions` (absolute path to your edge-runtime volume mount) |
56
+ | Database host | `127.0.0.1` |
57
+ | Migration port | `5432` (or your exposed Postgres port) |
58
+ | Types port | `5432` |
59
+ | Restart command | `docker compose restart edge-runtime` or auto-detect edge container |
60
+
61
+ Setup creates `.supabase-selfhosted-cli.json` in your project so commands know which profile to use.
62
+
63
+ ## Commands
64
+
65
+ ### Deploy edge functions
66
+
67
+ **Remote (SSH)** — replaces:
68
+
69
+ ```bash
70
+ scp -r supabase/functions/. root@203.0.113.10:/etc/supabase/volumes/functions
71
+ ssh root@203.0.113.10 'docker restart ...'
72
+ ```
73
+
74
+ **Local (Docker)** — replaces manually copying into your Docker volume and restarting containers.
75
+
76
+ ```bash
77
+ supabase-selfhosted-cli functions deploy
78
+ ```
79
+
80
+ Flags:
81
+
82
+ - `--restart` — always restart after deploy
83
+ - `--no-restart` — never restart
84
+ - `--prune` — remove destination files/folders not present locally (use after deleting a function)
85
+ - default — prompts based on your setup preference
86
+
87
+ End-to-end verification against a configured project:
88
+
89
+ ```bash
90
+ npm run build
91
+ ./scripts/e2e-deploy-test.sh /path/to/your-project
92
+ ```
93
+
94
+ ### Push migrations
95
+
96
+ Replaces:
97
+
98
+ ```bash
99
+ npx supabase db push --db-url postgresql://postgres.your-tenant-id:...@host:5453/postgres --yes
100
+ ```
101
+
102
+ ```bash
103
+ supabase-selfhosted-cli db push
104
+ supabase-selfhosted-cli db push --debug
105
+ ```
106
+
107
+ ### Generate TypeScript types
108
+
109
+ Replaces:
110
+
111
+ ```bash
112
+ npx supabase gen types typescript --db-url postgresql://...@host:6438/postgres --schema public > database.types.ts
113
+ ```
114
+
115
+ ```bash
116
+ supabase-selfhosted-cli gen types
117
+ supabase-selfhosted-cli gen types -o database.types.ts
118
+ ```
119
+
120
+ ### Manage credentials
121
+
122
+ ```bash
123
+ supabase-selfhosted-cli settings
124
+ ```
125
+
126
+ - Show masked configuration
127
+ - Re-run setup wizard
128
+ - Delete stored credentials
129
+
130
+ ## Configuration storage
131
+
132
+ - Profiles: `~/.supabase-selfhosted-cli/profiles/<name>.json` (mode `600`)
133
+ - Project link: `.supabase-selfhosted-cli.json` in your repo
134
+
135
+ Passwords are stored locally on your machine. Delete them anytime via `supabase-selfhosted-cli settings`.
136
+
137
+ ## Multiple projects / instances
138
+
139
+ Use named profiles:
140
+
141
+ ```bash
142
+ supabase-selfhosted-cli setup --profile production
143
+ supabase-selfhosted-cli setup --profile local-docker
144
+ supabase-selfhosted-cli functions deploy --profile production
145
+ ```
146
+
147
+ ## Restart command tips
148
+
149
+ Self-hosted setups differ. During setup, provide any shell command that works for your target:
150
+
151
+ ```bash
152
+ # Docker (auto-detect edge container name)
153
+ docker ps --format '{{.Names}}' | grep -i edge | head -n 1 | xargs -I{} docker restart {}
154
+
155
+ # Docker Compose (local or remote)
156
+ docker compose restart edge-runtime
157
+
158
+ # Docker Compose from stack directory on the server
159
+ cd /etc/supabase/compose && docker compose restart edge-runtime
160
+
161
+ # systemd
162
+ systemctl restart supabase-edge-runtime
163
+ ```
164
+
165
+ ## Roadmap
166
+
167
+ - OS keychain integration for secrets
168
+ - Remote profile sync for teams
169
+ - Migration status, function diff, and health checks
170
+
171
+ ## License
172
+
173
+ MIT
package/dist/cli.d.ts ADDED
@@ -0,0 +1 @@
1
+ #!/usr/bin/env node