Inspiration

We were inspired by a simple problem: when people pool money, one person often ends up holding the funds,making decisions, and keeping the records. Everyone else has to trust that person. Almost everyone has been part of a group that pooled money: a trip with friends, a family budget, a charity fund,small team starting a business, even a marriage! Everyone pools funds, but quite often,one person ends up holding the money, deciding how it's spent, and keeping the records. Even when that person is honest, the rest of the group has to take their word for it. I wanted to build the tool I wished those collectives had: one where the rules are agreed up front, spending needs the collective's approval, and everyone can see the same record.

What it does

When a group pools money, everyone contributes but too often, one person ends up holding the money, making decisions, and keeping the records.

CoTreasury changes that.

It's a shared treasury where groups set their own spending rules, approve payments together, and see a clear record of what happens to their money.

Our AI Treasurer helps members understand their finances, check spending requests, and prepare transactions but it can't approve or move money on its own. People govern. PayPal processes the payments. The ledger keeps the record.

Add funds Members add funds to the pool with PayPal Checkout. The ledger counts a contribution only once PayPal confirms it.

  • Request a payout Members ask the group to pay for something, and the request goes to a vote. It needs the approvals the group's rules require (more for bigger amounts, new recipients or paying yourself), from fixed approvers or a random, hidden panel revealed after the vote.
  • Approved payouts Once a request has enough approvals, PayPal Payouts sends the money to an email address or phone number. The ledger records it once PayPal confirms it.
  • Ask the AI Treasurer Members ask questions in plain language, like "Can we afford a $1,400 deposit?" The AI checks the real balance and rules, then drafts the request for the member to submit.
  • Outside activity alerts CoTreasury compares the PayPal account's history with the ledger. Any money that moved outside CoTreasury is shown to the whole group.
  • Tamper-evident activity log Every action is recorded in order, each entry hash-chained to the one before it. Anyone can press Check integrity to confirm no past entry was changed.
  • Leaving and closing Members can leave, or the group can close the treasury, under the exit rules the group chose. Refunds are paid only once the group approves them.

How I built it

  • Next.js 16 (App Router) with TypeScript, Prisma and SQLite, hosted on Railway.
  • PayPal (sandbox):
    • Orders v2 and the JavaScript SDK v6 for contributions
    • Payouts for approved payouts, refunds and closing settlements
    • Webhooks with signature verification to confirm payments before the ledger counts them
    • Transaction Search to compare the PayPal account with the ledger and catch outside activity
  • AI: Claude (claude-opus-5-5) through the Anthropic SDK with tool use. The AI Treasurer has four tools: read the treasury state, check affordability, prepare a contribution, and draft a spending request. It can only read and draft. The server recalculates every amount and required approval from the ledger and the group's rules, and only people approve.
  • AG Grid powers the shared ledger: search, in/out filters, a running balance, a pinned totals row, CSV export and a receipt for each payment.
  • The activity log stores a SHA-256 hash of each entry plus the previous entry's hash.
  • I used Claude Code as a coding assistant throughout the build.

Challenges I faced

  • Who actually holds the money. A PayPal business account belongs to whoever registered it, not to the group, and nothing I build can stop the account holder from moving money directly in PayPal. So instead of claiming to prevent it, CoTreasury detects and exposes it: Transaction Search compares the account's history with the ledger and flags anything CoTreasury didn't initiate.
  • Matching PayPal's history to the ledger. A single payment funded from a bank shows up as more than one PayPal transaction, so I had to fold those together to avoid false alerts. Transaction Search also had to be enabled per app, and it only accepts certain date ranges.
  • Fair voting rules. Early on, one "no" ended a vote. I changed it so a request passes as soon as it has enough approvals, and fails only when it can no longer get them, while everyone still gets to vote.
  • Leaving with a refund. What if the group rejects someone's refund? The member stays a full member. If they take it up with PayPal, their share is held and can't be spent until PayPal decides, and they can't vote on group spending in the meantime.
  • Letting judges explore without stepping on each other. Each browser gets its own private copy of every demo. Demos let you switch between members; real treasuries are private, and people join only through invite links.
  • Keeping the AI honest and brief. Early replies over-explained and sometimes guessed at approval counts. I tightened the instructions so it answers only what was asked and quotes numbers from its tools.

What I learned

  • Tamper-evident is not tamper-proof. A hash chain makes changes detectable, but someone with database access could rewrite the whole chain. Being precise about what the system guarantees builds more trust than overclaiming.
  • AI is most useful as an assistant, not an authority. Giving it read and draft tools, and leaving approval to people and payment to PayPal, kept it helpful without letting it control the money.
  • PayPal's APIs cover the full money loop: collecting with Orders, paying out with Payouts, confirming with Webhooks, and auditing with Transaction Search.

What's next

Over time, CoTreasury gives groups something they've never had: a verifiable financial history they can take to a lender or grant-maker.

  • A financial track record for groups. Individuals can show a bank statement to get a loan or a grant. Cooperatives, savings groups and community funds usually can't, even after years of handling money responsibly. Because every payment in CoTreasury is confirmed by PayPal and every decision is logged, a group's history could become a verifiable record of its finances. With the right financial partners, that record could help groups apply for loans, grants and other financial support that today is only open to individuals and registered businesses.
  • Connect each group's own PayPal business account through PayPal's partner onboarding.
  • Publish the latest log hash outside CoTreasury so even a full database rewrite would be detectable.
  • Email notifications for votes and payments.
  • Connect each group's own PayPal business account through PayPal's partner onboarding.
  • Publish the latest log hash outside CoTreasury so even a full database rewrite would be detectable.
  • Email notifications for votes and payments.

Built With

  • ag-charts
  • ag-grid
  • anthropic
  • anthropic-sdk
  • claude
  • next-js
  • node.js
  • paypal
  • paypal-checkout
  • paypal-orders-api
  • paypal-payout
  • paypal-sandbox
  • paypal-transaction-search
  • paypal-webhooks
  • prisma
  • railway
  • react
  • sq-lite
  • tailwindcss
  • typescript
Share this project:

Updates

Submission history