Skip to main content
The FastEdge JavaScript SDK (@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, run npx fastedge-init after installation — it walks through project type and structure interactively.
mkdir my-app
cd my-app
npm init -y
npm install --save-dev @gcoredev/fastedge-sdk-js
npm init -y creates package.json with "type": "commonjs" by default. The SDK bundler requires ESM — change it before building:
npm pkg set type=module
After installation, three CLI tools are available via npx:
ToolPurpose
fastedge-buildCompiles JavaScript to a WebAssembly binary
fastedge-initScaffolds a new project from a template
fastedge-assetsPackages static files for edge serving

Write a handler

FastEdge applications register a fetch event listener that receives an HTTP request and returns a response. Create src/index.js:
addEventListener('fetch', (event) => {
  event.respondWith(new Response('Hello from FastEdge'));
});
The 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:
npx fastedge-build --input src/index.js --output wasm/app.wasm
A successful build prints:
Build success!!
"src/index.js" -> "wasm/app.wasm"
The compiled binary is at ./wasm/app.wasm. That file can be uploaded to FastEdge directly or used as the starting point for the next tutorial.