@gcoredev/fastedge-sdk-js) compiles JavaScript applications to WebAssembly so they can run on Gcore’s edge network. It is the recommended way to build FastEdge applications in JavaScript.
Node.js v20 or higher is required.
Install the SDK
The steps below set up a minimal project manually. To scaffold one from a template instead, runnpx fastedge-init after installation — it walks through project type and structure interactively.
npm init -y creates package.json with "type": "commonjs" by default. The SDK bundler requires ESM — change it before building:
npx:
| Tool | Purpose |
|---|---|
fastedge-build | Compiles JavaScript to a WebAssembly binary |
fastedge-init | Scaffolds a new project from a template |
fastedge-assets | Packages static files for edge serving |
Write a handler
FastEdge applications register afetch event listener that receives an HTTP request and returns a response. Create src/index.js:
fetch event model follows the Service Worker API convention. event.respondWith() accepts a Response object or a Promise<Response>. Under the hood, the SDK compiles to the WASI P2 wasi:http/proxy world — the same standard used by the Modern Rust SDK.
Verify the toolchain
Compile the handler to a WebAssembly binary:./wasm/app.wasm. That file can be uploaded to FastEdge directly or used as the starting point for the next tutorial.