Module: Audit Ledger
Append-only audit ledger with pluggable storage backends. One AuditLedger port (append + queryByContext) over four adapters: an in-memory store for development, Postgres (immutable append), DynamoDB (conditional write + strongly-consistent read), and SQS→consumer (FIFO with a DLQ fallback for at-least-once delivery). The module owns persistence only — domain logic such as approval gates, edit-distance scoring, and PII scrubbing stays in the app that owns the events.
| Name | module-audit-ledger-ts |
| Version | 0.1.0 |
| Category | composable-modules |
| License | Apache-2.0 |
| Persona | engineering |
| Tags | audit, ledger, compliance, postgres, dynamodb, sqs, typescript |
| Source | templates/module-audit-ledger-ts |
Render it
Three front doors, one catalog. Pick whichever suits the caller.
# CLI
npx @nanohype/sdk render module-audit-ledger-ts --out ./my-app
# SDK
import { LocalSource, renderTemplate } from "@nanohype/sdk";
const result = await renderTemplate(source, "module-audit-ledger-ts", variables);
# MCP — from an agent
get_template({ name: "module-audit-ledger-ts" })Variables
Required
ProjectNamestring- Kebab-case project name, used as package name and directory Must be lowercase kebab-case starting with a letter.
Optional
Descriptionstring — defaults toAppend-only audit ledger with pluggable storage backends- Short project description for package.json and README
AuditProviderstring — defaults tomemory- Default audit backend (memory, postgres, dynamodb, sqs, or a custom name)
What it produces
21 files. Placeholder names such as __APP_NAME__ are what the renderer substitutes into.
.env.example
.gitignore
biome.json
package.json
src/audit/__tests__/event-id.test.ts
src/audit/__tests__/ledger.test.ts
src/audit/__tests__/registry.test.ts
src/audit/bootstrap.ts
src/audit/event-id.ts
src/audit/index.ts
src/audit/metrics.ts
src/audit/providers/dynamodb.ts
src/audit/providers/index.ts
src/audit/providers/memory.ts
src/audit/providers/postgres.ts
src/audit/providers/registry.ts
src/audit/providers/sqs.ts
src/audit/providers/types.ts
src/audit/types.ts
tsconfig.json
vitest.config.tsComposes with
- Pairs with
k8s-app-tenant - Pairs with
ts-service - Pairs with
agentic-loop - Nests inside
monorepo
Composites that use it
- Platform Tenant — One-shot scaffolder for a k8s-native nanohype Platform tenant: the k8s-app-tenant chart (which vendors tenant-chart-base and ships per-env values, an ArgoCD ApplicationSet entry, and the Platform + BudgetPolicy CRs) plus the optional AI building blocks as local packages — the LLM gateway and the vector store.