• Stars
    star
    141
  • Rank 259,971 (Top 6 %)
  • Language
    HTML
  • License
    MIT License
  • Created almost 6 years ago
  • Updated about 1 year ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

A jq playground, written in WebAssembly

jq kung fu

A jq playground, powered by WebAssembly.

Links

How?

jqkungfu was built by compiling jq to WebAssembly, so that it runs in the browser.

The advantages of this approach are:

  • Speed: After the initial load time, jq queries are very fast because there are no round trips to a server
  • Security: This approach runs jq within the browser; otherwise, we would need to carefully secure the app so that users can't run arbitrary commands on the server!
  • Convenience: The app is purely front-end and is hosted as static files on a cloud storage provider

Launch locally

To launch jqkungfu locally:

python3 -m http.server 9999

Then open http://localhost:9999 in your browser.

Compile to WebAssembly (optional)

To compile jq to WebAssembly, run the compile.sh code within an environment that includes Emscripten.

To set up your environment:

# Make sure to use "--recursive" so the jq submodule is initialized
$ git clone --recursive https://github.com/robertaboukhalil/jqkungfu.git

# Build the Docker image with needed dependencies
$ docker build -t jqkungfu .

# Compile to WebAssembly
$ docker run --rm -it -v $(pwd):/src --entrypoint ./compile.sh jqkungfu

Learn More

This app is part of an example built for my book Level up with WebAssembly. Check it out if you're interested in more details, or to learn how to create similar applications.