Quickstart
Install the CLI, authenticate, and publish a Worker.
1. Install the CLI
macOS, Linux, and WSL are supported. The installer verifies the checksum before placing the binary on your PATH.
$ curl -fsSL https://gitflare.net/install.sh | bash $ gitflare version # gitflare 1.19.30 linux/amd64
2. Authenticate
Create a token with Workers:Edit and Zone:Read in the dashboard, then log in once per machine.
$ export GITFLARE_API_TOKEN=gf_live_... $ gitflare login --token "$GITFLARE_API_TOKEN" $ gitflare whoami
3. A minimal Worker
Save this as src/index.js. It reads a KV value and sets a short cache on the response so the Tokyo colo can serve repeats locally.
export default {
async fetch(request, env) {
const url = new URL(request.url);
const user = await env.USERS.get(url.searchParams.get("id") || "anon");
return new Response(JSON.stringify({ ok: true, user }), {
headers: {
"content-type": "application/json",
"cache-control": "public, max-age=30",
"x-gitflare-colo": request.cf.colo,
},
});
},
};
4. Bind KV and deploy
$ gitflare kv namespace create USERS
$ gitflare deploy --name hello --edge nearest \
--kv USERS=USERS \
--compatibility-date 2026-09-01
The first request is scheduled to the closest healthy location — in Japan that is usually NRT-1 or HND-1. Subsequent GETs with the same cache key stay in that colo until the TTL expires.
5. Point a hostname
$ gitflare hostname add hello.example.com --worker hello $ curl -sS https://hello.example.com/?id=42
Need an origin instead of a Worker? Create an origin rule and keep TLS on your own certificates. See the API reference for PUT /origins.