Manual setup
Add the Atune middleware yourself — any framework, no CLI, full control.
If you don't want auto-wiring — or you're not on Next.js — add the middleware yourself. The result is the same: every server request becomes a signal.
1. Install
npm install atune2. Set env vars
Add to .env.local (or your platform's secret store):
ATUNE_API_KEY=<YOUR_API_KEY>ATUNE_URL=https://useatune.comSign in to see this sample with your own workspace API key.
ATUNE_API_KEY is your workspace key from onboarding — the only secret,
server-side only.
3. Add the middleware
// middleware.ts
import { createAtuneMiddleware } from "atune";
const atune = createAtuneMiddleware();
export function middleware(request: Request) {
return atune(request);
}Already have a middleware (for example Clerk)? Chain it by calling
atune(request) inside your existing handler — npx atune init does exactly
this for you automatically.
What gets captured
The middleware records every request as http.<method>.<normalized-route> with
the resolved account and user. Request bodies are never read — no passwords,
tokens, or card numbers. It's fire-and-forget: a slow or down Atune can never
delay or break your app.
4. Verify
Trigger a request in your app, then ask about the account it belongs to:
import { understand } from "atune";
const r = await understand("portfolio", "any signals landing yet?");
console.log(r.knows, r.signals);