> ## Documentation Index
> Fetch the complete documentation index at: https://docs.stacknext.space/llms.txt
> Use this file to discover all available pages before exploring further.

> ## Agent Instructions
> StackNext documentation is written for developers using StackNext in a Next.js App Router project. Use the getting-started and guides sections to install and operate the product, and the reference section for CLI, configuration, MCP and package surfaces. Version-matched package API reference ships inside each npm package under node_modules/@stacknext/<package>/docs/ and is preferred over this site for installed-version APIs. Diagnostic findings are evidence, not confirmed root causes; regression comparisons are deterministic and report-only. Contributor and repository-maintenance documentation is not part of this site.

# Core concepts

> The sample, traces, coverage, diagnostics, snapshots and regression records that StackNext exposes.

## Sample and retention

A **sample** is the telemetry currently held in the collector's in-memory store.
`collector.maxSpans` limits spans. Error and query buffers have separate
capacities derived from that setting; each type can hold up to its own capacity.
`collector.retentionMs` bounds retention (10 minutes by default). When capacity
or retention removes data, the store records drops.

Every count and finding describes this sample, not all activity since the app
started. See [configuration](https://docs.stacknext.space/reference/configuration.md).

## Requests, traces and spans

A **request** is an incoming HTTP request to the Next.js app. A **trace** is the
tree of spans produced while handling it. StackNext preserves documented
Next.js span types and parent ids; unknown span types remain visible as verbose
evidence rather than being guessed.

A span's duration includes its children. To find where time is spent, compare
child spans or inspect self time; never sum a parent and its child as if they
ran sequentially.

## Queries and errors

Drizzle query events never include durations, so `durationMs` is `null`, not
zero. Prisma events can include a duration. SQL text is redacted; bind
parameters are neither read nor sent. Request errors arrive through the Next.js
error hook with a redacted message and stack. A trace link may be exact (active
span context) or a route/method plus 30-second fallback.

## Coverage is evidence

**Instrumentation coverage** answers what the current sample observed for a
feature such as fetch spans, database adapters, custom spans, Server Actions or
verbose tracing. Statuses include `observed`, `active`, `configured`,
`not-observed`, `unknown` and `unsupported`. They are not a percentage or health
score, and absence is not proof that a feature is broken. See
[instrumentation coverage](https://docs.stacknext.space/instrumentation-coverage.md).

## Diagnostics are deterministic findings

**Diagnostics** are six conservative rules over the current sample. A finding
has a deterministic id, a rule, a status (`possible`, `observed` or
`insufficient-evidence`), a severity, bounded evidence and limitations.
`possible` means the pattern is consistent with a problem; `observed` means the
measurement exists. Neither proves a root cause. See
[diagnostics](https://docs.stacknext.space/guides/diagnostics.md).

## Snapshots are frozen evidence

A **snapshot** is a versioned, redacted copy of one sample saved under
`.stacknext/snapshots`. It is never replayed into the live store. Snapshot reads
use a detached store and carry no live diagnostics or coverage. Manual and
imported snapshots never rotate automatically. See [snapshots](https://docs.stacknext.space/guides/snapshots.md).

## Regression records

A **capture run** contains Playwright scenarios and their verified runtime
samples. A **baseline** is an immutable saved run. A **comparison** matches
scenarios by stable id and traces/spans by normalized keys, then reports
`improved`, `regressed`, `unchanged` or `inconclusive` with a separate severity.
A sample is verified only when the collector found the injected trace and a
server span parented to the injected span id. See
[regression testing](https://docs.stacknext.space/regression-testing.md).

## Redaction

Redaction happens twice: in the app process before enqueueing, and in the
collector before storing. URLs keep the path only; sensitive keys become
`[redacted]`; error text is sanitized; resource attributes use an allowlist.
Captured files are re-redacted. See [privacy](https://docs.stacknext.space/privacy.md).


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.