Skip to content

rokinsky/next.js-rust

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

5 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Next.js with WebAssembly boilerplate based on Rust

🦀 Rust + 🕸 WebAssembly + ▲ Next.js = ❤️

Overview

This code shows how to import WebAssembly files (.wasm) and use them inside a React (client-side) and Node (server-side) using Next.js. Here Rust is compiled to WebAssembly and wrapped in a npm package automatically generating package.json, .wasm, .js and .d.ts files.

Requirements

You will need the standard Rust toolchain, including rustup rustc, and cargo:

curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh

Install also wasm-pack:

curl https://rustwasm.github.io/wasm-pack/installer/init.sh -sSf | sh

How to use

Install other dependencies:

yarn install

Development

Compile Rust code run:

yarn rust:dev

Run dev server:

yarn next:dev

Performance

The Richest Customer Wealth task with the same algorithm solution was used as a basic performance test. You can compare performance using the following endpoints: /api/js/[number] and /api/wasm/[number].

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published