Skip to content

Documentation

Plugin Storage

Shared JSON record store for plugins — zero per-plugin tables across all adapters.

1 min read Edit on GitHub
On this page

Plugins persist arbitrary JSON records without creating custom tables. All adapters share the plugin_storage collection/table, scoped by (plugin, collectionName, tenantId).

Usage

// LocalCMS / server
const rec = await cms.pluginStorage.createRecord("seo-audit", "reports", {
  score: 95,
  url: "https://example.com",
});

const page = await cms.pluginStorage.listRecords("seo-audit", "reports", {
  limit: 20,
  filter: { score: 95 }, // equality filter on data fields (in-memory)
});

await cms.pluginStorage.deleteRecord("seo-audit", "reports", rec._id);

Schema

Column Purpose
_id Primary key
plugin Plugin id
collectionName Logical collection within the plugin
tenantId Multi-tenant isolation
data JSON payload
createdAt / updatedAt Timestamps

Implementation

Layer Path
Types src/plugins/storage/types.ts
Adapter src/plugins/storage/plugin-storage-adapter.ts
SDK PluginStorageNamespacecms.pluginStorage
SQL schemas exported as pluginStorage on SQLite/PG/MariaDB
Mongo src/databases/mongodb/plugin-storage.ts

Tests

  • Unit: tests/unit/plugins/plugin-storage-adapter.test.ts
  • Integration: tests/integration/api/outbox-plugin-storage.test.ts
Was this page helpful?