Skip to main content

What it does

This example demonstrates how to use the Grantex audit trail as a rich data source:
  1. Set up two agents with different scopes and generate grant tokens
  2. Generate audit entries — a mix of success, failure, and blocked statuses across agents
  3. Display full audit timeline — formatted table with status icons, agent names, and timestamps
  4. Filter by agent — show entries for each agent separately
  5. Filter by action — show only specific actions (e.g. email:send) with metadata
  6. Compute metrics — success rate, failure rate, entries per agent, top actions by frequency
  7. Verify hash chain integrity — walk the cryptographic chain to confirm tamper evidence

Prerequisites

  • Node.js 18+
  • Docker (Docker Desktop or Docker Engine with Compose)

Run

Start the local Grantex stack from the repository root:
In a separate terminal, run the example:

Expected output

Environment variables

Source code

The full source is in examples/audit-dashboard/src/index.ts.
Last modified on March 30, 2026