/hono-vercel-edge-functions

Vercel Edge Functions + Hono Router + Wasm + Rust

Primary LanguageTypeScript

Vercel Edge Functions + Hono Router + Wasm + Rust

This example shows the following:

  1. You are able to write Rust code inside wasm/src
  2. The Rust code gets compiled to WebAssembly
  3. The WebAssembly code is used in an API Route using the Edge Runtime
  4. This API Route can be deployed to Vercel Edge Functions
  5. The Hono Router is used to write all routes in a single API Route

Note: This example is using Next.js "headless" through the local dev server, using next dev to serve API Routes. It's not doing any rendering of pages, so React is not being used. Why? Hono does not currently work with vanilla Vercel Edge Functions, which are served through vercel dev. Hono v3 adds support for Next.js, which enabled me to create this example.

Example

Running Locally

pnpm i
pnpm dev