Inngest is a durable workflow engine for TypeScript. It handles retries, scheduling, and event-driven functions — without managing queues or workers.
The Free APIs You're Missing
1. Event-Driven Functions
import { inngest } from "./client";
export const processSignup = inngest.createFunction(
{ id: "process-signup" },
{ event: "user/signup" },
async ({ event, step }) => {
const user = await step.run("create-user", async () => {
return await db.users.create({ data: event.data });
});
await step.run("send-welcome", async () => {
await sendEmail(user.email, "Welcome!");
});
await step.sleep("wait-3-days", "3d");
await step.run("send-onboarding", async () => {
await sendEmail(user.email, "How to get started");
});
}
);
2. step.run — Durable Steps with Auto-Retry
Each step.run is individually retriable. If step 3 fails, steps 1 and 2 don't re-execute.
3. step.waitForEvent — Pause for External Events
export const checkoutFlow = inngest.createFunction(
{ id: "checkout" },
{ event: "cart/checkout" },
async ({ event, step }) => {
await step.run("reserve-inventory", () => reserveItems(event.data.items));
const payment = await step.waitForEvent("wait-for-payment", {
event: "payment/completed",
match: "data.orderId",
timeout: "30m",
});
if (!payment) {
await step.run("release-inventory", () => releaseItems(event.data.items));
return { status: "expired" };
}
await step.run("fulfill-order", () => fulfillOrder(event.data.orderId));
return { status: "completed" };
}
);
4. Scheduled Functions — Cron
export const dailyCleanup = inngest.createFunction(
{ id: "daily-cleanup" },
{ cron: "0 2 * * *" },
async ({ step }) => {
const deleted = await step.run("cleanup", () => db.sessions.deleteExpired());
return { deleted: deleted.count };
}
);
5. Fan-Out — Parallel Execution
export const batchProcess = inngest.createFunction(
{ id: "batch-process" },
{ event: "batch/start" },
async ({ event, step }) => {
const items = event.data.items;
// Process all items in parallel
const results = await Promise.all(
items.map((item, i) =>
step.run(`process-${i}`, () => processItem(item))
)
);
await step.run("summarize", () => createSummary(results));
}
);
Getting Started
npm install inngest
npx inngest-cli@latest dev
Need data from any website delivered as clean JSON? I build production web scrapers that handle anti-bot, proxies, and rate limits. 77 scrapers running in production. Email me: Spinov001@gmail.com
Check out my awesome-web-scraping list for the best scraping tools and resources.
Top comments (0)