@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 v22 or higher is required.
Install the SDK
The steps below set up a minimal project manually. To scaffold a project from a template instead, runnpm create fastedge-app — it handles folder creation, dependency installation, and project 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 | Creates build config for repeatable builds |
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.