Express / manual
Use Atune outside Next.js — capture behavior and query understanding from any Node server.
Atune isn't Next-only. The understand(), identify(), and group() calls are
plain HTTP under the hood, and capture is a small middleware you can adapt to any
framework.
Install and configure
npm install atuneATUNE_API_KEY=<YOUR_API_KEY>ATUNE_URL=https://useatune.comSign in to see this sample with your own workspace API key.
Capture behavior
createAtuneMiddleware() operates on a standard Request. On frameworks that
expose Web Request/Response, use it directly. On classic Express, capture at
the point where you know the account, and fire the call without awaiting it:
import express from "express";
import { understand } from "atune";
const app = express();
// Fire-and-forget capture: never block the response.
app.use((req, res, next) => {
next();
// resolve your account/user however your auth exposes it, then record
// the request as a signal via your own POST to `${ATUNE_URL}` — see the
// events API. Do not await it.
});The one rule
Whatever framework you're on, capture must be fire-and-forget. A slow or down Atune can never delay or break your app.
Query understanding
understand() works the same everywhere — it's just an authenticated HTTP call:
import { understand } from "atune";
const r = await understand("portfolio", "who is at risk this week?");
if (r.knows) console.log(r.answer, r.citations);Identity
import { identify, group } from "atune";
await identify("u_123", { name: "Kari Nordmann", email: "kari@acme.no" });
await group("acme", { company: "Acme AS" });Same DPA rules apply — see Identity, PII & the DPA.