npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

@rikology/adonisjs-audit-trail

v1.0.1

Published

Production-grade, tamper-evident audit trail for AdonisJS v7

Readme

@rikology/adonisjs-audit-trail

checks npm version License: MIT

Production-grade, tamper-evident audit trail for AdonisJS v7.

Capture who changed what, when, and from where — automatically for Lucid models and explicitly for domain events — into an append-only, hash-chained trail you can cryptographically verify. Built for compliance workloads (SOC 2, GDPR, HIPAA-style) where the audit log itself must be trustworthy.

Why this package?

Most AdonisJS auditing solutions stop at "who changed this row". @rikology/adonisjs-audit-trail is designed for environments where the log is evidence:

  • Tamper-evident by default — every record is linked into a per-stream SHA-256 hash chain; modification breaks every successor.
  • Never blocks the request path — asynchronous, batched pipeline with configurable delivery guarantees.
  • Pluggable storage — SQL, NDJSON stream, HTTP collector, or fanout.
  • Compliance-aware — field-level redaction, retention policies, GDPR crypto-shredding, multi-tenancy.
  • Native v7 integration — provider, configure flow, middleware, transformer stub, and Ace commands.

Table of contents

Requirements

  • Node.js >= 24
  • AdonisJS v7 (@adonisjs/core@^7)
  • TypeScript 5.9+

Quick start

1. Install

node ace add @rikology/adonisjs-audit-trail

Or with your package manager of choice:

npm install @rikology/adonisjs-audit-trail
pnpm add @rikology/adonisjs-audit-trail
yarn add @rikology/adonisjs-audit-trail

The configure command publishes config/audit.ts, migrations, the audit transformer, and registers the provider, commands, and middleware.

For CI or other non-interactive environments, pass flags to skip the prompts:

node ace configure @rikology/adonisjs-audit-trail --outbox --no-multi-tenant --immutability

2. Run migrations

node ace migration:run

3. Add the mixin to a model

import { compose } from '@adonisjs/core/helpers'
import { BaseModel } from '@adonisjs/lucid/orm'
import { Auditable } from '@rikology/adonisjs-audit-trail/auditable'

export default class Invoice extends compose(BaseModel, Auditable) {
  static auditConfig = {
    redact: ['iban'],
    tags: ['billing'],
  }

  // ... columns
}

Every create, update, delete, and restore now produces an immutable audit record automatically.

4. Log explicit domain events

import audit from '@rikology/adonisjs-audit-trail/services/main'

await audit.log('invoice.approved').on(invoice).withMeta({ level: 2 }).commit()

5. Query the trail

import Audit from '@rikology/adonisjs-audit-trail/models/audit'

const trail = await Audit.forModel(invoice).orderBy('seq', 'desc').cursorPaginate(20)

6. Verify integrity

node ace audit:verify

Exit code is non-zero when a chain break is detected, so it can be wired into CI/cron.

Features

  • Automatic model auditing via a Lucid mixin.
  • Explicit domain events via a fluent API.
  • Tamper-evident SHA-256 hash chains with node ace audit:verify.
  • Asynchronous, batched write pipeline that never blocks the request path.
  • Three delivery guarantees: best-effort, request-coupled, and transactional-outbox.
  • Pluggable stores: SQL (Lucid), NDJSON stream, HTTP collector, or fanout.
  • PII-aware redaction, masking, hashing, and crypto-shredding support.
  • Multi-tenancy with tenant-scoped chains and queries.
  • Type-safe end-to-end with generated event-name unions and v7 transformers.

Documentation

Demo app

See examples/demo for a runnable AdonisJS v7 API that shows the Lucid mixin, request context middleware, explicit domain events, redaction, and audit:verify.

Benchmarks

Run locally with:

npm run bench
BENCH_DB=postgres npm run bench

| Metric | Target | Observed (SQLite, MBP M1 Pro) | | -------------------------------------- | ----------------- | ------------------------------------- | | Enqueue overhead per model.save() | < 0.2 ms p99 | ~0.075 ms p99 | | Flush throughput (Postgres, batch 200) | >= 5,000 events/s | run BENCH_DB=postgres npm run bench |

Contributing

Contributions are welcome — see CONTRIBUTING.md for setup, the development workflow, and conventions. Please also read the Code of Conduct.

Security

If you discover a security vulnerability, please do not open a public issue. Follow the disclosure process in SECURITY.md.

License

MIT © Rikology