AG Grid server-side row model, compiled
AG Grid requests in.
Safe queries out.
Craticula compiles AG Grid requests into native SQL, MongoDB and OpenSearch queries. It never runs them, and every value is a bound parameter.
- Install
dotnet add package Craticula.Corenuget.org - Try it livePostgreSQLMongoDB
Apache-2.0 · .NET 10
{
"startRow": 0, "endRow": 50,
"filterModel": {
"customer": { "type": "contains", "filter": "acme" },
"amount": { "type": "greaterThan", "filter": 100 }
},
"sortModel": [ { "colId": "amount", "sort": "desc" } ]
}SELECT * FROM "orders"
WHERE ("customer" ILIKE '%' || $1 || '%' ESCAPE '\'
AND "amount" > $2::numeric)
ORDER BY "amount" DESC NULLS FIRST, "id" ASC NULLS LAST
LIMIT $3 OFFSET $4
-- parameters: 'acme', '100', 50, 0Find your way in
Concepts
What Craticula is, how a request becomes a query, Strict and Lenient, and the safety model.
Guides
Quickstarts, index guidance and moving from OData.
Configuration
The GridSchema, limits, and dialects and providers.
Reference
The specification, one page for each rule of how requests behave, and both schemas.
From install to your first query
- Step 1
Install
Build the library from source and reference the project for your engine.
- Step 2
Declare a GridSchema
List the fields a grid may touch, because anything else is refused.
- Step 3
Compile a request
Pass the AG Grid request in and get a statement and its parameters out.
- Step 4
Run it
Execute with your own connection, or let an adapter do it.
Who maintains it
Craticula is open source under Apache-2.0 and maintained by Christian Stephan (cstephan.dev, LinkedIn, GitHub). The source is at github.com/pluries/craticula.
Measured compile time #
The time Craticula takes to compile one grid request into a query, without running it. The figures are taken from the per-shape means of the report and are measurements on one machine, not promises.
| What is measured | This run: lowest to highest | Repeat run: lowest to highest |
|---|---|---|
| Schema prepared once, then each request compiled against it | 7.0 µs (search, plain-page) to 26.8 µs (mongo, deep-filter); 0 of 12 at or above the 50 µs target | 7.4 µs to 26.5 µs |
| Schema parsed from JSON on every call | 17.0 µs (search, plain-page) to 53.1 µs (mongo, group-aggregate); 3 of 12 at or above the 50 µs target | 16.9 µs to 62.4 µs |
Measured on bench-vm-10c-34g on 2026-11-16, run folder 2026-11-16-p. Every figure links to the BenchmarkDotNet report it was read from. The full tables, the load results and the method are on the performance page.
All pages #
- Quickstart: C# From an AG Grid request to parameterized SQL in one small program. TypeScript, Python and Go are planned for after the spec freezes.
- Index and database guidance What each database needs from you.
- Overview What the library is, what it covers and what it leaves out.
- The spec The language-neutral source of truth every implementation conforms to.
- Semantics The rules every compiler follows, one page for each topic.
- GridSchema reference Every member of the GridSchema JSON Schema, with its type and description.
- IR reference Every member of the IR JSON Schema, with its type and description.
- Migrating from OData What you wrote in
$filter,$orderby,$top/$skipand$apply, and the request Craticula takes instead.