(03)
Aforapay
An invoicing app for freelancers and small businesses: create an invoice, share a secure link, and get paid in USDC on the Stellar network. I built it end to end, and the backend does the checks that matter.
- Category
- Fintech · Full-stack
- Year
- 2026
- Role
- Full-stack (independent project)
- Timeline
- Nov 2026
- Stack
- Next.js · TypeScript · Node.js · PostgreSQL (Neon) · Prisma · Better Auth · Zod · Stellar SDK · GitHub Actions

About Aforapay
Getting paid by a client in another country usually means a slow, expensive bank wire. Aforapay lets a freelancer or small business create an invoice, send one short link, and get paid in USDC on the Stellar network. The client opens the link and pays from their own wallet, without creating an account.
It runs on Stellar's test network, so no real money moves yet. It's an independent project I designed and built on my own, front to back.

How I built it
The server decides; the browser only asks.
When a client chooses to pay, the server creates a payment intent and fixes everything about it: the amount, the asset, the destination address and a unique reference sent as the Stellar memo. The browser can't change any of them. Invoice totals are worked out on the server too, never trusted from the form.
Every payment is checked on the network.
A wallet saying "sent" isn't proof. After the client pays, the server asks the Stellar network for the transaction itself and checks that it succeeded, carries the exact memo, pays the right address in the right asset (code and issuer, since "USDC" alone proves nothing) and covers at least the amount due. Each failure has its own code, and network hiccups are marked as safe to retry.
Money counted in whole stroops.
Stellar amounts have seven decimal places, so all invoice maths uses whole stroops (1 USDC is 10,000,000 of them) held as BigInt, with no floating-point rounding. Postgres stores money as exact Decimal(20,7).
One transaction pays one invoice.
Confirming a payment runs in a single database transaction that only flips a payment that isn't already confirmed, then marks the invoice paid. A unique constraint on the transaction hash means the same Stellar transaction can't settle two payments, even if two requests race.
Links nobody can guess, or steal from the database.
Payment links are 128-bit random tokens, and only their SHA-256 hash is stored, so even a database leak can't open an invoice. Links can expire or be revoked without touching the invoice, and the public endpoints are rate-limited.
Accounts, email and a safety net.
Sign-in uses Better Auth (email and password, or Google) with sessions in the app's own Postgres database. Welcome, verification, password reset and "you got paid" emails go through the Delivrie API. Unit tests cover the money maths, payment verification and emails, scripts run the flow end to end on Stellar Testnet, and CI lints, type-checks, tests and builds every push.