Prevent Supabase free tier pauses using a cron job

Natt, Design Engineer (2 years ago), updated (last week)2 min read

I never sleep, cause sleep is the cousin of death.

Nas

As an indie hacker and Postgres dappler, I like using Supabase for spinning up Postgres databases for my education and hobbyist projects. I appreciate the generous free tier but free projects are paused after 1 week of inactivity. Supabase would send you warning emails before and when the your project is paused.

To be low maintenance, I would want my projects using Supabase to be running even if no activity over a week. The easiest way to keep your Supabase project awake is to schedule a cron job that pings Supabase's REST API once a week.

Supabase exposes a REST API you can call directly. You can use the curl command on your terminal to test the API.

curl -X GET "https://<PROJECT_ID>.supabase.co/rest/v1/<TABLE_NAME>" \  -H "apikey: <API_KEY>"

After you got a successful result, you can create a GitHub Actions workflow to ping the API once a week.

# .github/workflows/supabase-heartbeat.ymlname: Supabase weekly pingon:  schedule:    - cron: "0 0 * * 0" # Every Sunday at midnight  workflow_dispatch:jobs:  ping:    runs-on: ubuntu-latest    steps:      - name: Ping Supabase REST API        run: |          curl -X GET "https://<PROJECT_ID>.supabase.co/rest/v1/<TABLE_NAME>" \            -H "apikey: <API_KEY>"

GitHub Actions is free for public repositories. For private repositories, Its free plan includes 2,000 minutes per month.

Further notes

Since publishing an update, I've seen the same approach shared in several places. I'm happy it has helped others solve the same problem.

If you're looking for Postgres with a more generous free tier, Neon is another good option. Its free tier supports up to 100 projects, and projects do not pause due to inactivity.