Inngest is a serverless event-driven platform for building reliable background jobs, workflows, and scheduled tasks without managing queues.
Define Functions
import { Inngest } from "inngest";
const inngest = new Inngest({ id: "my-app" });
export const processOrder = inngest.createFunction(
{ id: "process-order", retries: 3 },
{ event: "order/created" },
async ({ event, step }) => {
const payment = await step.run("charge-payment", async () => {
return stripe.charges.create({ amount: event.data.amount });
});
await step.run("send-confirmation", async () => {
return sendEmail(event.data.email, { orderId: event.data.id });
});
await step.sleep("wait-for-delivery", "3 days");
await step.run("send-review-request", async () => {
return sendEmail(event.data.email, { template: "review-request" });
});
return { success: true, paymentId: payment.id };
}
);
Send Events
await inngest.send({ name: "order/created", data: { id: "123", email: "user@example.com", amount: 4999 } });
Scheduled (Cron)
export const dailyReport = inngest.createFunction(
{ id: "daily-report" },
{ cron: "0 9 * * *" },
async ({ step }) => {
const stats = await step.run("get-stats", () => getStats());
await step.run("send-report", () => sendSlack(stats));
}
);
Key Features
- Event-driven workflows
- Automatic retries with backoff
- Step functions (durable execution)
- Cron scheduling
- Local dev server
Need to scrape or monitor web data at scale? Check out my web scraping actors on Apify or email spinov001@gmail.com for custom solutions.
Top comments (0)