Skip to content
Examples

Integrate Veritio in minutes

These are real, copy-pasteable examples using the open-source SDKs. No hosted account required — everything below runs against the local, self-hostable packages.

Install

TypeScript is published as an exact package version. Python and Go are currently installed from the public source tree.

TypeScriptbash
npm install @veritio/core@0.4.7
# or
bun add @veritio/core@0.4.7
Pythonbash
git clone https://github.com/getveritio/veritio.git
git -C veritio checkout c4100ee7b678d0c6b227c67ae6ea1d8a1f373967
pip install -e ./veritio/sdks/python
Gobash
go get github.com/getveritio/veritio/sdks/go@c4100ee7b678d0c6b227c67ae6ea1d8a1f373967

Record your first event

Append a structured audit event, read the tenant chain, and verify it.

typescript.tsts
import { MemoryAuditStore, createAuditEvent, hashAuditEvent, verifyAuditRecords } from '@veritio/core'

const store = new MemoryAuditStore()
const scope = { tenantId: 'org_acme', environment: 'production' }

const event = createAuditEvent({
  id: 'evt_member_invited_01',
  occurredAt: '2026-08-09T10:00:00.000Z',
  actor: { type: 'user', id: 'usr_123' },
  action: 'organization.member.invited',
  target: { type: 'organization', id: 'org_acme' },
  scope,
  purpose: 'access_management',
  lawfulBasis: 'contract',
  retention: 'security_1y',
  metadata: { role: 'viewer' },
})

const record = await store.append(event, { idempotencyKey: 'invite:inv_123' })
const records = await store.list(scope)
const verification = verifyAuditRecords(records)

console.log({ sequence: record.sequence, verification, hashPrefix: hashAuditEvent(event).slice(0, 12) })

This fixture is imported directly from the checked example source and is type-checked against @veritio/core@0.4.7.

The same event in Python

Create and hash the equivalent event with the source-backed Python SDK.

python.pypython
from veritio import create_audit_event, hash_audit_event

event = create_audit_event(
    {
        "id": "evt_member_invited_01",
        "occurredAt": "2026-08-09T10:00:00.000Z",
        "actor": {"type": "user", "id": "usr_123"},
        "action": "organization.member.invited",
        "target": {"type": "organization", "id": "org_acme"},
        "scope": {"tenantId": "org_acme", "environment": "production"},
        "purpose": "access_management",
        "lawfulBasis": "contract",
        "retention": "security_1y",
        "metadata": {"role": "viewer"},
    }
)

event_hash = hash_audit_event(event)
print({"eventId": event["id"], "hashPrefix": event_hash[:12]})

The same event in Go

The Go fixture uses the same actor, action, target, scope, purpose, lawful basis, retention label, and metadata as the TypeScript and Python versions.

main.gogo
package main

import (
	"fmt"

	veritio "github.com/getveritio/veritio/sdks/go"
)

func main() {
	event, err := veritio.CreateAuditEvent(veritio.AuditEventInput{
		ID:          "evt_member_invited_01",
		OccurredAt:  "2026-08-09T10:00:00.000Z",
		Actor:       veritio.Principal{Type: "user", ID: "usr_123"},
		Action:      "organization.member.invited",
		Target:      veritio.Resource{Type: "organization", ID: "org_acme"},
		Scope:       &veritio.EvidenceScope{TenantID: "org_acme", Environment: "production"},
		Purpose:     "access_management",
		LawfulBasis: "contract",
		Retention:   "security_1y",
		Metadata:    map[string]any{"role": "viewer"},
	})
	if err != nil {
		panic(err)
	}

	hash, err := veritio.HashAuditEvent(event, nil)
	if err != nil {
		panic(err)
	}
	fmt.Printf("event=%s hash=%s\n", event.ID, hash[:12])
}

Local Workbench

Run the Workbench from your terminal to explore evidence locally.

terminalbash
veritio dev --mcp

Run this command from a source checkout. It starts the local Workbench and MCP tooling with no hosted account required.

Framework integrations

Shipped adapters wire evidence recording into popular frameworks with minimal glue code.

Better Auth

Record user, session, and invitation events.

Next.js

Record evidence from server route handlers and server actions.

TanStack Start

Server-side evidence recording.

SvelteKit

Server-side evidence recording.

React / Vue / Svelte

UI intent helpers that annotate the interface (no client-side recording).

See the full reference example combiningNext.js + Better Auth:examples/nextjs-better-auth →

Planned

Express, Hono, tRPC, and FastAPI adapters are planned and not yet available.

Start with the open source

Clone the repo, read the protocol, and run the examples above. Veritio provides evidence support for your audit trails — you stay in control of where it runs.