Show HN: Zaplib – Speedup your web app with Rust and WASM

This page summarizes the projects mentioned and recommended in the original post on news.ycombinator.com

Our great sponsors
  • InfluxDB - Access the most powerful time series database as a service
  • ONLYOFFICE ONLYOFFICE Docs — document collaboration in your environment
  • SonarQube - Static code analysis for 29 languages.
  • CodiumAI - TestGPT | Generating meaningful tests for busy devs
  • webviz

    web-based visualization libraries

    Hey HN, one of the creators here! I made it at Cruise because it was super painful to develop https://webviz.io with manual memory management (lots of ArrayBuffers), WebWorkers, etc. I thought that there must be a better way.

    Very curious to hear stories from other folks building intensive stuff in the browser. How are you dealing with performance issues in Javascript? Have you tried using Rust or C++ with WebAssembly for parts of your apps? How did you make 2d/3d rendering faster? Would you want to use something like Zaplib?

  • imgui

    Dear ImGui: Bloat-free Graphical User interface for C++ with minimal dependencies

    I've been using a similar stack (C++ and WASM) to build some simple applications and I enjoy it very much. For the UI components I use Dear ImGui [0] as I am very familiar with it and it allows me to implement GUIs very fast. The biggest convenience is that you can run the same code both as a native application and as a web app. The biggest drawback is you usually get 100% CPU usage when there is an active animation in the WebGL canvas because you need to redraw everything (similar to the OP's example).

    If you are interested, checkout my Github template repo [1] - it contains a few examples:

    [0] https://github.com/ocornut/imgui

    [1] https://github.com/ggerganov/ggweb

  • InfluxDB

    Access the most powerful time series database as a service. Ingest, store, & analyze all types of time series data in a fully-managed, purpose-built database. Keep data forever with low-cost storage and superior data compression.

  • ggweb

    Template for C++ GUI apps that can run in the browser

    I've been using a similar stack (C++ and WASM) to build some simple applications and I enjoy it very much. For the UI components I use Dear ImGui [0] as I am very familiar with it and it allows me to implement GUIs very fast. The biggest convenience is that you can run the same code both as a native application and as a web app. The biggest drawback is you usually get 100% CPU usage when there is an active animation in the WebGL canvas because you need to redraw everything (similar to the OP's example).

    If you are interested, checkout my Github template repo [1] - it contains a few examples:

    [0] https://github.com/ocornut/imgui

    [1] https://github.com/ggerganov/ggweb

  • glicol

    Graph-oriented live coding language and music/audio DSP library written in Rust

    Great work. Do you have any tips for debugging? I use the same combo for Glicol music programming language:

    https://glicol.org

    You can check it if you are interested.

  • vite

    Next generation frontend tooling. It's fast!

    I always encourage users to use vite, and it is quite easy for the dev server.

    https://github.com/vitejs/vite/issues/3909

    For deployment it's a different story then but for example netlify has a quite intuitive way to set headers for CORS:

    https://github.com/padenot/ringbuf.js/blob/master/public/_he...

  • ringbuf.js

    Wait-free thread-safe single-consumer single-producer ring buffer using SharedArrayBuffer

    I always encourage users to use vite, and it is quite easy for the dev server.

    https://github.com/vitejs/vite/issues/3909

    For deployment it's a different story then but for example netlify has a quite intuitive way to set headers for CORS:

    https://github.com/padenot/ringbuf.js/blob/master/public/_he...

  • yew

    Rust / Wasm framework for building client web apps

    Overhead of calling into JS from Wasm is very low; DOM calls are no problem since the DOM call itself is much slower than the overhead of switching from Wasm to JS. See e.g. this article from ~4 years ago: https://hacks.mozilla.org/2018/10/calls-between-javascript-a...

    There are even some libraries that try to mimic React directly from Rust, such as https://yew.rs/ (though in my experience they can be a bit harder to use than Zaplib, since they require you to learn about traits, closures, etc, and tend to also run into borrow checker issues more often -- all of those are things we try to avoid having to learn in Zaplib!)

  • ONLYOFFICE

    ONLYOFFICE Docs — document collaboration in your environment. Powerful document editing and collaboration in your app or environment. Ultimate security, API and 30+ ready connectors, SaaS or on-premises

  • zaplib

    ⚡ Zaplib is an open-source library for speeding up web applications using Rust and WebAssembly.

    We used approach #1: https://github.com/Zaplib/zaplib/blob/7976d39775dd1642f20d8b...

    I might write a blog post about this, since it's pretty fun / tricky stuff!

  • ffi-gen

    Call rust from any language.

    Nice project, although pretty opinionated. But I guess you have to do that when targeting the crazy browser environment with all its weird quirks (at least for non-web devs)..

    Somewhat related is a library I've been working on to generate an ffi between Rust and js code: https://github.com/cloudpeers/ffi-gen

    Also I really like your universal_thread abstraction, hiding the whole web worker mess. I did a similar thing here: https://github.com/wngr/wasm-futures-executor

  • radixdb

    radix tree with fast persistence and different storage backends

    Yes, I also went with the 1st one.

    Basically the main thread sends a command to an io executor thread, and then waits on the result, which is done using atomics under the hood.

    See e.g. https://github.com/cloudpeers/radixdb/blob/sqlite/browser/sr...

    Can't wait to play with zaplib. Can you also use it as just a standard library without the GUI part?

NOTE: The number of mentions on this list indicates mentions on common posts plus user suggested alternatives. Hence, a higher number means a more popular project.

Suggest a related project

Related posts