Apiagex Database is the database adapter contract package for the Apiagex headless CMS, currently at version 0.6.1. It provides placeholder adapters for SQLite, PostgreSQL, and MySQL, along with a selector function that chooses the correct adapter based on configuration. Designed for use within Apiagex projects, it uses Kysely under the hood and stores role metadata with roleKind, admin permissions in admin_permissions, content API permissions in permissions, hashed API tokens in api_tokens, and webhook data in webhooks, webhook_events, and webhook_deliveries. It is still in MVP stage, with evolving schemas and adapter implementations.
npm install apiagex-databaseNo compatibility data collected yet for this library.
Verified import paths — ran on the pinned version, not inferred.
Shows how to import and use selectDatabaseAdapter to create a SQLite database adapter and run a query.
Update database schema to include roleKind column and migrate existing role data accordingly.
Migrate admin permissions from permissions to admin_permissions table before upgrading.
Rehash all existing API tokens and store in api_tokens table.
Use import syntax and ensure project is configured for ESM ("type": "module" in package.json).Use only for prototyping. For production, implement real adapters or use a different database layer.
Run 'npm install apiagex-database' and ensure tsconfig.json includes node_modules in typeRoots or uses 'moduleResolution': 'node'.
Install kysely as a dependency: 'npm install kysely'.
Use 'import { selectDatabaseAdapter } from 'apiagex-database'' instead of require.