Vlad Ilie
BookTruck — presentation, donations and fundraising campaigns for a mobile library
Next.js · Fundraising · NGO

BookTruck — presentation, donations and fundraising campaigns for a mobile library

booktruck.cartilepefata.ro ↗
1 month ago
•••
10 min read

Context

I met Victor Miron in December 2016 at a book event in Timișoara. That's how I found out about the Cărțile pe Față cultural association and its mission to get Romanians reading more. I started as a volunteer at their "Vocea cititorului" reading clubs, co-organised two editions, and after moving to Cluj-Napoca I gradually took over the association's IT infrastructure.

BookTruck is the association's library on wheels, bringing books to children in villages without a working library. The site started in March 2022 on Next.js 12 as a presentation site with a donation form. Since then it has become the way the association raises money, collects books and volunteers, and sells its own books, and in autumn 2026 it gained an admin panel, fundraising campaigns and supporter accounts.

The problem

A fundraising site has to be trustworthy above all: a monthly donation must show up in the records even when the payment processor doesn't notify the site, and a refund made from the merchant account must show up in the panel too. The association also wanted "donate your birthday" campaigns, created by the team or even by supporters, without any page going public before someone has looked at it. On top of that, it sells the BookTruck books, runs a Christmas campaign every year, and needs to update its own partners, gallery, press coverage, book-donation points and map of adopted schools — without emailing me for every logo.

What I built

Under the hood

The piece I'm happiest with is the EuPlătesc donation sync. It runs every night on Vercel Cron (or on demand from the panel) and catches exactly the cases where an ordinary site loses data: monthly charges EuPlătesc makes without calling the site, payments whose callback never arrived, and refunds or cancellations made directly in the EuPlătesc account. The first run imported the full history back to 2018. It can run any number of times without duplicates; an incremental run covers the last 35 days and takes a few seconds. Because the merchant account is shared with other sites, it only imports BookTruck transactions, and the payment description carries the campaign, so a campaign's monthly charges find their way back to it. The integration uses the EuPlătesc library for Node.js that I maintain.

Campaigns reuse the same donations and the same sync rather than a parallel system. The amount raised isn't stored; it's calculated from the payments collected until the campaign ends, minus refunds: a monthly donation counts every charge while the campaign is running, and later charges no longer move the displayed progress. Photos and videos are uploaded straight from the browser to Supabase Storage with signed URLs, so large files never pass through the server, and a weekly job removes files left without a campaign. Descriptions are written with Tiptap and sanitised on the server against a short list of allowed tags.

For auctions, placing a bid happens in a single transaction that locks the auction's row in Postgres. The minimum, the cap, the time left and the current leader are re-read there instead of being trusted from the browser, because two equal bids a few milliseconds apart is a real case, and a unique index on the amount is the last line of defence. The bidder number is assigned there too. One Vercel Cron job closes expired auctions every minute and another sends the reminders, and any visit to a public page also closes an auction whose deadline has passed, so nobody can bid after the end even if a run is missed. Closing can run more than once without doing anything twice. At the end the winner gets an email, the others hear the result, and the team takes the award over in the panel: discussion notes, a payment link or an offline payment, handing over the object and, if a winner backs out, reassigning it to the runner-up at their own bid. The payment link creates an ordinary EuPlătesc donation, so the money shows up in the same records and statistics as every other donation. Team members can't bid, and an out-of-line bid can be cancelled from the panel with a reason, without being deleted. The auction rules are pure, tested functions used by both the server and the pages, so the interface shows exactly the limits the server enforces.

The site moved from the Pages Router to the App Router in 2024, runs on a Prisma database on Supabase Postgres, swapped Formik and Yup for react-hook-form and zod, and does i18n with next-intl. The homepage is statically generated and refreshes itself, so a campaign that ends disappears without anyone editing anything. Sign-in uses Better Auth magic links with Redis rate limiting, public forms are protected by Cloudflare Turnstile, and non-production deployments are never indexed. Pages have canonical URLs, language alternates, a sitemap and share images. Donation, campaign and auction rules, the sync, statistics, permissions, cookie consent, the payment routes and the auction jobs are covered by Vitest.

Result

The association manages its own content, campaigns, auctions and orders, and sees donations, active monthly donors and each campaign's progress in one place, with records that reconcile themselves every night. Supporters can start their own fundraiser, bid on donated objects and follow their donations and bids without having to write to anyone. The site does its job every day: people donate, order books and sign up as volunteers, and the BookTrucks keep heading out to schools.

Stack

Next.js 16 (App Router), React 19, TypeScript, next-intl, Prisma 7 on Supabase Postgres, Supabase Storage, Better Auth, Redis, Tailwind CSS 4, shadcn/ui, Headless UI, framer-motion, Tiptap, dnd-kit, Recharts, react-hook-form + zod, EuPlătesc, Stripe, Oblio, Brevo, Cloudflare Turnstile, Google Drive API, Vitest, Vercel.

Technologies:

  • Next.js
  • next-intl
  • Prisma
  • Supabase
  • Better Auth
  • EuPlătesc
  • Stripe
  • Oblio
  • Vitest

Share on: