Amcic
A fundraiser page for one rescued kitten. Each donation is recorded, and each expense is matched to the donations that paid it.
- Stack
- Astro, TypeScript, Cloudflare Workers (D1, R2), Paraglide
Client: Amcic

The problem
Money raised for a hurt street cat usually moves through a group chat: a payment link, a screenshot of a transfer, a promise that the rest went on the vet. A donor on another continent cannot check any of it, and the person collecting can only prove it by posting receipts one at a time. Amcic is the page for one rescued kitten in Tizi Ouzou, Algeria, built so that a donor can see where each gift went.
My part
Design and build of the whole site: the public page and ledger, the ballot to name the kitten, and the admin area. The two people who run the fundraiser record the donations and write the updates. I made the tool they use.
Architecture
One Cloudflare Worker serves an Astro app in server mode, with D1 for the data and R2 for photos. Every page is rendered from the database on the request, and there is no client-side data layer.
The site takes no payments. Donors give through channels outside it, such as a payment link, a bank transfer or paying the clinic directly, and an admin records each gift by hand once it has arrived. That record moves the progress bar. The ledger is one pure module that recomputes the matching of expenses to donations on every request, so correcting an old donation changes every later match with no stored state to repair. Money is stored as integers.
Admin pages sit behind Cloudflare Access with an email one-time PIN, and the Worker checks the Access token again itself. Paraglide serves English, French and Arabic from the URL path. Arabic is laid out right to left. A Kabyle version is written and has been checked by a native speaker, and it is switched off in config.
Hard parts
Splitting a handover without losing a dinar. When the carer receives one lump sum for several donations, each donation's share is the total times what that donation received, divided by what all of them received, and that rarely divides evenly. Ordinary rounding can land a few dinars away from what the carer actually received, so the page would show money that does not exist. The fix is exact half-up integer rounding in BigInt, then the leftover settled one dinar at a time on the largest share. Ties break by amount and then by id, so the result never depends on list order.
A result nobody can rewrite. The kitten's name is picked by ballot, one vote per donation. Once the result is posted, database triggers refuse any change to the winner, the counts or the votes, so no later code path can move it. A counter that every relevant write bumps stops an admin from posting a result from a stale screen.
Photos on a free tier. The Worker has too little CPU time to resize images, so the admin's browser encodes each photo to WebP before upload and the Worker checks the bytes it receives.
Outcome
The site is live at amcic.samibentaleb.com in English, French and Arabic, and its two admins record real donations on it. The totals belong to the fundraiser and are on the live page.
Gallery
Ways to give, in Arabic. The home page at phone size.
