Node.js application to ping/pulse a Supabase database and writes a random number to a public anonymous table. Useful to prevent your database from being marked to be paused to inactivity.
-
Install Dependencies (Requires Node 16.0+)
npm install
-
Environment Variables
Create a
.env
file with the following content:SUPABASE_URL=your_supabase_url SUPABASE_ANON_KEY=your_supabase_anon_key
Replace
your_supabase_url
andyour_supabase_anon_key
with your actual Supabase credentials. -
Run the Application
node index.js
To schedule this script as a cron job:
-
Open your crontab config:
crontab -e
-
Add a cron job to run the script at your desired frequency. For example, to run it every day at midnight:
0 0 * * * /usr/bin/node /path/to/your/supabase-ping/index.js
Make sure to replace
/path/to/your/supabase-ping
with the actual path to your project.