Added &ref=npm-supabase-stay-awake to the README's Scribase link and to package.json homepage, alongside the existing utm_* params, so a real README click-through can be told apart from a registry-mirror fetch. npm publish confirmed live. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
77 lines
3.1 KiB
Markdown
77 lines
3.1 KiB
Markdown
# supabase-keep-alive (CLI)
|
|
|
|
Stop a free Supabase project from pausing: one real database read a day
|
|
through the project's REST API, from any cron (not just GitHub Actions).
|
|
CLI companion to the
|
|
[workflow and shell script](https://rithub.dev/caelum0x/supabase-keep-alive-action) in this repository: same checks, same
|
|
HTTP calls, no GitHub required.
|
|
|
|
## Set it up once, forget it (recommended)
|
|
|
|
One command installs a daily cron job on your own machine. Nothing is sent to us, no account,
|
|
no GitHub:
|
|
|
|
```sh
|
|
npx supabase-stay-awake setup --url https://REF.supabase.co --key YOUR_ANON_KEY --table keepalive
|
|
```
|
|
|
|
This copies the script to `~/.supabase-stay-awake/ping.js` and adds one line to your user
|
|
crontab (`crontab -l`) that runs it daily at 06:17 local time (`--time HH:MM` to change it).
|
|
After this, nothing calls `npx` or the network again except the daily check itself.
|
|
|
|
```sh
|
|
npx supabase-stay-awake list # show installed jobs
|
|
npx supabase-stay-awake uninstall --url https://REF.supabase.co # or --uninstall --all
|
|
```
|
|
|
|
If the machine has no usable `crontab` (containers, some CI runners, a locked-down shell),
|
|
`setup` does not fail silently: it still copies the script and prints the exact line to paste
|
|
into your own scheduler (cron, launchd, Task Scheduler) instead.
|
|
|
|
## One-off check
|
|
|
|
```sh
|
|
npx supabase-stay-awake --url https://REF.supabase.co --key YOUR_ANON_KEY --table keepalive
|
|
```
|
|
|
|
or with environment variables (good for crontab / systemd timers / any CI):
|
|
|
|
```sh
|
|
curl -fsSL -O https://rithub.dev/caelum0x/supabase-keep-alive-action/raw/tag/v1/cli/bin/supabase-keep-alive.js
|
|
SUPABASE_URL=https://REF.supabase.co SUPABASE_ANON_KEY=YOUR_ANON_KEY \
|
|
node supabase-keep-alive.js --table keepalive
|
|
```
|
|
|
|
Exit code `0` on success, `1` if the project answered paused (HTTP 540) or
|
|
the call failed, so you can wire it into any scheduler that checks exit codes.
|
|
|
|
```
|
|
Options:
|
|
--url <url> Project origin, https://<ref>.supabase.co (or SUPABASE_URL)
|
|
--key <key> Anon public key (or SUPABASE_ANON_KEY)
|
|
--table <name> Table to read: GET /rest/v1/<table>?select=<select>&limit=1
|
|
--select <cols> Columns for --table (default *)
|
|
--rpc <name> Function to call: POST /rest/v1/rpc/<name>
|
|
--rpc-body <json> JSON body for --rpc (default {})
|
|
--retries <n> Retries after the first attempt (default 3)
|
|
--timeout <s> Per-request timeout in seconds (default 20)
|
|
```
|
|
|
|
## Why this exists
|
|
|
|
Supabase pauses Free projects after about 7 days without database activity.
|
|
This makes one real request a day so the project never looks idle. Full
|
|
explanation, the copy-paste workflow, and the plain-bash version:
|
|
https://rithub.dev/caelum0x/supabase-keep-alive-action
|
|
|
|
## If you'd rather not babysit it
|
|
|
|
[Scribase](https://scribase.com/supabase-project-paused?utm_source=npm&utm_medium=readme&utm_campaign=supabase-keep-alive&ref=npm-supabase-stay-awake)
|
|
is Postgres + Auth + Storage + Realtime where idle projects scale to zero and
|
|
wake on the next request instead of pausing: nothing to keep alive, nothing
|
|
to restore. First project free, no time limit, no card.
|
|
|
|
## License
|
|
|
|
MIT. Not affiliated with Supabase.
|