Observability

Observability

NextDevTpl includes structured logging, optional cloud log shipping, Sentry monitoring, rate limiting, and API request logging utilities.

Logging

PathPurpose
src/lib/logger/index.tsPino logger wrapper
src/lib/api-logger.tsAPI logging helpers

When Axiom is configured, logs can be shipped to Axiom. Without Axiom, logs should still be available locally.

Common variables:

AXIOM_TOKEN="xaat-..."
AXIOM_DATASET="nextdevtpl"

Error monitoring

Sentry config files:

PathPurpose
sentry.client.config.tsBrowser Sentry setup
sentry.server.config.tsServer Sentry setup
sentry.edge.config.tsEdge Sentry setup
src/instrumentation.tsNext.js instrumentation hook
src/lib/monitoring/index.tsMonitoring helpers

Common variables:

NEXT_PUBLIC_SENTRY_DSN="https://..."
SENTRY_AUTH_TOKEN="sntrys_..."

Rate limiting

Rate limiting lives in:

src/lib/rate-limit

Upstash variables:

UPSTASH_REDIS_REST_URL="https://..."
UPSTASH_REDIS_REST_TOKEN="..."

If Redis is missing, development should continue without a hard startup failure.

Production checklist

  • Enable Sentry for user-visible errors.
  • Enable structured logs for webhook and payment debugging.
  • Log external event IDs for payment and job retries.
  • Avoid logging raw credentials, tokens, or authorization headers.
  • Verify rate limits on public mutation endpoints.

On this page