Reference implementation

The patterns from the guides as code you can read in ten minutes. Framework-light on purpose — copy the ideas, not the imports.

Verified rather than asserted: the schema was applied to Postgres 16 and its behaviour tested (replayed events credit once, two events describing the same PaymentIntent credit once, money on a removed listing does not put it back on the board, the rank query agrees with board position for every row). Both TypeScript files typecheck under strict against the Stripe SDK.

schema.sql

Three tables, an idempotent credit_bid(), a write-absorbing click counter, and the board queries — including the keyset seek predicate worth 769 buffers.

create-checkout.ts

Amount validation, SSRF-aware URL normalisation, and the “must beat #1” check deliberately left out with the reasoning inline.

stripe-webhook.ts

Raw-body signature verification, event routing, and which HTTP status code to return when.