Serverless at the edge
Workers scheduling, isolate reuse, and cold-start numbers from production.
A Worker is scheduled to a colo, not to a VM you SSH into. The scheduler picks the closest location that has spare isolate capacity and a healthy path to your origin, if you have one. In Japan that is almost always NRT-1 or HND-1; overflow goes to KIX-1.
Paid plans keep an isolate warm for 30 minutes. Free plans keep it for 30 seconds. That is why a demo on Free looks “cold” and the same code on Pro does not.
Read KV, then fetch origin
export default {
async fetch(request, env, ctx) {
const key = new URL(request.url).pathname;
const cached = await env.PAGES.get(key, { type: "stream" });
if (cached) return new Response(cached, { headers: { "x-kv": "hit" } });
const origin = await env.ORIGIN.fetch(request);
ctx.waitUntil(env.PAGES.put(key, origin.clone().body, { expirationTtl: 60 }));
return origin;
},
};
Deploy from CI
$ gitflare deploy --name web --edge nearest \
--kv PAGES=PAGES \
--origin https://origin.example.com
Pass --compatibility-date so a runtime change on our side cannot surprise a Friday deploy. We never break a pinned date.