Skip to main content

Add real-time in-app notifications to Next.js in under 10 minutes using the Novu Inbox component.

Add Novu Inbox to my Next.js appOpen in Cursor

Add Novu Inbox to Next.js App#

Install @novu/nextjs. Add the <Inbox /> component to your header, navbar, or sidebar.

Latest docs: https://docs.novu.co/platform/quickstart/nextjs

Install#

Component#

Subscriber ID#

Use the app’s existing auth system to get a unique user identifier for subscriberId. Check for Clerk, NextAuth, Firebase, Supabase, or custom auth. If no auth system exists, use YOUR_SUBSCRIBER_ID.

Appearance#

Extract design tokens from the host app (Tailwind config, CSS variables, theme objects) and apply them via the appearance prop. Only include values you extracted from the host design system - omit empty or placeholder appearance values.

Rules#

ALWAYS:

  • Detect the project’s package manager and use it for installation
  • Extract design tokens and apply via the appearance prop
  • Place <Inbox /> inline in existing UI - no new pages or wrappers
  • Use TypeScript, no comments, no empty props
  • Follow Next.js conventions
  • Use the existing auth system to source subscriberId when available

NEVER:

  • Add empty appearance values or placeholder props
  • Create wrapper components or new pages just for the inbox
  • Add code comments
  • Introduce styles not in the host app
  • Add unused props or imports

Verify Before Responding#

  1. Is @novu/nextjs installed with the project’s package manager?
  2. Is <Inbox /> placed inline in existing UI?
  3. Are design tokens extracted and applied?
  4. Are all props non-empty and properly typed?
  5. Is subscriberId sourced from the auth system when available?

If any fails, revise.

Create a Novu account#

Create a Novu account or sign in to access the Novu dashboard.

Create a new Next.js application#

Run the following command to create a new Next.js application:

Install @novu/nextjs#

Run the following command to install the Next.js Novu SDK:

Add the notification Inbox to your app#

Import Novu’s built-in <Inbox /> component into your layout file and place it in the navbar:

app/layout.tsx

If you are signed in to your Novu account, then the applicationIdentifier and subscriberId will be automatically populated. Otherwise, retrieve them from:

  • applicationIdentifier: On the Novu dashboard, click API Keys, and copy your unique Application Identifier.
  • subscriberId: This represents a user in your system, usually the user ID from your database. For testing, you can use the auto-generated subscriberId from your Novu dashboard. You can locate it under the Subscribers tab on the Novu dashboard.
Note

If you pass a subscriberId that does not exist yet, Novu will automatically create a new subscriber with that ID.

Run your application#

Start your development server:

Once your application is running, you would see a bell icon in the navbar. Click on it, to open the notification Inbox UI.

There are no notifications yet, so let’s trigger one!

Trigger your first notification#

In this step, you’ll create a simple workflow to send your first notification via the Inbox component. Follow these steps to set up and trigger a workflow from your Novu dashboard.

  1. Go to your Novu dashboard.
  2. Click Workflows.
  3. Click Create Workflow and then enter a name (e.g., “Welcome Notification”).
  4. Click Create Workflow to save it.
  5. Click the Add Step icon in the workflow editor and then select In-App as the step type.
  6. In the In-App template editor, enter:
    • Subject: “Welcome to Novu”
    • Body: “Hello, world!”
  7. Once you’ve added the subject and body, close the editor.
  8. Click Trigger.
  9. Click Test Workflow.

View the notification in your app#

Go back to your Next.js app, then click the bell icon.

You should see the notification you just sent from Novu! 🎉

Next steps#