Inspiration
Freelance work usually goes wrong in one of two places: nobody wrote down exactly what "done" means, or the money moved before anyone agreed the work was done. We wanted a tool where the terms are specific before work starts, the client's money is set aside for each milestone, and a person, not an algorithm, decides when it is released.
What it does
HoldFast is a milestone agreement workspace for a client and a freelancer.
- Draft and negotiate. The client drafts an agreement and the freelancer joins. Each side sets a private limit that the other never sees: the client's maximum budget and the freelancer's minimum price. One AI agent per party then negotiates. In our hosted run, the agents settled on $400 within both limits and turned two vague acceptance criteria into five testable ones, such as "no horizontal scroll at 375 px and 414 px" and "RSVP form with name and email fields."
- Sign. The agents only propose. Both people review and sign an immutable version of the terms.
- Authorize with PayPal. The client funds a milestone with a PayPal authorize-intent order, approved in PayPal sandbox. The money is reserved but not captured.
- Submit and review. The freelancer submits evidence: a description and a link. An AI reviewer fetches the link through an allowlisted fetcher, checks it against every signed criterion, and writes an advisory report. In our demo it correctly flagged that the linked page was a bakery page, not the agreed reading-night page, and recommended a revision.
- A human releases. Only an explicit client action, confirming the full amount, captures the authorization. Cancelling eligible work voids it. The AI can never release, block, or move money.
- Audit. Every agreement and payment event, with its PayPal order, authorization, and capture references, appears in a filterable, exportable ledger.
How we built it
- Next.js 16 (App Router, React 19, TypeScript) on Render, with PostgreSQL and Drizzle ORM.
- PayPal REST APIs (sandbox only): Orders v2 (create with
AUTHORIZEintent, get, authorize), Payments v2 (capture, void, get), OAuth, and verified webhooks. Every payment mutation sends a stablePayPal-Request-IdUUID, so a retry can never charge twice. - A durable payment worker in PostgreSQL (leases, heartbeats,
SKIP LOCKED). If PayPal's response is lost or uncertain, the operation is markedUNKNOWNand reconciled later with the same request ID. A pending or unknown capture is never shown as completed. - AI through OpenRouter (free model
nvidia/nemotron-3.5-super-vl:free), with Anthropic and Gemini as alternative providers and a replay mode that needs no key. Every AI answer must match a JSON Schema and is validated with Zod before it is saved. Malformed or truncated answers fail closed. A daily spend guard and a run log cover every call. - AG Grid for the audit ledger.
Challenges we ran into
- Behind Render's proxy, the app saw its own address as
localhost:10000, so PayPal's return redirect sent payers to an unreachable host. We now build all public URLs from a configuredAPP_URL. - PayPal sandbox currencies: an India-to-India sandbox buyer and merchant pair refused a USD payment. A US sandbox buyer worked.
- Free AI access: our Gemini key's Google Cloud project was not eligible for the free tier (HTTP 403). We added logging of the provider's error reason to find this, then added an OpenRouter provider. Its free reasoning model ran out of tokens on hidden reasoning, so we added reasoning headroom.
- Not overclaiming: authorization is not capture, and capture is not a payout. The UI and docs keep those states separate.
Accomplishments that we're proud of
- Real PayPal sandbox runs on the hosted app: authorize, capture, and void, with order, authorization, and capture IDs recorded in the repo.
- An AI reviewer that caught a mismatched deliverable on its own, while the release decision stayed with a person.
- Payment recovery that survives lost responses without double charging, covered by automated tests.
What we learned
Payment systems need explicit uncertain states, idempotency keys, and reconciliation, not just happy-path API calls. AI is most useful when its output is a validated proposal or an advisory report that a person acts on, never an automatic payment trigger.
What's next for HoldFast
Payouts to freelancers (PayPal Payouts), refunds and disputes, partial releases, and multi-milestone authorization renewal before the authorization expires.
Built With
- ag-grid
- drizzle-orm
- nextjs
- node.js
- nvidia-nemotron
- openrouter
- paypal
- paypal-orders-api
- paypal-payments-api
- paypal-webhooks
- pino
- postgresql
- react
- render
- typescript
- zod