A polished donation page for open‑source developers. Built with Next.js + Stripe. No database, no vendor lock‑in. Total raised is a simple text file you control.
- For maintainers who want a clean, trustworthy way to accept donations.
- For teams who don’t want a database just to show a public “total raised”.
- For anyone who values clarity, speed, and ownership over their stack.
- Stripe Elements + PaymentIntents (card, Apple/Google Pay via browser wallets; Cash App return_url wired).
- Required name/email, optional GitHub handle and public/private toggle.
- Out‑of‑the‑box success page with spinner → success/failed states.
- GitHub profile and repos section (uses optional
GITHUB_TOKENfor higher rate limits). - Total raised tile and a panel under the payment box.
- Zero database. Public total comes from
public/raised.txt(integer cents). - Glassmorphism UI, dark theme, accessible focus states.
- Friendly code, TypeScript, App Router.
- Use this template (or Fork) on GitHub.
- Clone locally.
- Create
.env.localwith your keys:NEXT_PUBLIC_STRIPE_PUBLISHABLE_KEY=pk_test_...STRIPE_SECRET_KEY=sk_test_...STRIPE_WEBHOOK_SECRET=whsec_...(optional; from Stripe CLI or Dashboard)- Optional:
GITHUB_TOKEN=ghp_...(for GitHub API rate limits) NEXT_PUBLIC_SITE_URL=https://your-deployed-domain(used by sitemap/robots and metadata)
- Set your starting total: edit
public/raised.txt(integer cents, e.g.,0or12345). - Install and run locally:
npm installnpm run dev
- Optional (recommended) webhook for local testing:
stripe listen --forward-to localhost:3000/api/stripe/webhook- Put the printed
whsec_...intoSTRIPE_WEBHOOK_SECRETand restart.
- A single file
public/raised.txtcontains the public total as cents. - The API routes
GET /api/donationsandGET /api/statsread this file and servetotalRaisedCents. - No automatic aggregation from Stripe. You control the number. Update the file and deploy.
- Repo link (the top‑right GitHub corner):
src/app/layout.tsx. - Featured projects carousel/cards:
src/components/FeaturedCarousel.tsx. - Donation UI (tiers, slider, toggles):
src/components/DonateControl.tsx. - Hero copy and stats row:
src/components/Hero.tsx. - Success page message:
src/app/success/page.tsx. - Styling utilities and theme:
src/app/globals.css.
POST /api/stripe/create-payment-intent→ Creates PaymentIntent.GET/PATCH /api/stripe/intent→ Reads/updates PaymentIntent (metadata, receipt email).POST /api/stripe/webhook→ Signature verified; returns 200 (no DB writes).GET /api/github/profile+GET /api/github/repos→ Public GitHub data.GET /api/donations+GET /api/stats→ Readpublic/raised.txt.
- Sensitive operations occur server‑side via Stripe SDK.
- No customer data is stored in this app. Donor name/email live in Stripe.
- Webhook is verified with your
STRIPE_WEBHOOK_SECRET.
- One‑click: use the “Deploy with Vercel” button above.
- Or import the repo in Vercel, set env vars, and deploy. Ensure
public/raised.txtexists in your repo.
Here’s how it will look in your repo:
Add the button that links to your donation page in 3 quick steps:
-
Get your donation URL
- Deploy this site (e.g., on Vercel) and copy the URL, e.g.,
https://your-donate-site.vercel.app.
- Deploy this site (e.g., on Vercel) and copy the URL, e.g.,
-
Create
.github/FUNDING.ymlin your repo- This file controls the Sponsor button.
# .github/FUNDING.yml
# Shows a Sponsor button on your repo header
# Replace with your deployed donation URL
custom:
- https://your-donate-site.vercel.app- Commit and push
- GitHub will show a “Sponsor” button that opens your donation page.
Optional
- Include your GitHub Sponsors handle (if you use GitHub Sponsors as well):
github: [ your-github-username ]
custom:
- https://your-donate-site.vercel.app- Organization-wide: put
.github/FUNDING.ymlin your org’s special.githubrepository to apply it to all repos that don’t have their own.
- Optional donor wall sourced from Stripe charges/metadata.
- Real GitHub “commits this year” metric.
- Multi‑currency support.
- Issues and PRs welcome. See
CONTRIBUTING.mdandCODE_OF_CONDUCT.md. - MIT License. See
LICENSE.
Made with love by aryan6673 ❤️
If this helps your project, star the repo and share it with another maintainer. One less blocker between your work and your supporters.