Cloudflare

Neutron supports deploying to Cloudflare's edge network, giving your application global low-latency performance.

Usage

The Cloudflare adapter ships inside @neutron-build/core and is selected at build time via the CLI's --preset flag — no separate install needed.

  1. Build with the Cloudflare preset:

    npx @neutron-build/cli build --preset cloudflare
    
  2. Deploy (using Wrangler):

    npx wrangler pages deploy dist
    

Platform Proxy

The adapter automatically provides the Cloudflare env object (KV, R2, D1) in your loader/action context.

export async function loader({ context }) {
  const kv = context.cloudflare.env.MY_KV_NAMESPACE;
  const value = await kv.get("key");
  // ...
}