DevOps & Cloud

Vercel Cron vs Supabase Cron: Which Should You Choose?

Choosing a cron solution depends on your infrastructure stack and frequency requirements. Here is a breakdown of how they compare.

By · · 5 min read

Short answer

Vercel Cron is ideal for serverless Next.js apps but limited on Hobby plans, often requiring external services like cron-job.org for frequent tasks. Supabase Cron, powered by pg_cron, runs directly in your PostgreSQL database, offering high-precision execution without external dependencies. Choose based on whether your task logic resides in the frontend or database.

Key takeaways

  • Vercel Cron is tied to the serverless function lifecycle, making it best for API endpoint tasks.
  • Supabase Cron runs inside PostgreSQL, executing SQL queries or functions without external HTTP calls.
  • Vercel Hobby plans restrict cron frequency to once per day, often necessitating third-party triggers.
  • Use Supabase for database-heavy maintenance; use Vercel for application-level logic like emails or API orchestration.

How Vercel Cron Works and Its Architecture

Vercel Cron triggers your serverless functions by making an HTTP GET request to a specific path in your project. This means your cron task is essentially a standard API route that performs a specific action, such as sending an email, hitting an external API, or clearing a cache.

The system adds a header, x-vercel-cron-schedule, to these requests, which allows you to verify that the invocation came from the Vercel scheduler. This integration is designed for developers who want to keep their entire application logic contained within a single Next.js project.

When a Vercel cron job initiates, it spins up a new instance of your serverless function. This process behaves exactly like a user visiting a page or hitting an endpoint. Because it relies on the same infrastructure as your application traffic, you can utilize your existing environment variables, database connections, and libraries directly within the code that runs the job.

However, since it is an HTTP-based system, it is subject to the same cold-start latency that affects any other serverless route. If your task requires significant processing, you must ensure your function code handles the initiation quickly while the underlying infrastructure warms up to execute the payload.

Understanding Supabase Cron and pg_cron

Supabase Cron is based on the PostgreSQL pg_cron extension. Unlike Vercel, which relies on HTTP requests, Supabase executes your tasks directly within your database engine. This is ideal for tasks that interact heavily with your data, such as partition management, row cleanup, or scheduled aggregation.

Because it runs inside the database, there is no network overhead or risk of the function timing out during an HTTP handshake. You define these jobs using SQL, making them highly portable across any PostgreSQL environment that supports the pg_cron extension.

Operating within the database engine provides a distinct advantage regarding data integrity. When your logic resides in the database, you can execute complex transactions that ensure the consistency of your data without worrying about network partitions failing mid-process. The internal scheduler manages the job execution thread directly, meaning there is no middleware or secondary service involved.

This execution model keeps database maintenance operations separated from your application runtime. Even if your web server or frontend application experiences high latency or downtime, the database-level cron job will continue to fire as long as the underlying PostgreSQL instance remains active and reachable.

Comparison Table: Vercel vs Supabase

Use this table to decide which scheduling mechanism fits your architecture and project scale.

The differences reflect the fundamental philosophy of where your application logic resides: either at the edge or at the data persistence layer.

FeatureVercel CronSupabase Cron
Execution LocationServerless Function (HTTP)Database Engine (Internal SQL)
Primary Use CaseApplication Logic / APIDatabase Maintenance / Data
Configurationvercel.json or SDKSQL / pg_cron
Hobby LimitationsOnce per day limitDepends on Supabase plan

Why I Use cron-job.org as a Workaround

Vercel Hobby plan imposes a strict limit: cron jobs can only execute once per 24 hours. For applications that require more frequent background tasks, this is often insufficient. To get around this, I use cron-job.org as an external pinger.

By pointing a cron-job.org task to my internal API endpoint, I can trigger my serverless functions at whatever interval I need. This approach effectively bypasses the platform's native scheduling limitations while keeping the execution logic within my Next.js deployment.

Setting this up involves creating a protected API route in your project. You should secure this route with a secret key passed via a custom header, ensuring that only your authorized cron-job.org instance can trigger the function. This prevents unauthorized users from calling your background endpoints repeatedly and consuming your serverless execution minutes.

Once the endpoint is secured, you configure the schedule within the cron-job.org dashboard. This decoupling allows you to manage timing independently of your code deployment, meaning you can adjust the frequency of task execution without needing to rebuild or redeploy your entire application.

# Example of triggering a Vercel function using a public URL
curl -X GET https://your-app.vercel.app/api/cron-endpoint

Gotchas and Trade-offs in Task Scheduling

When choosing between these systems, consider the execution context. If your cron job takes longer than the serverless function limit, Vercel will kill it. Supabase Cron, while running in the database, can also lock rows or consume excessive CPU if not tuned properly.

Avoid using Vercel Cron for long-running processes that require external state management. Always favor Supabase for tasks that need to run strictly on the database side to avoid data consistency issues or expensive network round-trips.

Serverless functions operate with finite memory and execution time. If your cron job attempts to process a massive dataset, you risk hitting these architectural ceilings. For example, trying to batch-update millions of rows through an API route will likely time out, whereas the same operation executed in pg_cron will remain contained within the database processing engine.

Conversely, if your cron job needs to perform external actions like sending emails or notifying Slack via webhooks, do not attempt to trigger these from the database. Instead, keep those tasks on the serverless side where you have access to existing application code and environment-specific secret management.

Evaluating Future Maintenance Requirements

Evaluating your project requirements is necessary for long-term stability. If you foresee your project requiring heavy database indexing, partition cleanup, or weekly report generation, the migration toward pg_cron in Supabase early on may save you from moving logic later.

On the other hand, if your automation logic relies on third-party SDKs, OAuth flows, or external API integration, the serverless approach provided by Vercel remains the most natural fit. Managing these dependencies directly within a JavaScript or TypeScript environment is simpler than handling them from within a SQL command.

Frequently asked questions

Can I run cron jobs every minute on Vercel Hobby?

No, the Vercel Hobby plan restricts cron jobs to once per day. If you need minute-level frequency, you must either upgrade to the Pro plan or use an external service like cron-job.org to ping your endpoint.

Does Supabase Cron require a server?

No, Supabase Cron is an extension called pg_cron that runs directly inside your PostgreSQL database. You configure it via SQL commands rather than deploying a separate server or function.

Which is better for database cleanup tasks?

Supabase Cron is superior for database cleanup. Since it runs inside the database engine, it executes SQL commands directly without the overhead of HTTP requests or serverless function timeouts.

Sources & further reading

Work with me

Building something like this?

I build AI-powered products with Next.js, Python and LLM APIs, from first prototype to production. If you need help with a project, a second opinion on your architecture, or a developer on your team, get in touch.

About the author

Tushar Gautam is a full-stack & ai product engineer in India. He builds AI SaaS products such as an AI video ad generator, a RAG chatbot platform and a Razorpay-powered report service, mostly with Next.js, Flask and the Gemini API. See the projects, GitHub or LinkedIn.

This article was drafted with the help of AI (Google Gemini) from official documentation and published by Tushar Gautam. Spotted an error? Let me know.