What is Pragma?
Pragma is a natural-language query layer for data tables. Describe your table once; your users type what they want to see; Pragma returns a validated, library-agnostic TableQuery (search, filters, sort and pagination) that any table, API or database can run.

The problem
Every table library has its own state model for search, filtering, sorting and paging. Turning “enterprise customers in India who joined this year, biggest first” into that state means hand-written translation code, and asking a language model to do it directly gives you output you cannot trust: invented fields, wrong operators, values in the wrong format, or fields users were never meant to see.
The approach
Natural language is an input, not the source of truth. The source of truth is a typed query checked against your schema.
Packages
Most apps install one package and import by subpath:
npm install @avinash-baraiya/pragma| Import path | What you get |
|---|---|
@avinash-baraiya/pragma | defineSchema, createEngine, the TableQuery protocol, validation, dates |
…/react | Accessible AskBar with @ autocomplete, QueryChips, Explanation, ClarificationPrompt, Feedback |
…/tanstack, …/tanstack/react | TanStack Table v9 adapter and the usePragmaTable hook |
…/server | Web-standard HTTP handler plus a Node/Express adapter; keeps model keys on the server |
…/providers/<name> | openai-compatible, anthropic, gemini, ai-sdk, mock, remote |
…/styles.css | Optional default styles |
Prefer minimal installs?
The same code is published as individual packages: @avinash-baraiya/pragma-core, -interpreter, -providers, -server, -react and -tanstack. Core has no framework or vendor dependencies.
Where things run
| Step | Where | Network |
|---|---|---|
@ autocomplete, chip removal, clarification choices, table sort and paging | Browser | None |
| Explicit instructions (deterministic parser) | Browser | None |
| Everything else | Your server, then the model you configured | One request to your endpoint, one to the model |
| Filtering, sorting and paging the rows | Browser (TanStack) or your backend | Your choice |