Introduction

A query builder that stays fast at a thousand rules, typed from your schema to the SQL it writes.

qnot is the part every filter bar, segment builder, routing form and alert rule shares: a tree of conditions that people edit, that you validate, and that ends up as SQL, a MongoDB filter, JsonLogic or a function you run in JavaScript.

It comes as a framework-agnostic core and thin bindings:

Why another query builder

  • Types that follow your schema. Declare fields once; every rule's value narrows by field and operator. Hover rule.value below:
import { , , , type  } from '@qnot/core';

const  = ({
  : .({ : 0 }),
  : .(['free', 'pro', 'team']),
});

declare const : <typeof >;
if (. === 'plan' && . === 'in' && ()) {
  .value;
value: readonly ("free" | "pro" | "team")[]
}
  • Edits stay O(1). The store keeps nodes by id and notifies only the node that changed, so a keystroke costs about half a millisecond at 1,000 rules, where react-querybuilder takes about 60 ms (see the benchmarks).
  • Every format, both ways. SQL with parameters in five dialects, MongoDB, JsonLogic, Elasticsearch, SpEL and a plain-English summary, plus two-way codecs for react-querybuilder, react-awesome-query-builder and jQuery QueryBuilder JSON.
  • Any UI. Use the default builder, or build your own from the hooks with coss ui, shadcn/ui, MUI or anything else.
  • Feature parity with react-awesome-query-builder: struct and list fields, functions, custom operators, locks, read-only mode, limits, switch cases, schema JSON.