Skip to Content
API Reference@txfence/storage-sqlite

@txfence/storage-sqlite

SQLite ReceiptStore implementation for local development and single-process staging environments.

Installation

npm install @txfence/storage-sqlite better-sqlite3

Setup

import { createSqliteReceiptStore, initSchema } from '@txfence/storage-sqlite' import Database from 'better-sqlite3' const db = new Database('./receipts.db') initSchema(db) const receiptStore = createSqliteReceiptStore(db)

initSchema is synchronous and idempotent.

In-memory database

For tests, pass ':memory:':

const db = new Database(':memory:')

Options

createSqliteReceiptStore(db, { tableName: 'txfence_receipts' })

When to use

SQLite for local development and single-process staging. PostgreSQL (@txfence/storage-pg) for production multi-process deployments where multiple agents write concurrently.

Last updated on