Supabase pauses free-tier projects after 7 days of inactivity. This kills them before they die.
Runs on GitHub Actions. Zero dependencies. Zero servers. Zero cost.
Built by OpenSourcePatents LLC
You have Supabase projects on the free tier. You don't hit them for a week. Supabase pauses them. Your users get errors. You scramble to restore them manually.
This script pings every one of your Supabase projects every 3 days (safe margin under the 7-day limit). If a ping fails, it doesn't just shrug. It:
- Retries 5 times with exponential backoff + random jitter
- Falls back to the auth health endpoint if the REST API is unresponsive
- Fires every alarm at once if it still can't reach the project:
- Creates a GitHub Issue with full failure details
- Sends you an email (via SendGrid or SMTP)
- Sends a push notification (via Pushover)
- Logs the result to a Supabase table so you have history
git clone https://github.com/OpenSourcePatents/supabase-keepalive.git
cd supabase-keepaliveOpen config/projects.json and add your projects:
[
{
"name": "MyApp",
"envUrl": "MYAPP_SUPABASE_URL",
"envKey": "MYAPP_SUPABASE_ANON_KEY"
},
{
"name": "MySideProject",
"envUrl": "SIDEPROJECT_SUPABASE_URL",
"envKey": "SIDEPROJECT_SUPABASE_ANON_KEY"
}
]The envUrl and envKey fields are the names of the environment variables (GitHub Secrets) that hold your actual credentials. The script reads them at runtime. Your keys never touch the code.
Go to your repo > Settings > Secrets and Variables > Actions.
For each project, add two secrets:
| Secret | Value |
|---|---|
MYAPP_SUPABASE_URL |
https://yourproject.supabase.co |
MYAPP_SUPABASE_ANON_KEY |
Your project's anon/public key |
Find these in your Supabase Dashboard > Project Settings > API.
All of these are optional. The script works without them, but you won't know if something fails unless you check the GitHub Actions logs.
| Secret | What it does |
|---|---|
NOTIFY_EMAIL |
Where failure alerts go |
SENDGRID_API_KEY |
Sends email via SendGrid |
SMTP_USERNAME |
Gmail SMTP (alternative to SendGrid) |
SMTP_PASSWORD |
Gmail app password |
PUSHOVER_USER_KEY |
Push notifications to your phone |
PUSHOVER_APP_TOKEN |
Pushover app token |
STATUS_SUPABASE_URL |
Supabase project to log results to |
STATUS_SUPABASE_ANON_KEY |
Anon key for the status project |
If you want ping history stored in Supabase, run the SQL in sql/create_keepalive_log.sql in your status project's SQL editor. This gives you a keepalive_log table and two views: keepalive_latest (last status per project) and keepalive_failures (last 30 days of failures).
From the GitHub Actions tab: click Supabase Keepalive > Run workflow.
Or run locally:
export MYAPP_SUPABASE_URL="https://yourproject.supabase.co"
export MYAPP_SUPABASE_ANON_KEY="your-anon-key"
node src/keepalive.jsThe script merges project config from three sources (highest priority first):
- Environment variables - individual vars like
MYAPP_SUPABASE_URL, or a singleSUPABASE_PROJECTSJSON array - JSON config file -
config/projects.json - Hardcoded fallback - the
HARDCODED_PROJECTSarray insrc/keepalive.js
All three get merged. Duplicates are resolved by name. You can use any combination.
Add an entry to config/projects.json, add the two GitHub Secrets, done. No code changes needed.
GitHub Actions cron doesn't support "every 6 days." Running every 3 days gives a comfortable safety margin. The pings are lightweight GET requests, so this costs you nothing.
Apache-2.0
Built by OpenSourcePatents LLC. If this saved your projects from pausing, star the repo.