Skip to main content
[AVAILABLE] for memory and supabase. Declared but unimplemented, throws at startup for postgres/sqlite.

Purpose

Append-only repositories backing the Execution trust record ledger, business transactions, and (for FilePolicyRepository, in @parmana/policy) policies.

Install

npm install @parmana/storage

Key exports

Factory, [AVAILABLE]

// packages/storage/src/StorageFactory.ts
switch (configuration.provider) {
  case "memory":   return new MemoryStorageProvider();
  case "supabase": return new SupabaseStorageProvider();
  case "postgres": throw new Error("Postgres storage provider not implemented.");
  case "sqlite":   throw new Error("SQLite storage provider not implemented.");
}
PARMANA_STORAGE is the only variable read for this choice, see Deploy patterns.

Providers

ExportStability
MemoryStorageProvider, MemoryBusinessTransactionRepository, MemoryExecutionTrustRecordRepository, MemoryPolicyRepository[AVAILABLE]. In-process, non-persistent. Used throughout this site’s live examples.
SupabaseStorageProvider, SupabaseBusinessTransactionRepository, SupabaseExecutionTrustRecordRepository[AVAILABLE] (source), not independently re-verified against a live Supabase instance in this documentation pass. This repo’s committed .env defaults to this.

Interfaces and ledger, [AVAILABLE]

ExportPurpose
StorageProvider, StorageBuilder, StorageConfigurationThe provider contract and its typed configuration
AppendOnlyLedger, LedgerEntry, LedgerSerializerThe append-only primitive repositories are built on
ExecutionRepository, VerificationRepository, CryptoProofRepositoryAdditional repository interfaces
StorageErrorThrown on provider misconfiguration, including the retired DATABASE_PROVIDER variable, see below

A retired variable fails loudly, not silently

An older DATABASE_PROVIDER variable existed briefly as a second, disconnected path to the same setting PARMANA_STORAGE now controls. If it’s present in the environment, config loading fails at startup naming PARMANA_STORAGE as the replacement, rather than silently ignoring it or picking one arbitrarily.

Minimal example

import { MemoryStorageProvider } from "@parmana/storage";

const storage = new MemoryStorageProvider();
// or, via the factory:
// const storage = StorageFactory.create({ provider: "memory" });

Next

Deploy patterns

Choosing a storage provider as part of a full deployment.

Execution trust records

What actually gets stored, and what’s append-only versus signed.