Nuxt connector
bainquet-nuxt is a Nuxt 3+ module (defineNuxtModule) that publishes a site's content to bAInquet. Extraction runs at build time over a content-source adapter registry; delivery rides the canonical @bainquet/connector-sdk. It also serves the site's local discovery files through Nitro server routes.
Stable Signing parity is covered by the SDK's sign.test.ts (this module imports the SDK signer rather than vendoring it).
What it maps
Each adapter yields IngestItem objects via ctx.makeItem, which computes the cross-connector-stable sha256: checksum. Built-in adapters map Nuxt Content docs to the post SourceType (drafts excluded; article is not a SourceType) and the resolved route list to page. Change detection is build-driven: a rebuild reconciles the whole site, unchanged items return skipped, and removed ids (versus the advisory manifest) are tombstoned.
Install
npm install bainquet-nuxt # peer: @nuxt/kit (provided by your Nuxt app)Configuration
// nuxt.config.ts
export default defineNuxtConfig({
modules: ["bainquet-nuxt"],
bainquet: {
siteDomain: "acme.com",
siteOrigin: "https://acme.com",
defaultLanguage: "en",
adapters: [
// see below
],
nodeFiles: { llms: true, llmsFull: true, aiJson: true },
ingestOnBuild: true,
deleteRemoved: true,
},
});On setup the module:
- Merges the
bainquetblock into private (server-only)runtimeConfigand throws if a token or secret is found underruntimeConfig.public(client-leak guard). - Registers Nitro routes for
/llms.txt,/llms-full.txt, and/.well-known/ai.json, and adds them tonitro.prerender.routesso they exist as static files undernuxt generate. - Hooks the postbuild
closeevent to run asyncwheningestOnBuildis set.
WARNING
Secrets live only in private runtimeConfig and env, never in runtimeConfig.public, and never in the client bundle. The setup step throws if it finds a token under the public config.
Secrets (server-side only)
| Variable | Purpose |
|---|---|
BAINQUET_API_URL | API origin, default https://api.bainquet.online (a trailing /v1 is tolerated and stripped) |
BAINQUET_CONNECTOR_TOKEN | connectorId.secret |
BAINQUET_WEBSITE_ID | scoped website id |
Mapping pattern
Adding a content source means registering an adapter. Use the built-ins, or define a bespoke one with defineAdapter:
import { nuxtContentAdapter, pagesAdapter, defineAdapter } from "bainquet-nuxt";
// Built-ins:
nuxtContentAdapter((ctx) => queryMyContentDocs(ctx)); // docs -> "post", drafts excluded
pagesAdapter({ exclude: (r) => r.startsWith("/admin") }); // routes -> "page"
// Bespoke:
export const productsAdapter = defineAdapter({
name: "products",
sourceType: "product",
async extract(ctx) {
const out = [];
for (const p of await loadProducts()) {
out.push(ctx.makeItem({
type: "product",
id: `product:${p.slug}`,
url: `${ctx.siteOrigin}/products/${p.slug}`,
title: p.title,
html: p.html,
json: { product: { price: { value: p.price, unit: "currency", currency: p.currency } } }, // typed
}));
}
return out;
},
});An adapter has a name, a sourceType (a SourceType), and an extract function that returns items. pagesAdapter consumes the resolved route list rather than re-deriving routing.
Local discovery files
The module registers three Nitro routes that render from the current item set: /llms.txt, /llms-full.txt, and /.well-known/ai.json. They serve dynamically in SSR or hybrid mode and prerender to static files under nuxt generate. Wire src/runtime/server/routes/_items.ts to your build-emitted item cache to serve real content.
These are the site's own local discovery files. The canonical, published Knowledge Node on bainquet.online stays authoritative; see Node files.
Incremental sync
Set ingestOnBuild: true to run a sync on the postbuild close hook. A rebuild reconciles the whole site against the server; unchanged items return skipped, and ids removed since the advisory manifest are tombstoned (deleteRemoved: true).
Backfill
There is no separate backfill command: a full build-time sync reconciles the entire site against the server, which is itself the backfill.
Signing
Signing, retry and backoff, chunking, and idempotency all come from @bainquet/connector-sdk, so the canonical-string and HKDF derivation are identical to every other bAInquet connector. See Ingestion and signing.
Out of scope
@nuxt/kitis a peer dependency provided by the host; for standalone typecheck the package uses a thin local shim for the small slice of Nuxt and Nitro types it touches.- Deterministic-first: no LLM in the module.