nodejs-store

nodejs-store

One data layer for MongoDB, MySQL, SQLite and PostgreSQL — define models as pure JSON, query them with a MongoDB-style GQL tree syntax, and get role-based access control, computed columns and soft-delete out of the box.

nodejs-store lets a Node.js service talk to MongoDB (native aggregation), MySQL, PostgreSQL and SQLite through a single schema definition and a single query dialect. Nested relations compile to one native query per backend — you never hand-write $lookup or raw SQL.

npm install nodejs-store

Scenario walkthroughs

Six end-to-end walkthroughs, each with runnable code, the mistakes people make, and the exact limits of the engine:

Scenario What it covers
01 — Multi-tenant SaaS Bind one schema to N tenants with (source, namespace, collection) and re-target each request with a trusted route override.
02 — AI data-QA agent Compile and validate a GQL plan with buildPipeline() before executing it; capture degraded paths with setFeedbackSink().
03 — MongoDB → PostgreSQL migration The same schema and the same GQL against two backends — only the init() datasource changes.
04 — Admin CRUD backend Schema-driven CRUD with computed columns, soft-delete archives, role whitelists and queryWithCount pagination.
05 — Avoiding N+1 reads Replace a parent-then-children loop with one nested GQL read, and see when the planner picks a two-phase read instead.
06 — Serverless and connection reuse Hoist init() and schema registration, keep the driver client warm, isolate requests with setContext.

Documentation