Skip to content

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. Node files are published to https://nodes.bainquet.online/{domain}/{file}; the module does not serve them from the customer origin.

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 ​

bash
npm install bainquet-nuxt   # peer: @nuxt/kit (provided by your Nuxt app)

Configuration ​

ts
// nuxt.config.ts
export default defineNuxtConfig({
  modules: ["bainquet-nuxt"],
  bainquet: {
    siteDomain: "acme.com",
    siteOrigin: "https://acme.com",
    defaultLanguage: "en",
    adapters: [
      // see below
    ],
    ingestOnBuild: true,
    deleteRemoved: true,
  },
});

On setup the module:

  1. Merges the bainquet block into private (server-only) runtimeConfig and throws if a token or secret is found under runtimeConfig.public (client-leak guard).
  2. Hooks the postbuild close event to run a sync when ingestOnBuild is 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) ​

VariablePurpose
BAINQUET_API_URLAPI origin, default https://api.bainquet.online (a trailing /v1 is tolerated and stripped)
BAINQUET_CONNECTOR_TOKENconnectorId.secret
BAINQUET_WEBSITE_IDscoped website id

Mapping pattern ​

Adding a content source means registering an adapter. Use the built-ins, or define a bespoke one with defineAdapter:

ts
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.

Published node files ​

After ingest and publish, the Knowledge Node is at https://nodes.bainquet.online/{domain}/{file} (for example https://nodes.bainquet.online/acme.com/llms.txt). The origin does not host llms.txt or a well-known AI folder. Domain verification (/.well-known/bainquet-verification.txt, DNS TXT, meta tag, plugin) is a separate ownership-proof step.

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/kit is 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.

Owner-controlled structured data for AI.