Framework guide

Add Answers to Next.js

Use Answers when your Next.js site already has answers on public pages or docs and visitors should ask for them. Cited answers when evidence exists. Otherwise an honest "the site does not state this", pointing to a support contact only when a source gives one, or your fallback. The widget is a Client Component.

Install

pnpm add @bootstrapware/answers

Import the stylesheet once. The widget is a Client Component. Non-React pages use the Hosted script embed instead.

Local sample in a Client Component

The local sample needs no paid entitlement. Put it in a file with "use client". The import is the same contract as the React guide and the quickstart.

"use client";

import { Answers, createLocalAdapter } from "@bootstrapware/answers";
import "@bootstrapware/answers/styles.css";

<Answers adapter={createLocalAdapter()} />

Hosted embed

Pass the published app id and a publishable key. Use NEXT_PUBLIC_ only for publishable values. The browser env name is NEXT_PUBLIC_BSW_ANSWERS_PUBLISHABLE_KEY. Never put a secret key in NEXT_PUBLIC_. appId and publishableKey call Hosted ask without an adapter. See API keys, environments, and modes.

BYO Route Handlers

Point the adapter at your server. The reference is the BYO backend and the adapter. OPENAI_API_KEY stays on the server. Return answered or unanswered. Citations are ids you retrieved.

Limits worth knowing

  • Hosted includes 2,500 answers per workspace each month, 1 GiB of knowledge and index, 2,000 sources, 4,000 indexed chunks per app, 20 MiB per file, and 30 days of conversation history.
  • Hitting a ceiling stops that part until reset or you remove sources — no surprise invoice.

Pitfalls specific to Next.js

  • Rendering the widget without a client boundary.
  • Putting a secret key in a public env var.
  • Inventing citation URLs the index did not retrieve.
  • Expecting Hosted live URL sources on BYO or test.

Related: Quickstart · React guide · Script guide · Cursor · Demo

Next.js widget, React props, and the script embed

React: pass appId and a publishable key with no adapter to call Hosted ask, or pass createByoAdapter so the question stays on your server. For an AI answers widget in Next.js, treat that as the starting constraint rather than a footnote. The work belongs in the product the customer is already signed into. Bootstrapware publishes configuration and, only on a Hosted plan you choose, the records that plan names. It does not become a second system of record by accident.

The script embed loads https://answers.bootstrapware.co/embed/v1.js and calls BootstrapwareAnswers.mount. suggestedQuestions and shortcut work the same as in React. The spreadsheet, message, post, checklist, thread, quote file, or visitor question stays on the path you picked. When the product is Importer, the spreadsheet never leaves the browser: parsing, mapping, validation, and in-file duplicate checks run in the tab. File bytes, parsed rows, and the filename are not posted to Bootstrapware. onComplete is what your BYO backend, or Hosted ask is allowed to see.

BYO is $9.99. Knowledge, retrieval, the model, and visitor logs stay on your backend. Hosted is $19.99 and includes 2,500 answers a month, 1 GiB, 2,000 sources, 4,000 chunks per app, 20 MiB per file, and 30 days of history. Write the server handler so a failed row is reported back instead of half-inserted. Preview errors stay inline. A customer can fix the cell, exclude the row, or download the error file and try again. Do not log payloads you would not want in an application log. Do not send those payloads to MCP or to a webhook.

A reply cites retrieved passages. If order changes a stack total, the catalog-order total with an order caveat, the full set of permutation totals, or the full low-to-high range is accepted. Equal list prices are one total. A partial set is not. Install the package, render it in a client boundary, and point the callback at your server. Publishable keys identify the workspace. Secret keys stay on the server. Local mode and test keys are free. Live config and live Hosted writes follow the price already printed on this product's pricing page. Re-read that page before you quote a number in your own UI. Link the landing page and the pricing page from the install notes so the next reader can see the boundary and the plan without searching.

Ship a thin vertical slice first: one required field, one successful completion, and one deliberate failure. Then add the real schema. If an agent writes the integration, hand it the product AGENTS.md and reject a diff that uploads content Bootstrapware is not supposed to store. The component is typed. The adapter is yours on BYO. Hosted is the plan where Bootstrapware stores that product's customer content, with the cancel rule already stated on the pricing page: writes freeze, export stays for 30 days, then Hosted data is deleted. Switching Hosted to BYO keeps the rows.

import { Answers } from "@bootstrapware/answers";
import "@bootstrapware/answers/styles.css";

<Answers
  appId="ana_demo"
  publishableKey={process.env.NEXT_PUBLIC_BSW_ANSWERS_PUBLISHABLE_KEY}
/>

AI answers widget with citations · Answers widget pricing · Add the Answers widget · How Answers grounds a reply in citations