Skip to content

DarumaDocker/netlify-wasm-runtime

 
 

Repository files navigation

This is a Next.js project bootstrapped with create-next-app.

This project is aimed to demonstrate how to implement a Serverless Functions working with Webassembly in Netlify. The main branch showcases an image processing function, and the tensorflow branch showcases an AI inference function. Both written in simple Rust and runs in the WasmEdge runtime for WebAssembly.

Overview

The Serverless Functions endpoint is located at api/hello.js to meet the requirement of Netlify, but not to the Next.js. So if you want to develop on you local machine, you should put it into pages/api/ and make some change.

The only function in api/hello.js is grayscaling an image. It receives a png file and pass it as stdin stream to a spawned child process. The child process runs using the WasmEdge command.

File api/functions/image-grayscale/src/main.rs implements the grayscaling logic. You can build it with the Rust cargo command with the -target wasm32-wasi option to get the grayscale.wasm file.

We define custom build in api/pre.sh which is called in package.json to download the WasmEdge command.

Learn More

To learn more about Next.js, take a look at the following resources:

To learn more about Serverless Functions in Netlify, take a look at the following resources:

Deploy on Netlify

The easiest way to deploy your Next.js app is to use the Netlify Platform.

Check out our Next.js deployment documentation for more details.

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • JavaScript 50.6%
  • CSS 35.5%
  • Rust 8.1%
  • Shell 5.8%