{"id":13588621,"url":"https://github.com/sanity-io/groq-js","last_synced_at":"2026-03-06T17:06:33.467Z","repository":{"id":37819272,"uuid":"195953503","full_name":"sanity-io/groq-js","owner":"sanity-io","description":"JavaScript implementation of GROQ, the query language for JSON","archived":false,"fork":false,"pushed_at":"2025-09-25T17:32:18.000Z","size":2956,"stargazers_count":327,"open_issues_count":33,"forks_count":26,"subscribers_count":25,"default_branch":"main","last_synced_at":"2025-10-02T06:56:48.041Z","etag":null,"topics":["api","groq","json"],"latest_commit_sha":null,"homepage":"https://groq.dev","language":"TypeScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/sanity-io.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null,"notice":null,"maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null}},"created_at":"2019-07-09T07:14:41.000Z","updated_at":"2025-09-28T13:12:41.000Z","dependencies_parsed_at":"2023-10-01T23:38:56.449Z","dependency_job_id":"6f3eb575-c308-43d7-8cde-d5bc6a23e03c","html_url":"https://github.com/sanity-io/groq-js","commit_stats":{"total_commits":472,"total_committers":26,"mean_commits":"18.153846153846153","dds":0.6292372881355932,"last_synced_commit":"758d8e9f8de9e50af9a263305c9f023ee6ca78e1"},"previous_names":[],"tags_count":63,"template":false,"template_full_name":null,"purl":"pkg:github/sanity-io/groq-js","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sanity-io%2Fgroq-js","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sanity-io%2Fgroq-js/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sanity-io%2Fgroq-js/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sanity-io%2Fgroq-js/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/sanity-io","download_url":"https://codeload.github.com/sanity-io/groq-js/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sanity-io%2Fgroq-js/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":279011192,"owners_count":26084900,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","status":"online","status_checked_at":"2025-10-12T02:00:06.719Z","response_time":53,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["api","groq","json"],"created_at":"2024-08-01T15:06:49.564Z","updated_at":"2025-10-12T11:54:56.683Z","avatar_url":"https://github.com/sanity-io.png","language":"TypeScript","funding_links":[],"categories":["TypeScript","JavaScript"],"sub_categories":[],"readme":"# GROQ-JS\u003c!-- omit in toc --\u003e\n\n[![npm stat](https://img.shields.io/npm/dm/groq-js.svg?style=flat-square)](https://npm-stat.com/charts.html?package=groq-js)\n[![npm version](https://img.shields.io/npm/v/groq-js.svg?style=flat-square)](https://www.npmjs.com/package/groq-js)\n[![gzip size][gzip-badge]][bundlephobia]\n[![size][size-badge]][bundlephobia]\n\nGROQ-JS is a JavaScript implementation of [GROQ](https://www.sanity.io/docs/how-queries-work) which follows the official specification.\n\n```javascript\nimport {parse, evaluate} from 'groq-js'\n\nlet input = '*[_type == \"user\"]{name}'\n\n// Returns an ESTree-inspired syntax tree\nlet tree = parse(input)\n\nlet dataset = [\n  {_type: 'user', name: 'Michael'},\n  {_type: 'company', name: 'Bluth Company'},\n]\n\n// Evaluate a tree against a dataset\nlet value = await evaluate(tree, {dataset})\n\n// Gather everything into one JavaScript object\nlet result = await value.get()\n\nconsole.log(result)\n```\n\nTable of contents:\n\n- [Installation](#installation)\n- [Documentation](#documentation)\n- [Learn GROQ](#learn-groq)\n- [Versioning](#versioning)\n  - [GROQ](#groq)\n  - [GROQ-JS](#groq-js-1)\n- [Releasing a new version of GROQ-JS](#releasing-a-new-version-of-groq-js)\n- [License](#license)\n- [Tests](#tests)\n\n## Installation\n\n```bash\nnpm i groq-js\n```\n\n```bash\nyarn add groq-js\n```\n\n```bash\npnpm install groq-js\n```\n\n## Documentation\n\nSee [API.md](API.md) for the public API.\n\n## Learn GROQ\n\n[![Free egghead GROQ introduction course by John Lindquist](https://user-images.githubusercontent.com/6188161/142889665-fc04ac47-d0fa-492b-897b-4203c97e94ec.png)](https://egghead.io/courses/introduction-to-groq-query-language-6e9c6fc0?utm_source=github\u0026utm_medium=cta\u0026utm_term=GROQ)\n\n## Versioning\n\n### GROQ\n\nThe GROQ spec version is independent of the groq-js library version. When you import groq-js you need to be explicit on which GROQ version you want to use. The GROQ version is tied to the [groq-spec](https://github.com/sanity-io/groq). This allows us to update the library and its API independent of the GROQ version.\n\n### GROQ-JS\n\nGROQ-JS follows [SemVer](https://semver.org).\nSee [the changelog](CHANGELOG.md) for recent changes.\nThis is an \"experimental\" release and anything _may_ change at any time, but we're trying to keep changes as minimal as possible:\n\n- The public API of the parser/evaluator will most likely stay the same in future versions.\n- The syntax tree is _not_ considered a public API and may change at any time.\n- This package always implements the latest version of [GROQ according to the specification](https://github.com/sanity-io/groq).\n\n## Releasing a new version of GROQ-JS\n\nRun the [\"CI \u0026 Release\" workflow](https://github.com/sanity-io/groq-js/actions/workflows/test.yml). Make sure to select the main branch and check \"Release new version\".\n\nVersion will be automatically bumped based on [conventional commits](https://www.conventionalcommits.org/en/v1.0.0/) since the last release.\n\nSemantic release will only release on configured branches, so it is safe to run release on any branch.\n\nNote: commits with `chore:` will be ignored. If you want updated dependencies to trigger\na new version, use `fix(deps):` instead.\n\n## License\n\nMIT © [Sanity.io](https://www.sanity.io/)\n\n## Tests\n\nTests are written in [Jest](https://jestjs.io/):\n\n```bash\n# Install dependencies\nnpm i\n\n# Run tests\nnpm test\n```\n\nYou can also generate tests from [the official GROQ test suite](https://github.com/sanity-io/groq-test-suite):\n\n```bash\n# Fetch and generate test file:\n./test/generate.sh\n\n# Run tests as usual:\nnpm test\n```\n\nYou can generate tests from a specific version:\n\n```shell\nGROQTEST_SUITE_VERSION=v1.0.0 ./test/generate.sh\n```\n\nor from a file (as generated by the test suite):\n\n```shell\nGROQTEST_SUITE=suite.ndjson ./test/generate.sh\n```\n\nThe test arguments are passed to `tap`, so you can use arguments, e.g. to run a specific set of tests:\n\n```shell\nnpm test -g \"array::join\"\n```\n\n[gzip-badge]: https://img.shields.io/bundlephobia/minzip/groq-js?label=gzip%20size\u0026style=flat-square\n[size-badge]: https://img.shields.io/bundlephobia/min/groq-js?label=size\u0026style=flat-square\n[bundlephobia]: https://bundlephobia.com/package/groq-js\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsanity-io%2Fgroq-js","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fsanity-io%2Fgroq-js","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsanity-io%2Fgroq-js/lists"}