Featured image for Deploying event-driven functions to RedwoodJS blog post

Deploying event-driven functions to RedwoodJS

Jack Williams· 11/21/2022 (Updated: 6/20/2024) · 2 min read

The Inngest SDK has added official support for another framework - RedwoodJS!

Redwood is an opinionated, full-stack, JavaScript/TypeScript web application framework. It's built on top of React, GraphQL, and Prisma and is designed to make it easy to start a new project and scale to a large team.

Part of Redwood's roster is its Serverless Functions, which are a great way to add server-side logic to your application. Inngest's RedwoodJS handler allows you to register those functions with Inngest and use Inngest's event-driven infrastructure to trigger them as background jobs, scheduled tasks, or complex step functions.

Like all of our other handlers, the Redwood handler is simple to use.

import { Inngest } from 'inngest'
import { serve } from 'inngest/redwood'
const inngest = new Inngest({ id: 'my-redwood-app' });
const userAlert = inngest.createFunction(
{ id: 'new-user-alert' },
{ event: 'app/user.created' },
async ({ event }) => {
console.log(`New user @${event.data.username} created!`)
}
)
export const handler = serve({
client: inngest,
functions: [userAlert],
servePath: "/api/inngest",
});

We can then use Inngest's existing deployment guides for popular Redwood targets like Vercel and Netlify to deploy our functions to Inngest.

Why Redwood?

At Inngest, we want to support frameworks that already provide an incredible developer experience and enhance them by allowing developers to leverage event-driven architecture with a tiny amount of code.

Redwood is a fantastic framework for building serverless applications, but utilizing background jobs usually requires running a stateful, always-on service like Faktory alongside ensuring your app is serverful - a significant extra cost and technical burden to create and maintain, especially if you're just getting started.

By pairing Redwood with Inngest, you can deploy your serverless functions as usual and use Inngest's event-driven infrastructure to trigger them; use Redwood's serverless functions to handle your background jobs without worrying about running and maintaining a separate service.

Getting started

Check out the RedwoodJS Framework Guide or the inngest/sdk-example-redwoodjs-vercel repository to start your journey, or jump into our Writing functions documentation to see what's possible with Inngest!