Open source · MIT · Cloudflare-native

Sell your software
without a license
server.

Keyline is a small open-source library that issues, verifies and meters licenses inside the Cloudflare Worker you already run. No database to babysit, no dashboard to log into, no invoice at the end of the month.

$ npm i @keyline/edge
LICENSE Active
KLY-7F2A-9C41-D8E0
issued by keyline / production
ProductKeyline Pro
Seats24 / 50
Expires2027-11-02
API v3.2 Edge sig ok
verified · 38 ms
webhook invoice.paid
Product

Everything a paid feature needs.
Nothing you have to operate.

Licensing is a solved problem with an unsolved bill. Keyline keeps the logic — signing, entitlements, seats, metering — and hands the running of it to the edge you already pay for.

Verification at the edge

A license check is a signature check plus a cache lookup. Both happen in the Worker that is already serving the request — usually before the first byte leaves the region.

Median verify latency38 ms
Edge cache hit rate94.2%
Signature checks · Ed255191.9M / mo

Dark by default

The same license card, the same component, a second theme. Ship a dark-mode account screen without maintaining two design systems.

LICENSE Active
KLY-7F2A-9C41-D8E0
seats 24/50exp 2027-11-02

Seats & usage

Meter what you sell — per seat, per call, per build. Counters live next to the license, not in a spreadsheet.

  • Seats in use24 / 50
  • API calls today18.4k
  • Grace window7 days

Webhooks you can trust

Signed, retried, idempotent. Refunds, cancellations and chargebacks arrive as ordinary events you can replay.

  • invoice.paidok
  • license.revokedok
  • subscription.expiredok

Works offline

Licenses are self-contained and signed. If the network disappears, your customer keeps working and you keep the audit trail.

  • Public key pinnedEd25519
  • Grace period30 days
  • Clock drift guardon
Integrate

Six lines in your Worker.
That's the whole integration.

No SDK to configure, no middleware to mount. Import, verify, continue — and let the request fall through exactly as before.

src/worker.ts TypeScript
import { Keyline } from "@keyline/edge";

export default {
  async fetch(request, env, ctx) {
    const key = request.headers.get("x-license-key");
    const license = await Keyline.verify(key, env.KEYLINE_SECRET);

    // expired, revoked, or out of seats
    if (!license.valid) {
      return new Response("Payment required", { status: 402 });
    }

    ctx.waitUntil(Keyline.report(license, env.KEYLINE_SECRET));
    return env.ASSETS.fetch(request);
  },
};
How it works

From zero to paid in three steps.

Issue once at checkout, verify on every request, meter in the background. That is the entire lifecycle.

01

Issue

When a payment succeeds, sign a license payload with your secret and hand it to the customer. No rows to insert, no state to migrate.

Keyline.issue({ seats: 50 })
02

Verify

Every request carries a key. Verify the signature at the edge, check entitlements, and reject with a plain 402 when it no longer holds.

Keyline.verify(key, secret)
03

Meter

Usage and seat counts flow back asynchronously. You get billing-grade numbers without adding latency to the customer's request.

Keyline.report(license, secret)
Included

The unglamorous parts, handled.

Everything here exists because a founder hit it in production and opened an issue. It ships in about 40 kB.

Offline verification

Licenses carry their own proof. Nothing breaks when your API or ours is unreachable.

Seat management

Invite, deactivate and reassign seats without inventing your own invite flow.

Revocation in seconds

Refund, chargeback or abuse — revoke a key and the edge cache follows within one TTL.

Trial & grace windows

Expire softly. Customers keep their data and their dignity while you keep the renewal.

Stripe & Lemon Squeezy

First-party webhook handlers. Point the endpoint at your Worker and you are done.

Audit log you own

Every issue, verify and revoke is an append-only event stream in your own storage.

Typed from the payload up

One schema generates the runtime validators, the SDK types and the dashboard forms.

MIT, all the way down

Fork it, vendor it, self-host it. No open-core asterisk, no seat-based licence for the licence server.

In production

Quiet software. Loud numbers.

Most of Keyline's traffic is invisible — a signature check on the way to a static asset. Here is what that looks like at scale.

12.4k
GitHub stars

Indie developers, small studios and a few companies you would recognise.

1.9M
Licenses verified monthly

Across 4,100 Workers in 91 countries — none of them hitting a central database.

38ms
Median verification

p95 stays under 70 ms globally, including the cold path on a fresh region.

MIT
Forever, no asterisk

No hosted tier required to be useful. Self-host in an afternoon if you prefer.

FAQ

Questions developers actually ask.

Do I need a database?

No. A license is a signed payload, so verification only needs your public key. If you want seat counters and revocation, point Keyline at any KV or Durable Object you already have — it never asks for its own server.

How are licenses signed?

Ed25519, detached, over a canonical JSON encoding. The private key stays in a Worker secret; the public key is pinned in your client. Keys look like KLY-7F2A-9C41-D8E0 and are only a lookup handle — the signature is what grants access.

What happens if the network is down?

The license still verifies offline. Revocation is the only thing that needs the network, so it is cached with a short TTL and a configurable grace window. Worst case, a revoked key keeps working until the window closes — which is the same trade-off every licensing system makes.

Can I self-host the whole thing?

Yes. The verifier is a library, the issuer is a library, and the dashboard is a static site. There is no hidden control plane phoning home; the only network calls are the ones you configure.

Does it work outside Cloudflare?

The core is runtime-agnostic — Node, Deno, Bun, Vercel and Netlify all pass the same test suite. The Cloudflare adapter is simply the one with a KV cache and a Durable Object for seat counters.

How much does it cost?

Nothing. It is MIT licensed and there is no hosted tier to upsell you into. If it saves you a weekend, the maintainers would rather have a bug report than a subscription.