Skip to content

mustafakibar/supabase-pause-prevention

Repository files navigation

Supabase Pause Prevention

A scheduled Trigger.dev job that keeps a Supabase project active by performing periodic writes against a dedicated table, preventing it from being paused due to inactivity.

Features

  • Scheduled keep-alive task backed by Trigger.dev v3.
  • Inserts a row into a configured Supabase table on each cron tick.
  • Automatically prunes the table once it exceeds a configurable row limit.
  • Configuration driven entirely by environment variables.

Tech Stack

Requirements

  • Bun >= 1.3 (developed with Bun 1.3.11)
  • A Supabase project with a table whose columns all have default values and RLS disabled (or a permissive update policy)
  • A Trigger.dev account and project

Installation

git clone <repository-url>
cd supabase-pause-prevention
bun install

Environment Variables

Copy .env.example to .env.local (used in development via dotenv) and fill in the values:

Variable Description
TRIGGER_PROJECT_ID Trigger.dev project identifier
SUPABASE_PROJECT_URL Supabase project URL (e.g. https://<id>.supabase.co)
SUPABASE_ANON_KEY Supabase anonymous API key
SUPABASE_TABLE_NAME Target table used for keep-alive writes
SUPABASE_TABLE_MAX_COLUMN_SIZE Maximum rows before the table is pruned
CRON_EXPR Cron expression for the schedule (e.g. 1 3 * * 1,3)

For production, configure the same variables in the Trigger.dev dashboard.

Usage

Start the Trigger.dev dev runner locally:

bunx trigger.dev@latest dev

Deploy to Trigger.dev:

bunx trigger.dev@latest deploy --skip-sync-env-vars

See the Trigger.dev CLI docs for more options.

License

This project is licensed under the MIT License. See LICENSE for details.

About

My Supabase Pause Prevention using Trigger.dev infrastructure

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors