Getting started
Install
Section titled “Install”npm i @qubeejs/coreRequires Node ^22.12 || ^24 || >=26 for development. The published package targets ES2022 and
ships both ESM and CommonJS.
Build a query
Section titled “Build a query”createQubee() wires up the three objects you need and returns them sharing one store.
import { createQubee, STRAPI_DRIVER, SortEnum } from '@qubeejs/core';
const { builder, paginator, store } = createQubee({ driver: STRAPI_DRIVER });
const uri = builder .setResource('articles') .addFilter('status', 'published') .addSort('createdAt', SortEnum.DESC) .setLimit(25) .generateUri();generateUri() is synchronous and returns a string:
/articles?filters[status][$eq]=published&sort[0]=createdAt:desc&pagination[page]=1&pagination[pageSize]=25Fetch it yourself
Section titled “Fetch it yourself”qubee does not make the request. Prefix the URI with your API base and use whatever client you like.
const body = await fetch(`https://example.com/api${uri}`).then((r) => r.json());Read the page back
Section titled “Read the page back”Hand the body to the paginator. It parses the envelope and syncs the page metadata into the
shared store, so navigation helpers know where they are.
const page = paginator.paginate(body);
page.data; // rowspage.total; // 57page.lastPage; // 6Constructing by hand
Section titled “Constructing by hand”createQubee() is a convenience, not a requirement. Construct the three yourself when they should
not share a store, or when you are wiring them into a framework’s DI container:
import { QubeeStore, QueryBuilder, Paginator, STRAPI_DRIVER } from '@qubeejs/core';
const store = new QubeeStore();const builder = new QueryBuilder(store, STRAPI_DRIVER.createRequestStrategy('query'));const paginator = new Paginator( store, STRAPI_DRIVER.createResponseStrategy(), STRAPI_DRIVER.createResponseOptions({}),);Choosing a driver
Section titled “Choosing a driver”Import the one you need. The other seventeen tree-shake away, which is the difference between 2.5 kB and 9.5 kB gzipped.
import { STRAPI_DRIVER } from '@qubeejs/core'; // just this driverimport { DRIVERS } from '@qubeejs/core'; // all eighteencreateQubee() deliberately takes a definition, not an id, so it never reaches into the
registry on your behalf. Choosing at runtime is still one line — you just opt into the cost
explicitly, at your own import site:
import { createQubee, DRIVERS } from '@qubeejs/core';
const { builder } = createQubee({ driver: DRIVERS[config.driver] });