Introduction to Inngest

Inngest is an open source platform that adds superpowers to serverless functions.

Using our SDK, a single line of code adds retries, queues, sleeps, cron schedules, fan-out jobs, and reliable steps to serverless functions in your existing projects. It's deployable to any platform, without any infrastructure or configuration. And, everything is locally testable via our UI.

Learn how to get started:

A small but powerful example

Adding sleeps, retries, and reliable steps to a function:

import { EventSchemas, Inngest } from "inngest";

type Events = {
  "user/new.signup": {
    data: {
      email: string;
      name: string;
    };
  };
};

const inngest = new Inngest({
  name: "Next.js Shop",
  schemas: new EventSchemas().fromRecord<Events>(),
});

export default inngest.createFunction(
  { name: "Signup flow" },
  { event: "user/new.signup" },
  async ({ event, step }) => {
    // ⚡ If this step fails it will retry automatically. It will only run once
    // if it succeeds
    const promo = await step.run("Generate promo code", async () => {
      const promoCode = await generatePromoCode();
      return promoCode.code;
    });

    // ⚡ Again, if the email provider is down this will retry - but we will
    // only generate one promo code
    await step.run("Send a welcome promo", () =>
      sendEmail({ email: event.data, promo })
    );

    // 😴 You can sleep on any platform!
    await step.sleep("1 day");

    // ⏰ This runs exactly 1 day after the user signs up
    await step.run("Send drip campaign", () => sendDripCampaign());
  }
);

In this example, you can reliably run serverless functions even if external APIs are down. You can also sleep or delay work without configuring queues. Plus, all events, jobs, and functions are strictly typed via TypeScript for maximum correctness. Here's how things look when you locally run:

SDK UI

Comparisons

Without Inngest, you would have to configure several jobs amongst several different queues, then handle retries yourself. There's also a chance that many promo codes are generated depending on the reliability of that API. With Inngest, you can push this function live and everything happens automatically.

Resources and help

If you have any questions we're always around in our Discord community or on GitHub.