A lightweight Python serverless project to keep your Supabase database alive.
It periodically sends a small query to prevent the database from going idle.
This project is optimized for deployment on Vercel and is intended to be triggered by an external cron service.
- 🛠 Configurable target table via environment variables
- 🚀 Fully serverless, ideal for Vercel hosting
- 📦 Simple environment setup
- 🆓 Open-source, non-commercial use only
- Vercel Cron
supabase-keepalive/
├── api/
│ └── keepalive.py
├── .env.example
├── requirements.txt
├── vercel.json
└── LICENSE
Create a .env file based on the provided .env.example:
SUPABASE_CONFIG='[
{
"name": "Supabase1",
"supabase_url": "https://your-project.supabase.co",
"supabase_key": "your-api-key",
"table_name": "your_table"
},
{
"name": "Supabase2",
"supabase_url": "https://another-project.supabase.co",
"supabase_key": "another-api-key",
"table_name": "another_table"
}
]'Important:
Never commit your real .env file.
On Vercel, configure these environment variables in Project Settings > Environment Variables.
- Push the project to a GitHub repository.
- Import the repository into Vercel.
- Set up environment variables on the Vercel dashboard.
- Deploy your project.
- Edit
vercel.jsonfile
Use any external cron service (such as EasyCron, UptimeRobot, GitHub Actions)
to periodically trigger your endpoint once per day:
GET https://your-vercel-project.vercel.app/api/keepalive
GET /api/keepalive
GET /api/keepalive/all
GET /api/keepalive/index (default index 0)
GET /api/keepalive/index/1 (index 1)
GET /api/keepalive/name/Supabase1 (name Supabase1)
- Success:
{ "status": "success", "message": "ok" } - Failure:
{ "status": "error", "message": "failure" }
This project is licensed under the MIT license.
- This project uses Supabase Python Client and FastAPI.
- Keep the queried table lightweight to ensure minimal resource usage.
- Supabase databases usually remain active, but periodic pings add an extra layer of stability for serverless applications.