Meerkat is TypeScript SDK solution that seamlessly converts Cube-like queries to DuckDB queries. Whether you're using a browser or NodeJS, Meerkat delivers a powerful layer of abstraction for executing advanced queries.
A major feature of Meerkat is its utilization of DuckDB's Abstract Syntax Tree (AST) and the json_serialize_sql native utility. This is directly employed for two critical operations: serializing and deserializing SQL to JSON. By using this, we can effectively utilize all the features of the DuckDB query language without the need to rely on another query builder like React-query builder.
The DuckDB JSON AST gives Meerkat an edge; its extensibility far outpaces traditional query builders, hence providing more powerful and flexible solutions to complex queries.
This repository is a monorepo managed using Nx. It contains the following projects:
- meerkat-core- The core library that contains the core functionality of Meerkat.
- meerkat-node- The library uses- meerkat-coreand provides a NodeJS interface for executing queries.
- meerkat-browser- The library uses- meerkat-coreand provides a browser interface for executing queries.
- Install NodeJS v18
- From NodeJS website: https://nodejs.org/
- or using ASDF: https://asdf-vm.com/
- asdf plugin add nodejs
- asdf install
- node -vShould print v18.x.y as defined in- .tool-versionsfile
 
- or using NVM: https://github.com/nvm-sh/nvm
- nvm install 18
- nvm alias default 18
- nvm use default
- node -vShould print v18.x.y
- Setup .npmrcfile - Refer to this doc for more info.
 
- npm ci
There is no application to run, for testing your functionality you need to run the tests.
Example of running all tests
npx nx run-many --targets tests --all
Following steps can be used to link a local version of meerkat to a project:-
- At root level of the meerkat repo, run
- npm i
- npx nx run-many --target=build --all --parallel
 
- Create Symlinks
- cd ./dist/meerkat-core && npm link
- cd ../meerkat-browser && npm link && npm link @devrev/meerkat-core
 
- Remove meerkat-core & meerkat-browser from package.jsonof the project repo into which meerkat is to be linked
- At root level of the project repo, run
- rm -rf node_modules && npm i
- npm link --save @devrev/meerkat-node @devrev/meerkat-browser
 
- When done using the local version of meerkat, at the root level of project repo, run
- npm unlink @devrev/meerkat-core @devrev/meerkat-browser
 
