Skip to content

meshql-sqlite (@meshql/sqlite)

SQLite helper for MeshQL. Builds parameterised SELECT statements from a join plan; runs on Node 22.5+’s built-in node:sqlite (no native deps).

Terminal window
npm install meshql-sqlite meshql-core
# or
npx jsr add @meshql/sqlite @meshql/core

Published on npm as meshql-sqlite and JSR as @meshql/sqlite.

import { DatabaseSync } from "node:sqlite";
import { createMesh, type MeshSchema } from "meshql-core";
import { buildSelectSql } from "meshql-sqlite";
const db = new DatabaseSync(":memory:");
const schema: MeshSchema = { /* … */ };
const mesh = createMesh(schema);
mesh.resolve("user", async (plan) => {
const { sql, params } = buildSelectSql(plan, schema);
return db.prepare(sql).all(...params);
});

JSR imports: @meshql/core, @meshql/sqlite.

See also @meshql/postgres.