Hardware FixRecommendedDevice not working? Your driver may be the problemCheck updates for common hardware issues.Fix DriversOctober DealsAmazon USOctober deal check: compare before you payAmazon US: current deals, useful picks and tech finds.Check DealsPC HealthRecommendedCrashes, freezes, slowdowns? Check your PC nowSpot repairable issues before they interrupt work.Check PC×
Skip to content
World desk4 min

Asynchronous Jobs Made Easy with Inngest: Set Up a TypeScript Project

Connect a TypeScript app event to Inngest background work, use durable steps and pauses, and verify the run locally.
Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

To run background work with Inngest, install its TypeScript SDK, define an event-triggered function, serve that function through your framework’s Inngest handler, and send the event that starts it. The steps below follow the TypeScript SDK v4 documentation and the official end-to-end quick start, which uses Next.js App Router. If your app uses another framework, connect the function with that framework’s matching Inngest HTTP handler rather than copying the Next.js route unchanged.

How Inngest connects events to background work

Inngest’s vendor documentation describes it as “an event-driven durable execution platform that lets you write reliable background jobs, scheduled tasks, and multi-step workflows in TypeScript without any additional infrastructure.” That is the vendor’s description, not an independent comparison with other job systems.

As an Amazon Associate I earn from qualifying purchases.

The basic flow is straightforward: your app sends a named event, an Inngest function registered to handle that event starts, and work inside durable steps can be resumed or retried. The application must expose the function through an Inngest serve handler; defining a function alone does not make it available to run. The official quick start demonstrates this flow with Next.js App Router.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Install the TypeScript SDK and create a shared client

The SDK documentation lists Node.js, Bun, Deno, and edge runtimes as supported. Install the package in your project:

npm install inngest

Create a client module and initialize it once with a stable application ID. The exact file path is a project convention; the important part is that your functions and serving handler import the same client.

import { Inngest } from "inngest";

export const inngest = new Inngest({ id: "my-app" });

The package installation command and client initialization follow the official TypeScript SDK reference. Replace my-app with an ID that identifies your application.

Rank #2
TypeScript Programming Language - Software Engineer & Coder T-Shirt
  • TypeScript implements a superset of syntax for strictly typed development, facilitating deep static analysis and enhanced development environment integration. The compiler translates source into standard script formats, ensuring parity across any runtime.
  • TypeScript is ideal for front-end developers, full-stack engineers, and software architects who build large-scale web applications. It serves those looking to improve code excellence, reduce bugs through static checking, and maintain complex projects more.
  • Lightweight, Classic fit, Double-needle sleeve and bottom hem

Define a function with an event trigger

An Inngest function needs a stable function ID and a trigger. In the quick-start example, the trigger listens for the app/task.created event. Put work you want Inngest to track and retry inside named step.run() calls.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
export const processTask = inngest.createFunction(
  { id: "process-task" },
  { event: "app/task.created" },
  async ({ event, step }) => {
    const result = await step.run("process-task", async () => {
      // Perform retryable work using event.data.
      return { taskId: event.data.taskId };
    });

    await step.sleep("wait-before-follow-up", "1s");

    return result;
  },
);

This is an illustrative shape for the quick-start concepts: adapt the event data and work to your application. A successful step.run() saves its result. If a later part of the function fails and retries, completed earlier steps remain saved rather than being rerun as ordinary uncheckpointed code. A thrown error in a step can cause that step to retry. The function reference documents four retries by default, with retry configuration allowed from zero through twenty; this describes Inngest’s documented function behavior, not a guarantee that arbitrary code outside steps is checkpointed.

step.sleep() pauses the workflow for the requested duration without keeping the originating HTTP request open. In the quick start, the pause is one second. See the function reference for the documented function and step behavior.

Serve and register the function in your framework

The function must be registered with an Inngest serving handler so Inngest can discover and invoke it. The official end-to-end example uses Next.js App Router and exposes its handler at /api/inngest. In that route, configure the Inngest Next.js handler with the shared client and the function or functions to serve, then export the HTTP methods required by the handler, as shown in the Next.js quick start.

For Express, another framework, or a different runtime, use the corresponding Inngest HTTP handler and its framework-specific route setup. Do not assume that the Next.js route file or exports can be pasted into another framework unchanged; the quick start directs readers to select the matching handler.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
Independent reader supportYour contribution helps us test, update, and keep practical guides available for everyone.Support on Ko-Fi

Send the event that starts the job

Once the handler serves the registered function, the application can send the matching event. The quick start sends app/task.created from an application route. Its event name must match the function trigger, and its data should include the values the function needs.

await inngest.send({
  name: "app/task.created",
  data: { taskId: "task-123" },
});

Sending the event starts a run of the registered function; it does not make the function’s entire execution part of the request that sent the event. Keep the event payload focused on the information needed by the workflow.

Verify the run locally with the Inngest Dev Server

The quick start includes local verification so you can inspect what happened before deploying. Run the Inngest Dev Server using the current command and setup instructions in the Dev Server documentation, then start your application and send a sample event. The getting-started guide describes the local trace UI at http://localhost:8288.

  1. Start the Dev Server and the app route that serves the Inngest handler.
  2. Send an event with the same name as the function trigger, such as app/task.created.
  3. Open the local trace UI and locate the run created by that event.
  4. Inspect the event payload, step output, timeline, and completion state to confirm that the function followed the expected path.

The trace is useful for checking that event registration, handler serving, step execution, and pauses fit together. If a run does not appear, check that the app’s handler is running, that the function is registered there, and that the sent event name matches its trigger.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Product prices and availability are accurate as of the date/time indicated and are subject to change. Any price and availability information displayed on Amazon at the time of purchase will apply.

Leave a Reply

Your email address will not be published. Required fields are marked *

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

More from the Wire

  1. World desk4 min
    How to Spot an AI Voice Scam Before Sending MoneyDon’t rely on how a caller sounds. Pause, call back through a known number, and verify the emergency with another trusted person before sending money.
  2. Mountain View desk4 min
    Google’s SynthID Detector: How to Check AI-Generated Images, Video and AudioGoogle’s SynthID Detector looks for an embedded watermark in supported images, video and audio. Here is what its results do—and do not—show.
  3. Redmond desk20 min
    How to create a link to File or Folder in Windows 11Windows 11 gives you several ways to point to a file or folder without moving or duplicating it. You can create a desktop shortcut,…
Recommended PC Tool
Recommended PC Tool
PC Slower Than It Used to Be?Free scan - under a minute
Outdated Drivers Are Slowing You DownFree scan - exact matches

Two free Windows tools

One Free Minute Could Fix That PC

Before you go - each of these free tools takes about a minute and tackles what quietly slows a Windows PC down.

Special offer. View Outbyte info, uninstall instructions, EULA, and Privacy Policy.