Skip to content
This repository has been archived by the owner on Apr 15, 2024. It is now read-only.

A demo full-stack Next.js app and background functions using the Inngest DevServer

Notifications You must be signed in to change notification settings

inngest/demo-nextjs-full-stack

Repository files navigation

Demo Inngest + Next.js

This example repo demonstrates how one might build our their background jobs along side a Next.js API backend. It could be any backend in any language, but this uses Next since it's fairly simple to install and understand.

👋 Have a question or suggestion? Join our Discord!

Start the app

Start the Next.js app in dev mode and the Inngest dev server (install instructions):

yarn dev
inngest dev

Environment variables

Check out .env.example for direction for your own .env files. See the Next.js docs for more information.

To set environment variables for any Inngest functions prefix them (e.g. TWILIO_AUTH_TOKEN=123... inngest dev) or set them via export.

The app

The demo app is a basic Next.js form view which when submitted, sends event(s) in batch to Inngest and runs the "Send SMS Dispatch" function. For reference, these are direct links to the code:

  • dispatch.js - Sending an event to Inngest and Inngest DevServer during development via a Next.js API endpoints (the form receiver).
  • index.ts - Handling the event and sending an SMS via the Twilio API.

If you want to, create a new function by running inngest init in the functions directory.

Inngest Demo App

Notes

  • Inngest dev server support for .env files is in development (inngest-cli#93). If you want to use environment variables use export VAR=val before you run inngest dev or run