Registry / database / vex-core

vex-core

JSON →
library0.7.2jsnpmunverified

Local-first reactive backend engine with plugin architecture, SQLite storage, and real-time subscriptions via SSE. v0.7.2 (stable). Requires Bun 1.3+ or Node 24+ due to URLPattern dependency. Ship TypeScript types. Differentiates from similar tools (Convex, Firebase) by being self-hosted, fully local-first with SQLite, and providing a composable HTTP toolkit (vex-core/http) inspired by Vert.x Web and Koa. Peer dependency on React ^19 only for client-side usage. Plugin system allows file-based conventions via scanDirectory, defining tables, mutations, queries, webhooks, jobs, and middleware. Query builder supports filtering, aggregation, grouping, and pagination pushed down to SQL.

npm install vex-core
INSTALL
IMPORT
SIG · VEX-CORE
V
vex-core
databasejavascriptv0.7.2
harness data pending
Install & Compatibility
Where this runs

No compatibility data collected yet for this library.

Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

Vex
✓ import { Vex } from 'vex-core'
✗ const Vex = require('vex-core')
ESM-only; no CommonJS support. Requires Node >=20 or Bun.
sqliteAdapter
✓ import { sqliteAdapter } from 'vex-core'
✗ import { sqliteAdapter } from 'vex-core/sqlite'
Exported from main entry, not a subpath.
table
✓ import { table } from 'vex-core/framework'
✗ import { table } from 'vex-core'
Framework utilities are in 'vex-core/framework' subpath.
createRouter
✓ import { createRouter } from 'vex-core/http'
✗ import { createRouter } from 'vex-core'
HTTP toolkit is in 'vex-core/http' subpath.
vexHandler
✓ import { vexHandler } from 'vex-core/http'
Connects router to Vex instance; only from 'vex-core/http'.
scanDirectory
✓ import { scanDirectory } from 'vex-core/framework'
✗ import { scanDirectory } from 'vex-core'
File-based plugin loader is in 'vex-core/framework'.

Initializes Vex with SQLite storage, a plugin defining a counter table, mutation, and query, then demonstrates mutate, query, and subscribe.

import { Vex, sqliteAdapter } from 'vex-core'; const vex = await Vex.create({ storage: sqliteAdapter('.vex/data.db'), plugins: [ (api) => { api.setName('counter'); api.registerTable('counters', { columns: { key: { type: 'string' }, value: { type: 'number' } }, }); api.registerMutation('set', { args: { key: 'string', value: 'number' }, async handler(ctx, args) { return ctx.db.table('counters').insert(args); }, }); api.registerQuery('list', { args: {}, async handler(ctx) { return ctx.db.table('counters').all(); }, }); }, ], }); await vex.mutate('counter.set', { key: 'hits', value: 1 }); await vex.query('counter.list'); const unsub = await vex.subscribe('counter.list', {}, (rows) => { console.log('changed:', rows); }); unsub();
Debug
Known issues
breakingRequires Node >=24 or Bun >=1.3 due to URLPattern global (used in vex-core/http).
fix
Use Node 24+ or Bun 1.3+, or polyfill URLPattern with 'urlpattern-polyfill'.
affects: >=0.7.0
breakingESM-only package; no CommonJS compatibility.
fix
Ensure project uses ESM (type: module in package.json) or import syntax in Node.
affects: >=0.7.0
deprecatedReact peer dependency is only for vex-core/client; other modules don't require it.
fix
Do not install React unless using client features.
affects: >=0.7.0
gotchaSQLite adapter writes to disk; ensure directory is writable.
fix
Provide absolute or valid relative path to sqliteAdapter.
affects: >=0.7.0
gotchasubscribe() returns an unsubscribe function; not calling it may leak subscriptions.
fix
Call the returned function on component unmount or when subscription is no longer needed.
affects: >=0.7.0
gotchaFramework utilities (table, query, mutation) must be imported from 'vex-core/framework', not 'vex-core'.
fix
Use import { table } from 'vex-core/framework'.
affects: >=0.7.0
Errors
Common errors & fixes
Error: Cannot find module 'vex-core'
Package not installed or missing from node_modules.
fix
Run 'npm install vex-core'.
TypeError: Vex.create is not a function
Wrong import (default import instead of named).
fix
Use 'import { Vex } from "vex-core"' instead of 'import Vex from "vex-core"'.
Error: The 'urlpattern-polyfill' module is required for Node <24.
Runtime too old for URLPattern global.
fix
Upgrade to Node 24+, Bun 1.3+, or install 'urlpattern-polyfill'.
ERR_REQUIRE_ESM: require() of ES Module not supported.
Attempting to use require() on ESM-only package.
fix
Switch to import syntax or use dynamic import().
Upgrade
Version history
0.7.2latest on npm
Audit
Dependencies
reactoptionalPeer dependency for vex-core/client (optional)
Agent activity
22 hits · last 30 days
node
18
OpenAI (training)
1
Resources