Periodically calls the Supabase database via a cron scheduled task to prevent free-tier projects from being paused after 7 days of inactivity
supabase-pause-prevention — Next.js Business Template
By travisvn
A Next.js tool template to prevent Supabase free-tier projects from being paused after 7 days of inactivity, using a scheduled task to call the database and keep the project active.
Explore the design
Compare the page layouts and mobile experience. Open any screenshot for a closer look.
Actual screenshot captured by the server browser.
All pages & views 3
Screenshots show visual appearance; interactive behavior may differ.
What stands out
A quick read of the recorded project description.
Addresses Vercel free tier's limit of one cron job per account by using the main project's API endpoint to forward requests and wake up other projects
Core changes are concentrated in four files: the keep-alive route, helper functions, configuration file, and vercel.json
Provides example SQL for a keep-alive table and supports optional database insert and delete actions
Includes an example of integrating other projects using Prisma as an ORM, as well as legacy helper functions for the /pages directory
Template Details
This template addresses the issue of Supabase free-tier projects being automatically paused after more than 7 days of inactivity. The core approach is to create a cron scheduled task in a Next.js project that periodically makes a simple query to the Supabase database, keeping the project active.
Since Vercel's free tier limits each account to only one cron job, the template also provides a multi-project solution: the main project uses a keep-alive API endpoint to request the keep-alive endpoints of other Supabase projects, thereby waking up multiple projects periodically. Other projects only need to provide an accessible API endpoint that actually calls the database and ensure the server does not cache the response.
In terms of code structure, only four files really need attention: /app/api/keep-alive/route.ts (the API endpoint executed by cron), /app/api/keep-alive/helper.ts (helper functions), /config/keep-alive-config.ts (configuration), and /vercel.json (scheduling configuration). The utils/supabase directory comes from the official Supabase Next.js tutorial example, and the rest is boilerplate code generated by create-next-app. The README recommends using a keep-alive table and supports optional insert and delete operations.
Note that the author has indicated in the README that a new version rewritten in Python is available (the supabase-inactive-fix repository). This template is based on Next.js and React, is licensed under MIT, and is free-tier code; third-party assets such as demo images, fonts, and icons, as well as external services like domains, hosting, and databases, require separate verification of licensing and costs.
Is it right for your project?
Use Cases
- Supabase free-tier projects deployed on Vercel need to remain active long-term
- Maintaining multiple Supabase free-tier projects and wanting to keep them alive with a single cron job
- Existing Next.js + Supabase projects wanting to add a keep-alive mechanism with minimal changes
- Other projects using ORMs like Prisma need to connect to the main project's keep-alive requests
Suitable For
- Next.js developers using Supabase free tier and deploying on Vercel
- Individuals or small teams needing periodic activity checks for multiple Supabase projects
- Developers who want to read the source code directly and trim the keep-alive logic as needed
Getting started & customization
Use these recorded setup notes alongside the repository instructions for your chosen version.
- 1
Copy /app/api/keep-alive/route.ts, helper.ts, /config/keep-alive-config.ts, and /vercel.json to your own project
- 2
Create a keep-alive table in Supabase; refer to the SQL statement provided in the README
- 3
Add an accessible API endpoint for other Supabase projects that need keep-alive, and ensure that endpoint actually queries the database and is not cached by the server
- 4
The README notes that a new Python-rewritten version is available; confirm version differences before choosing
License & source material
Usage conditions & limitations
Free to use · keep license noticeThis entry covers the free version under the MIT license in a public repository; the free scope is limited to that version's code and does not imply that external services or third-party assets are free.
Must comply with when using
- Free use, modification, commercial use, and distribution of this version's code are permitted.
- When distributing copies or substantial portions of the code, retain the original author's copyright notice and the full MIT license notice.
- The code is provided as-is; warranties and limitations of liability are governed by the original license and applicable law.
Additional costs & items to verify
- This solution targets Supabase free tier: projects are paused after more than 7 days of inactivity, so a scheduled task is needed to keep them active; paid plans do not have this restriction.
- Vercel free tier allows only one cron job per account; multi-project keep-alive requires forwarding requests via the main project's API endpoint.
- Other Supabase projects must provide an accessible API endpoint that actually calls the database, otherwise they cannot be kept alive.
- The keep-alive endpoint must disable server-side caching; otherwise cached responses will not actually trigger database calls.
- The author notes a new Python-rewritten repository is available; confirm version differences before choosing this template.
- Demo images, fonts, icons, and other third-party assets must be checked against their respective licenses; the code's MIT license alone is not sufficient.
- External services such as domains, hosting, databases, payments, or AI may incur additional charges.
View Original Text Basis
Permission is hereby granted, free of charge
Original License Text
On the free-tier plan, projects that are inactive for more than 7 days are paused.
Original README
as Vercel limits free-tier users to one cron job
Original README
The only requirement is that this endpoint is reachable and makes a call to your Supabase database
Original README
Ensure the server doesn't cache this
Original README
https://github.com/travisvn/supabase-pause-prevention/blob/main/LICENSEhttps://github.com/travisvn/supabase-pause-prevention/blob/main/README.md__NEW & IMPROVED VERSION__ written in Python available at [supabase-inactive-fix repo](https://github.com/travisvn/supabase-inactive-fix)
Original README
Compiled by DeepSeek based on repository license and README ·2026-10-02. Results only cover the materials read; dependencies, images, fonts, and subsequent term changes are subject to their respective original texts.
Project checks & description sources
Template Information
- Source platforms
- GitHub
- Documentation and maintenance reference score
- More documented · 90 / 100
- Technologies
- Next.js · React
- Website type
- Corporate Website
How this score is calculated
Our heuristic uses license records (up to 30), a demo link (12), a preview (10), stars (15), recorded maintenance (15), description completeness (8), feature records (5) and classification data (5). It is not a code, security or performance test, or a Google score. A link does not establish tested functionality.
What to verify for this project
- Repository update recorded
- 2025-04-01
- Screenshot last checked
- 2026-10-02
A demo link is listed. Check it with your own content and viewport sizes; its presence does not confirm that forms, authentication or payments work.
The catalog identifies Next.js as the primary stack. Check the actual dependency manifest and lockfile for versions and hosting requirements. These notes use recorded metadata, not a code audit or a deployment test.
Use a selection guide →How this description was prepared
AI-assisted description based on catalog records and repository material. Repository authors are not automatically the reviewers of this description.
Automatically checked against source and license rules; no manual editorial review.
Inspect the recorded source material
SHA-256: a8b7e14c3fc0d1188a3236d9516609d8051d177146f03895ac91964b8455c8e3
2026-10-02T09:25:52.453Z
Source file / repository# Supabase Pause Prevention ⏸️





🛑 Stop Supabase projects from pausing due to inactivity! :raised_hands:
> On the free-tier plan, projects that are inactive for more than 7 days are paused.
# Please star ⭐️ if you find this useful
> [!TIP]
> __NEW & IMPROVED VERSION__ written in Python available at [supabase-inactive-fix repo](https://github.com/travisvn/supabase-inactive-fix)
## Solution / How it works
- Creating a _cron job_ (scheduled task) that makes a simple database call
- _(This keeps your Supabase project active)_
- Fetching `keep-alive.ts` API endpoints for the other projects, as Vercel limits free-tier users to one cron job.
## Getting Started
**Super simple to add to your existing Supabase project!**
### Configure your main project
_Only 3 files matter_
- [`/app/api/keep-alive/route.ts`](app/api/keep-alive/route.ts) - API endpoint the cron job will execute
- [`/app/api/keep-alive/helper.ts`](app/api/keep-alive/helper.ts) - Helper functions called from `route.ts`
- [`/config/keep-alive-config.ts`](config/keep-alive-config.ts) - Configuration for your setup
- [`/vercel.json`](vercel.json) - Directs Vercel to periodically run the `keep-alive` endpoint
`utils/supabase` folder contains files provided in the Supabase docs for the [Next.js Web App demo — Supabase](https://supabase.com/docs/guides/getting-started/tutorials/with-nextjs)
Everything else is boilerplate from Next.js `create-next-app`
### Configuring your other Supabase projects
After selecting your primary project _(the one that implements the code provided in this repository)_, you'll want to add an API endpoint to your other Supabase projects
The only requirement is that this endpoint is reachable and makes a call to your Supabase database
> [!NOTE]
> API endpoint must make database call
> Ensure the server doesn't cache this
<details>
<summary>Example of a setup using Prisma as an ORM</summary>
`/pages/api/keep-alive.ts`
```typescript
// Next.js API route support: https://nextjs.org/docs/api-routes/introduction
import type { NextApiRequest, NextApiResponse } from 'next'
import { prisma } from 'src/server/db'
// See next example for contents of @/utils/helper
import { generateRandomString } from '@/utils/helper'
export default async function handler(
_req: NextApiRequest,
res: NextApiResponse
) {
try {
const randomString = generateRandomString()
const dbResponse = await prisma.keepAlive.findMany({
where: {
name: {
equals: randomString,
}
}
})
const successMessage = (dbResponse != null) ? `Success - found ${dbResponse.length} entries` : "Fail"
res.status(200).json(successMessage)
} catch (e) {
res.status(401).send("There was an error")
}
}
```
`/prisma/schema.prisma`
```prisma
// This is your Prisma schema file,
// learn more about it in the docs: https://pris.ly/d/prisma-schema
generator client {
provider = "prisma-client-js"
previewFeatures = ["postgresqlExtensions"]
}
datasource db {
provider = "postgresql"
url = env("DATABASE_URL")
extensions = [uuidOssp(map: "uuid-ossp")]
}
model KeepAlive {
id BigInt @id @default(autoincrement())
name String? @default("")
random String? @default(dbgenerated("gen_random_uuid()")) @db.Uuid
}
```
</details>
<details>
<summary>Helper function for '/pages' directory (legacy support)</summary>
`/utils/helper.ts`
```typescript
const defaultRandomStringLength: number = 12
const alphabetOffset: number = 'a'.charCodeAt(0)
export const generateRandomString = (length: number = defaultRandomStringLength) => {
let newString = ''
for (let i = 0; i < length; i++) {
newString += String.fromCharCode(alphabetOffset + Math.floor(Math.random() * 26))
}
return newString
}
```
</details>
### Sample SQL
Any table and column can be called, but if you'd rather go with a generic, here's a SQL query for a `keep-alive` table
```sql
CREATE TABLE "keep-alive" (
id BIGINT generated BY DEFAULT AS IDENTITY,
name text NULL DEFAULT '':: text,
random uuid NULL DEFAULT gen_random_uuid (),
CONSTRAINT "keep-alive_pkey" PRIMARY key (id)
);
INSERT INTO
"keep-alive"(name)
VALUES
('placeholder'),
('example');
```
> [!IMPORTANT]
> It is now **strongly recommended** to use a `keep-alive` table like the one above.
> This is in light of the added features for _optional_ database insertion & deletion actions
___
### Sample response
Visiting `https://your-project-domain.vercel.app/api/keep-alive`
```
Results for retrieving
'mzmgylpviofc' from 'keep-alive' at column 'name': []
Other Endpoint Results:
https://your-other-vercel-project-urls.vercel.app/api/keep-alive - Passed
https://your-other-supabase-app.com/api/keep-alive - Passed
```
<details>
<summary>Extended response (with insertion / deletion)</summary>
```
Results for retrieving entries from 'keep-alive' - 'name column: [{"name":"placeholder"},{"name":"random"}, ... ,{"name":"uujyzdnsbrgi"}]
Results for deleting
'uujyzdnsbrgi' from 'keep-alive' at column 'name': success
```
</details>
___
This is a [Next.js](https://nextjs.org/) project bootstrapped with [`create-next-app`](https://github.com/vercel/next.js/tree/canary/packages/create-next-app).
Explore similar templates
Compare previews and descriptions within the same stack and category.

SaaS-Boilerplate
SaaS-Boilerplate is an open-source SaaS starter template built with Next.js App Router, React 19, TypeScript, Tailwind CSS, and Shadcn UI.
Next.js · SaaS

Next-JS-Landing-Page-Starter-Template
A free Next.js landing page starter template written in Tailwind CSS and TypeScript, featuring built-in navbar, hero, features, CTA banner, and footer sections.
Next.js · Corporate Website

next-saas-starter
A free Next.js SaaS marketing landing page template from Blazity, using static generation and styled-components with no extra UI library.
Next.js · SaaS

startup-nextjs
Startup is a free, MIT-licensed Next.js template from NextJSTemplates for SaaS startups and corporate landing pages.
Next.js · SaaS

shadcn-landing-page
A Next.js landing page template built with Shadcn, TypeScript, and Tailwind, converted from a Shadcn-Vue version. It includes sections such as Navbar, mobile Sidebar, Hero, Pricing, FAQ, and Footer, and highlights responsive design, navigation, and dark mode.
Next.js · Corporate Website

shadcn-dashboard-landing-template
An open-source admin dashboard and marketing landing page template built on shadcn/ui and Tailwind CSS, with both Vite + React and Next.js versions in one repository.
Next.js · Admin dashboard
