Skip to main content
@parmana/storage implements the repository interfaces defined in shared. packages/storage/src/index.ts exports StorageEngine, StorageBuilder, StorageProvider, StorageFactory, StorageConfiguration, an append-only ledger (AppendOnlyLedger, LedgerEntry, LedgerSerializer), individual repository interfaces, and the in-memory provider implementations.

Provider selection

class StorageFactory {
  static create(configuration: StorageConfiguration): StorageProvider;
  static createFromEnvironment(): StorageProvider; // reads process.env.PARMANA_STORAGE
}
createFromEnvironment() (used by packages/api/src/repositories.ts) reads PARMANA_STORAGE, defaulting to "memory":
PARMANA_STORAGE valueProvider
memory (default)MemoryStorageProvider
supabaseSupabaseStorageProvider
postgresThrows "Postgres storage provider not implemented."
sqliteThrows "SQLite storage provider not implemented."
SupabaseStorageProvider (packages/storage/src/supabase/) is a real, selectable implementation, but it isn’t re-exported from packages/storage/src/index.ts — only MemoryStorageProvider and the individual Memory*Repository classes are. You can still select Supabase via PARMANA_STORAGE=supabase (StorageFactory imports it directly), you just can’t import { SupabaseStorageProvider } from "@parmana/storage" for direct use outside the factory.

In-memory repositories

packages/storage/src/memory/MemoryBusinessTransactionRepository, MemoryExecutionTrustRecordRepository, MemoryPolicyRepository, all backed by plain in-process collections with no persistence across restarts. This is what the local dev server (PARMANA_STORAGE unset) actually runs on.
MemoryPolicyRepository exists here, but the running API server doesn’t use it — packages/api/src/application.ts constructs a FilePolicyRepository from @parmana/policy directly for policy loading, reading from the monorepo’s policies/ directory on disk, regardless of PARMANA_STORAGE. PARMANA_STORAGE only selects the BusinessTransaction/ExecutionTrustRecord repositories.

Ledger

AppendOnlyLedger, LedgerEntry, and LedgerSerializer model an append-only log abstraction, exported from the package but not referenced from packages/runtime or packages/api in the current wiring — the actual persistence path is the repository interfaces above, not this ledger.

shared

The repository interfaces this package implements.

Repository Model

The architectural intent behind pluggable storage.

Execution Trust Record

What ExecutionTrustRecordRepository actually stores.

policy

Where policies are actually loaded from at runtime.