Quickstart
Wire a live Next.js app in one command with npx atune init, then ask your first question.
The fastest path. One command detects your framework and auth, installs the package, patches your middleware, and writes your env keys.
Requirements
- Node 18+
- Next.js 14+ for zero-config
init. On another framework? See Manual setup.
1. Run init
npx atune init# When prompted, paste your workspace API key: <YOUR_API_KEY>Sign in to see this sample with your own workspace API key.
Paste your workspace API key when prompted — you'll find it in your Atune onboarding. Behavior capture starts immediately.
Keep your key server-side
ATUNE_API_KEY is the only secret. It is written to .env.local and used only
on the server. Never ship it to the browser, and never commit it to a public repo.
2. What init wrote
init adds two variables to .env.local:
| Variable | What |
|---|---|
ATUNE_API_KEY | Your workspace key. The only secret. Server-side only. |
ATUNE_URL | Your Atune host. Defaults to https://useatune.com. |
And it patches your middleware.ts to capture behavior. Every server request is
recorded as a signal, resolved to the account and user — fire-and-forget, so it
can never block or break a request.
3. Ask your first question
Once a little traffic has flowed, ask about any account:
import { understand } from "atune";
const result = await understand("account:acme", "how healthy is this account?");
if (result.knows) {
console.log(result.answer, result.confidence, result.citations);
} else {
console.log("Not enough understanding yet.");
}Every answer is grounded in your workspace's real signals and cited. When there
isn't enough understanding yet, it returns knows: false rather than guessing.