Skip to content
porchlight

Add Porchlight to a Next.js website

Use the Next.js installation instructions generated for your website in Porchlight. They contain the current package installation command and the site identifier for that website.

Start with your workspace instructions

In Porchlight, select the website and open the Next.js installation option. Copy the package installation command shown there; it points to the package distribution supplied by your Porchlight instance. Do not substitute an unrelated package from a public registry just because its name looks similar.

Run that command in the application project, then use the snippet provided by the same installation panel. Keep any identity-signing secret on the server. The public site identifier is the value intended for browser code.

Install once in a shared layout

The React integration exports PorchlightWidget from @porchlight/react. For an App Router application, a small client component can hold the widget and be rendered once from the shared layout. Your actual Next.js version and routing setup determine the exact layout file.

'use client';
import { PorchlightWidget } from '@porchlight/react';

export function WebsiteChat() {
  return <PorchlightWidget siteId="YOUR_SITE_ID" />;
}

Replace YOUR_SITE_ID, import WebsiteChat into your layout and render it alongside the page content. Use either this integration or the HTML loader snippet, rather than both. Installing in individual pages can cause unnecessary remounts during navigation.

Check navigation and configuration

On a preview domain that is allowed for the website, open a page and navigate to another route without a full refresh. Confirm there is one launcher and that a conversation remains usable. Check a direct page load as well; client-side navigation alone does not prove that the shared layout is configured correctly.

If your website has public and private route groups, decide where visitor support belongs before choosing the layout. A public website widget does not need to appear in employee payroll, tenant records or other private application screens just because the root layout is convenient.

Review the launch checklist

Check desktop and phone placement, the website's allowed domains, availability, the Front Desk destination and any AI knowledge you have enabled. Confirm your site's security and consent configuration permits the intended loader and frame requests.

Use a deliberate test conversation only when you are ready for the message to reach your team. For a plain script integration, follow the HTML guide. If a package or framework change affects the integration, use the current workspace-generated instructions as the starting point.

Back to the top

Give your visitors a warmer welcome.

Bring your team and your knowledge into one shared workspace.

Open a free workspace