Thank you for your interest in contributing to the QuestDB JavaScript Client! This repository contains both the Node.js and browser npm packages.
- Fork and clone the repository:
git clone https://github.com/YOUR_USERNAME/nodejs-questdb-client.git
cd nodejs-questdb-client- Install dependencies:
pnpm installThe repository is a pnpm workspace of three packages:
| Package | Published | Contents |
|---|---|---|
packages/client-core |
no | Shared runtime-neutral QWP protocol and session code |
packages/nodejs-client |
yes | @questdb/nodejs-client: ILP transports plus the Node QWP adapter |
packages/browser-client |
yes | @questdb/browser-client: the browser QWP adapter |
client-core is private and never published; both public packages inline it at
build time. Each published package exposes its whole API from its package root,
so packages/*/src/index.ts are the only public entry points.
Build both packages with:
pnpm buildpackages/browser-client must stay free of Node built-ins, Node typings,
undici, and ws. Run pnpm test:dist after any change to a package boundary:
it loads both built tarball layouts through their exports maps and checks the
browser bundle for Node imports.
The project uses Vitest for testing. Tests are located in the test directory.
- Run tests in watch mode during development:
pnpm run test- Some tests use mock servers and certificates located in the
test/certsdirectory
You can generate the certificates by running the
generateCerts.shscript in thescriptsdirectory. The script requires two arguments: the output directory and the password for the certificates../scripts/generateCerts.sh . questdbPwd123
-
The project uses TypeScript. Make sure your code is properly typed.
-
Format your code using Prettier
-
Lint your code:
pnpm eslint- Fix linting issues:
pnpm eslint --fix.github/workflows/build.yml runs the following on every pull request, across
Node.js 20, 22, and latest. Run them locally before pushing — pnpm test alone
does not cover the type-checking, packaging, or browser-bundle gates.
| Command | Covers |
|---|---|
pnpm eslint |
packages/*/src |
pnpm format:check |
Prettier style across packages/** and test/** |
pnpm typecheck |
Package sources plus the QWP public API contract |
pnpm typecheck:qwp-browser |
The browser source graph, with DOM libs and no @types/node |
pnpm typecheck:test |
test/**, which pnpm typecheck does not reach |
pnpm typecheck:bench |
benchmarks/** |
pnpm lint:bench |
benchmarks/** |
pnpm test |
The Vitest suite, including containerized integration tests |
pnpm test:dist |
Both built packages loaded through their exports maps |
pnpm typecheck:dist |
The emitted .d.ts files, as a consumer sees them |
pnpm check:packages |
That everything exports references is present and packed |
A separate job drives the built browser bundle in real Chromium against a local mock server:
pnpm test:qwp-browserVitest strips types without checking them, so a test can reference a deleted
export and still pass; pnpm typecheck:test is what catches that. Likewise the
compiled table writers promise per-column row typing that lives only in the
emitted declarations, which is why pnpm typecheck:dist exists alongside
pnpm test:dist.
docs/ is committed and GitHub Pages serves it directly from the branch, so it
is published output rather than a local build artifact. Regenerate it in the same
commit whenever you add or rename a public export, or edit QWP.md or
README.md:
pnpm run docstest/docs-reference.test.ts runs inside pnpm test and fails when the
committed reference has no page for an exported symbol, or when its embedded
copy of QWP.md has fallen behind the real one. It deliberately does not
compare the tree byte for byte: TypeDoc stamps the current commit SHA into every
source link, so a regenerated tree always differs from the one committed a commit
earlier, and a strict diff would be unsatisfiable rather than merely noisy.
.github/workflows/publish.yml publishes the selected packages (both by
default, see below) from one commit, so bump packages/nodejs-client/package.json and
packages/browser-client/package.json to the same new version before
dispatching it. node scripts/check-release-versions.mjs runs first and
refuses a dispatch whose version every selected package has already
published, because each publish step skips a version npm already has and
such a dispatch would publish nothing at all. For a single-package dispatch
that means re-dispatching a package already on npm is refused even while the
other package is still missing; the error names the missing package and the
packages value that publishes it, and says to create that package first
when npm does not have it at all (see "npm authentication" below).
Dispatches run one at a time. A dispatch made while another is running waits for it to finish, so its version check sees everything the earlier one published; GitHub keeps only the newest waiting dispatch and cancels any older one still waiting.
If a dispatch fails between the two publish steps, leaving one package on npm
and the other not, re-dispatch the same commit. That is the supported
repair: the gate verifies that the published package's npm gitHead is the
commit being dispatched, reports resuming a partial release, and passes. The
published package's step skips it, and the missing one lands.
A package with the same version but a different or missing gitHead is an older
unrelated artifact, not a partial release; the gate rejects it and the version
must be bumped, unless that package was deliberately released on its own (see
below). Do not bump merely to escape a genuine same-commit partial
release -- that strands the missing half at the old version permanently.
The workflow's packages input (both, nodejs, or browser; default
both) publishes a subset, for example when a package depends on server
support that has not shipped yet. The manifests must still carry the same
version, but the gate checks only the selected packages against npm, so the
other package can follow later under that same version from a later commit:
dispatch it with its own packages value. Do not dispatch both for a
follow-up from a later commit; the gate sees the already-published package's
gitHead differ from the new commit and rejects the release as an unrelated
artifact. A follow-up from the same commit may dispatch either the missing
package or both; with both, the gate reports it as a resumed partial
release and the already-published package is skipped.
If the first package needs a fix before the second ships, bump both manifests and dispatch only the first again. The second then ships under the newer version.
check-release-versions.mjs decides whether to bump, never by how much.
Pick the level from the changes the release carries: a breaking change, as
described under "Breaking Changes" below, needs a major bump. A bug fix that
brings an API back to its contract does not, even when callers can observe
the difference. The signal comes from the commits, so mark a breaking change
where Conventional Commits puts it (see below) rather than leaving it for the
release to rediscover.
The publish steps authenticate with npm only through
trusted publishing: npm trades the
job's GitHub OIDC token for a short-lived publish token, so the repository
stores no npm token, and every version carries a provenance statement. Each
package needs a trusted publisher on npmjs.com (package Settings, Trusted
publishing, GitHub Actions) with organization questdb, repository
nodejs-questdb-client, workflow filename publish.yml and no environment.
Its allowed actions must include npm publish; npm defaults a new
configuration to npm stage publish only. npm also expires a configuration
that has not published within 48 hours of its creation, so add it shortly
before the dispatch that first uses it, and recreate it if it lapsed.
ENEEDAUTH from a publish step means npm got no token over OIDC. Usually no
trusted publisher matches this workflow, but a failed OIDC request to GitHub
or npm ends the same way, so check the configuration and re-dispatch.
404 Not Found - PUT means npm rejected a token.
npm attaches a trusted publisher only to a package that already exists, and
the workflow has no token to create one with, so the release check refuses a
dispatch that selects a package npm does not have. Create a new package by
hand first, with staged publishing:
npm stage publish creates a package from a maintainer's logged-in session,
with no token and no 2FA prompt. It needs npm 11.15 or later, Node 22.14 or
later, and an npm account with 2FA enabled that may publish to @questdb.
-
Stage a throwaway version from an empty directory, here for
@questdb/browser-client:cd "$(mktemp -d)" echo '{"name":"@questdb/browser-client","version":"0.0.1-bootstrap.0"}' > package.json npx -y npm@11.21.1 login npx -y npm@11.21.1 stage publish --access public --tag bootstrap
npm creates the package with a public placeholder version,
0.0.0-stage, which stays in its version list. The staged version itself is not public unless a maintainer approves it. Do not stage the release version instead: while a version is staged, npm refuses to publish that version. -
Add the package's trusted publisher as described above.
-
Reject the staged version with
npx -y npm@11.21.1 stage reject <stage-id>, which prompts for 2FA.stage publishprinted the stage ID, andnpx -y npm@11.21.1 stage list @questdb/browser-clientshows it again. Then check thatnpm view @questdb/browser-client@0.0.0-stage versionstill prints the placeholder, so the package still exists. -
Dispatch within 48 hours of adding the trusted publisher.
- Create a new branch for your changes:
git checkout -b feature/your-feature-name- Make your changes and commit them with clear, descriptive commit messages:
git add .
git commit -m "feat: add new feature"We follow the Conventional Commits specification for commit messages.
A commit that breaks a published API marks it, either as ! after the
type/scope (feat(qwp)!: ...) or as a BREAKING CHANGE: footer. That marker
is what tells a release it has to be a major one, so a pull request carrying
such a change needs it on the pull request title too. "Breaking Changes" below
describes what counts as one.
- Push your changes to your fork:
git push origin feature/your-feature-name- Create a Pull Request from your fork to the main repository.
A change is breaking when code that relies on a published API's contract -- its documentation, its types, and what it evidently promises -- has to change to keep working. Whether a caller can observe a difference does not decide it. Breaking changes include:
- removing or renaming an export, option or connect-string key, changing a default, or narrowing a signature or type;
- changing documented behaviour, such as the error class a documented failure raises, or refusing input the documentation accepts;
- making the client send something a supported server version rejects.
A bug fix that brings the implementation back to its contract is not
breaking, even though callers can observe the difference. Commit it as a
plain fix:, without ! or a BREAKING CHANGE: footer, and describe what
callers will notice in the commit body and the pull request. Such fixes
include:
- a method that returns a promise but threw synchronously, and now rejects or resolves instead;
- a crash, hang, unhandled rejection or uncaught exception that becomes an ordinary result or an error the caller can catch;
- an error raised for something the contract does not treat as a failure, such as cancelling a query that has already ended, or an error whose class names the wrong cause;
- input the documentation accepts that the code refused or mishandled, such
as data that fits within
max_buf_size.
The wording of an error message is not part of the contract; the error's class, and the conditions documented for it, are. A fix that also changes documented behaviour is breaking all the same. If it is unclear whether the old behaviour belonged to the contract, say so in the pull request and let the reviewers decide.
- Make sure all tests pass
- Update documentation if needed
- Add tests for new features
- Keep PRs focused - one feature or bug fix per PR
- Link any related issues in the PR description
- Update the README.md if you're adding new features or changing existing ones
- Add JSDoc comments for new public APIs
- Include examples in the documentation when appropriate
If you have questions or need help, you can:
- Open an issue with your question
- Join our community discussions (if available)
By contributing to the QuestDB JavaScript Client, you agree that your contributions will be licensed under the project's license.