Skip to content
Dylan Kentish

WorkDonate.gg

Moving a live donations API and its websockets to Cloudflare.

Contract platform work on Donate.gg, the donation layer that other crypto products build giving on. A gift made in a token on Solana or an EVM chain settles as USDC, is split between the charities and campaigns it names, and reaches a charity’s bank in USD. I moved the public API and the live donation updates onto Cloudflare, reworked the cache, simplified the tools the operations team pays charities with, and cut what each request and each code change costs.

Problem

Donate.gg sits between three groups. Donors give in whatever token they hold, on Solana or an EVM chain. Charities want USD in a bank account and no wallet. Builders want to add giving to their own product through an API, with campaigns, charity coins and leaderboards on top. Every gift has to be bridged, converted, split by weight between its beneficiaries, and paid out, and the gift and its distribution can both be checked on-chain. So the platform has two jobs that pull against each other. It answers a great many reads of the same lists, cheaply. And it moves money, where a person has to see what is held, for how long, and where it goes next.

What I did

I joined at the end of April 2026. The platform was four months old and had been built to launch. The API was served from inside the website’s own app, live updates ran on a server the team managed itself, and every code change ran the whole test suite. Traffic arrived the following month, and those choices began to cost money and time. Much of my work since has been remedial: find what a launch-era decision costs under load, then replace it without stopping the service. Some of the decisions I have had to revisit were my own. Through the summer I wrote most of my changes by hand: a shared interface library, a cache that all the apps share, and the first rounds of work on the build pipeline. In October I planned the move of the public API off the website’s host and onto Cloudflare Workers, and then ran it. Staging moved on 5 November, production on 6 November, and the old host was retired on 9 November. A few days later I moved the live donation updates from a Socket.IO server to a Cloudflare Worker, and moved a long-running watcher process into a container that Cloudflare runs. In October and November I reworked the tools the operations team uses to pay charities: how long each charity’s money has been held, a single step to withdraw a charity’s vault to its payout route, and a list of who is waiting to be paid. Since September I have moved most of the writing of code to coding agents. They work from plans I write and from instructions the team keeps in the repository. I review what they produce, merge it, and run the cutovers myself.

Donate.gg is run by Donation Labs Inc., a public benefit corporation in Delaware, USA. I work on contract in a small engineering team. Another engineer built the first version of the cache, and the donation app and the developer portal are shared work. The charity relationships and the brand are not mine to claim, and the totals below include the time before I joined.

Constraints

The API is live and other products call it, so nothing about a request could change except the host name. Each move had to be easy to reverse until it had run in production. A Worker is not a server: each request has a limit on memory and CPU time, and it cannot hold a pool of database connections open the way a server does. And the point of the work is cost, so a change that is faster but dearer does not count.

Decisions

  • The API got its own host before it got a new home. Our own apps moved to api.donate.gg in October. The old address then answered with Deprecation and Sunset headers until 20 November 2026. Now it returns 410 Gone and not a redirect, so a client that ignores the status code is not moved silently.
  • The Worker runs near the database, not near the caller. Left alone, a request ran wherever it entered Cloudflare’s network, and each Redis call took 120 to 640 ms. Pinned to the region the data is in, the same calls take 8 to 60 ms.
  • One Durable Object holds every widget’s websocket. It uses hibernation, so an idle widget costs nothing, and a ping is answered without waking the object. The service that publishes donations kept the same interface. It changed a URL and a secret, and no code.
  • A cache tag has to match what really changes. The charity list had a CDN hit rate of about 0.4%, because every donation marked it stale. I tagged the list by charity only, and let the donation totals on it be up to a minute old.
  • A withdrawal is recorded once, then sent one chain at a time. If the custody provider gives an unclear answer, the later chains stop and the same idempotency key is kept, so a retry cannot pay twice. Withdraw stays disabled until every transfer has a final status. The holding clock was also wrong: it counted from the donation date, so a vault that had been emptied and refilled still looked months old. It now counts from the last withdrawal that went through.
  • A test runs only when the change could break it. CI picks the browser tests and the database tests from the files that changed. Replayed over the previous 40 merges, 22 needed no browser tests at all.

Result

Where it runs
The public API, the live updates and the watcher all run on Cloudflare. The servers that ran the last two before are switched off.
Paying charities
In the admin, an operator can see which charities are waiting for payout and how long the money has been held, and can empty a charity’s vault to its payout route from one dialog.
Hosting cost
The bills were small when I joined and rose as traffic arrived, so the fair measure is cost against traffic. From May to October the traffic the web host charges for roughly quadrupled, and its bill grew by about 70%. After the API left that host in November, the host’s daily bill fell to about half of October’s average, over the nine days measured so far. That leaves out what Cloudflare now charges.
Database
The database sent out 7.5 TB of data in June, its worst month, and 0.3 TB in September, after the shared cache and the CDN tags went in. It climbed again in October. A fix in November halved it, and it is still several times September’s level.
CI
The main check had a median of 7.7 minutes, and 9 of 300 runs had hit the 30-minute limit. After the rework a full run took 6.3 minutes. The database migrations workflow went from 9 minutes 47 seconds to 6 minutes 19. Moving to TypeScript 7, Oxlint and Jest on SWC took the type-check, lint and test step from 1,448 seconds to 355, measured on two cores to match the CI runner.
The platform’s own totals
The site prints: “More than $10.9M raised to date.”, “641+ Campaigns raising funds globally.”, “10 Chains supported across wallets.”, “81K+ Individual donations made.”, and “9.8K+ Unique donors across campaigns.” The docs welcome page says that since mid-2025 it has processed over $2.8M in donations. These include the time before I joined.

Sources

  • API move notice

    The public notice for the move to api.donate.gg. “Change the host in your base URL. Nothing else changes.” It lists the Deprecation, Sunset and Link headers, and says the old address returns 410 Gone from 20 November 2026 and does not redirect.

  • Private repository

    The cutover dates and the measurements on this page come from my pull requests in the Donate.gg repository, which is private. Each figure was measured at the time and written into the pull request that made the change. Checked on 2026-11-20.

  • How a donation moves

    The public description of the journey: “All new donations settle as USDC on Solana.” EVM donations are bridged there, pooled and converted, then distributed to each beneficiary by the weights in the config.

  • Billing and usage records

    The cost comparisons come from the web host’s billing records and the database provider’s usage records for March to November 2026. Both are private. I read them on 2026-11-20. Dollar amounts are left out on purpose, and the Cloudflare bill is not part of the comparison.

  • Public site

    The marketing page prints: “More than $10.9M raised to date.” “641+ Campaigns raising funds globally.” “10 Chains supported across wallets.” “81K+ Individual donations made.” “9.8K+ Unique donors across campaigns.” The St. Jude block on the same page prints “Supporting St. Jude from day one.” “$827,889 raised to date.” “3,586 individual donations.” “1,018 unique donors.” Read on 2026-11-20.

  • Terms of service

    The terms name the company behind the site: Donation Labs Inc., a Delaware public benefit corporation.

  • Docs

    The welcome page says: “Donate.gg routes crypto donations to charities. Builders use the API. Charities get paid in USD to their bank. Since mid-2025, it has processed over $2.8M in donations.”

Reflection

Twice the data leaving the database climbed for weeks before it was dealt with: from May as traffic arrived, and again from the middle of October. Next time I would watch cost against traffic from the first day, with an alert on it, so that the number arrives before the invoice does.

Technical notes

Next.js 16 apps in a pnpm and Turborepo monorepo, written in TypeScript. The public API is a Next.js app built with OpenNext and run on Cloudflare Workers. It reaches Postgres through Hyperdrive, with Prisma. Live updates use a Worker and a Durable Object with the WebSocket Hibernation API. The watcher runs on Cloudflare Containers. The cache is Next.js “use cache” with a Redis handler that all the apps share, plus CDN cache tags. CI is GitHub Actions with Turborepo, Playwright, Jest on SWC, and Oxlint.

Skills

TypeScript, Next.js, Cloudflare Workers, Durable Objects, WebSockets, Redis, Postgres, GitHub Actions, Turborepo