Background Jobs for Node.js using Next.js, Inngest, Supabase, and Vercel

Cyrille
3 min readApr 3, 2023

--

In this tutorial, we’ll walk through building a Next.js web app powered by Supabase, a powerful database and storage solution, and running background jobs using Inngest. We’ll also cover how to deploy your app to Vercel, a popular serverless platform.

By the end of this tutorial, you’ll have a fully functioning web app that can handle complex data operations and automate background tasks. So let’s get started!

About Me

As a tech creator, I build web2 and web3 products for a range of industries. I’m experienced in financial services, natural resources, medical tech, and blockchain. I’m a founding member of multiple companies, operating as CTO, product manager, and developer. I use Medium as a way to teach about technology and discuss business challenges beyond tech.

Follow me on Twitter or join my Telegram group to brainstorm and build together.

Background jobs

Background jobs are asynchronous tasks that are executed in the background without disrupting the main thread or blocking the user interface. They are commonly used by developers to improve the user experience of their applications, as well as to handle resource-intensive tasks that would otherwise slow down the application’s performance.

Here are a few reasons why developers should use background jobs in their applications:

  1. Improved application responsiveness: By executing tasks in the background, developers can prevent their applications from becoming unresponsive or freezing when executing long-running tasks. This allows users to continue using the application without interruption.
  2. Better scalability: Background jobs can be distributed across multiple servers or instances, which enables applications to scale up to handle increased demand without negatively impacting performance.
  3. Reduced server load: Running resource-intensive tasks in the background can reduce the load on the application server, allowing it to handle more requests and improve overall performance.

Examples of jobs that should be run as a background jobs:

  1. Image processing: When an application needs to process large image files, it can be time-consuming and resource-intensive. By running image processing tasks in the background, the application can continue to respond to user requests while the images are being processed.
  2. Email notifications: Sending email notifications can take a few seconds or longer, especially when sending large numbers of messages. By running email notification tasks in the background, the application can continue to handle user requests while notifications are being sent.

Overview

We will build a web app allowing users to upload + store images. When an image is uploaded, we will run a background job to create a thumbnail version of that image.

The series will be broken up into several tutorials:

  1. Part 1 — Configuring and testing a supabase database table and policies
  2. Part 2 — User Authentication made easy with Supabase + Next.js

Stack

  • Vercel is a platform as a service company.
  • Next.js is a web development framework.
  • Inngest is a serverless background job as a service.
  • Supabase is a database as a service.

Full code repo.

If this article was helpful, join our Telegram group! It is a space to discuss new ideas, build projects, and troubleshoot code and business challenges.

I build web2 and web3 products for a range of industries. I’m a founding member of multiple companies, operating as CTO, product manager, and developer. I use Medium as a way to teach about technology and discuss business challenges beyond tech.

Follow me on Twitter.

--

--

Cyrille

I build web2 and web3 products and teams. Depending on the project, I operate as a CTO, product manager, developer, advisor, or investor.