A restricted fund tracker on AWS for a few dollars a month
A community charity running seven restricted grants closed its year and found two things in the same week. The youth project had spent £14,860 more than its grant, paid for by unrestricted money without anyone deciding it should be. The energy advice grant had £9,315 left over, and its agreement said unspent money goes back unless you ask before the grant period ends. The period had ended.

Key takeaways
- Restricted money may only be spent on the purpose it was given for. The records have to show it.
- Grant terms are dated rules: purpose, eligible costs, caps, period, reports and underspend.
- Every cost carries its fund, the rule version that allowed it and the evidence.
- A fund in deficit needs a decision on record, not a formula that absorbed it.
- Designed on AWS for about $4 a month.
The whole system on one page
Before any code, here is the shape of what we are designing.
- Security & identity
- Analytics
- People
Why this goes wrong in a charity that is otherwise well run
Because the grants arrive one at a time and the finance function does not. Each agreement is negotiated by whoever wrote the bid, it lands in a shared drive, and its terms live in that person’s head. The finance person, often part-time and shared across the whole charity, codes invoices to projects rather than to grants, and the gap between those two things is where the trouble starts.
A project is an activity. A grant is an agreement with a purpose, a budget, a period and a list of things it will not pay for. The same youth worker’s salary can be a perfectly good charge to one grant and an excluded one on another, and a nominal code called Youth cannot tell the two apart.
What runs (the inside)
- Grant rules. Each agreement and variation turned into dated terms: purpose, eligible costs, caps, period, reporting dates and underspend. Part 2.
- Coding. Every invoice and payroll line charged to a fund, with the rule that allowed it and the evidence behind it. Part 3.
- Shared costs. The worker split across three grants, the rent and the finance time, allocated on a basis that is stored and can be shown. Part 4.
- Balances and reports. Fund positions that cannot go below zero without a decision, and funder reports that trace to transactions. Part 5.
One charity, one year
In plain words
Grant agreements come in when a bid succeeds, and again whenever a funder agrees a change. Each is read once and turned into a set of rules with a start date: what the money is for, which categories of cost it will pay, what share of overheads it will carry, when the period ends, when reports are due and what happens to anything left over. A person approves those rules before any cost is tested against them.
Spend arrives as supplier invoices and a monthly payroll export. Each invoice is read, a fund and a cost category are proposed with a one-sentence reason, and the proposal is tested against the rules of the grant it names. A cost outside the grant’s period or outside its eligible categories is not charged to it, however much room its budget line has.
Costs that belong to more than one grant are shared on a basis that is recorded rather than assumed. The project worker’s salary is split by the hours on the timesheets, the rent by the floor area each project uses, and the finance time by headcount. The basis and the numbers behind it are stored with every allocation.
Fund balances are recomputed as costs are charged. A restricted fund heading below zero produces a question for a named person in the week it happens, and a grant heading for an underspend produces one while there is still time to ask the funder. Reports are built from the same records, so every line can be walked back to its evidence.
Design rules that shaped every decision
- Every cost charged to a restricted fund records the rule version that allowed it.
- Grant rules are dated. A variation starts a new version; it never edits the old one.
- Shared costs carry their basis and its numbers, not just a percentage.
- A restricted fund may not go below zero without a decision recorded against it.
- Underspend and reporting deadlines are dates in a calendar, not clauses in a PDF.
- Model output is a proposal. A person approves rules, and the finance lead posts the journals.
What it does not do
It does not keep the books. The accounting package stays the ledger, with its own nominal codes and its own year end. This system holds what the ledger cannot: the rules each grant imposes, the reason every cost landed on the fund it did, and the working behind every allocation. It produces journals for the finance lead to post.
It does not decide whether to cover an overspend. Moving unrestricted money into a restricted fund in deficit is a legitimate thing to do, and the SORP provides for it as a transfer between funds. It is also a decision about money that could have been spent elsewhere, and it belongs to the trustees. The system makes sure the question is asked and the answer is recorded; it does not answer it.
And it does not judge whether the charity’s work meets a grant’s purpose. Costs the terms do not clearly cover go to a person who knows the funder.
The next four posts walk through each piece: turning an agreement into rules, charging a cost to the right fund, sharing costs on a basis you can show, and closing a period without a deficit nobody decided on. One diagram per post, a cost breakdown, and an engineering reference at the end.
All posts