Quick start
This walkthrough starts with local execution so you can see the query model without configuring a server. The same query value can then be sent to a RAQ catalog endpoint.
Install the query package
pnpm add @raquery/queryInside this repository, install the workspace and run the checked example:
pnpm install
pnpm --filter raq-quickstart startBuild a query
import {
evaluate,
limit,
order,
project,
relation,
where,
} from "@raquery/query";
const featuredProducts = limit
order
project
whererelation"products", "price > 100",
"id", "name", "price"
,
"price desc"
,
2
;The result is a serializable relational AST. It does not fetch data when you construct it.
Evaluate it locally
const rows = evaluatefeaturedProducts, {
:
{: 1,: "Canvas Weekender",: 129 },
{: 2,: "Travel Pouch",: 32 },
{: 3,: "Utility Jacket",: 188 },
,
};rows contains the jacket followed by the weekender. The checked implementation is in examples/quickstart.
Run the same query remotely
When an application exposes a products catalog endpoint:
import { runQuery } from "@raquery/query";
const result = await runQuery"/products", featuredProducts;
console.logresult.rows;
console.logresult.sql;
console.logresult.params;The server resolves the public products relation, composes application-owned constraints, validates the resulting tree, and compiles it to parameterized SQL.
Next, read Query composition to understand why catalog relations are different from exposing database tables.