A CRM for a real-estate agency
One system for a residential sales and rentals agency: inquiries, listings, deals, compliance checks and commission, with staff’s own AI assistants held to the same permissions.
- Client
- A residential sales and rentals agency (not named)
- What we built
- CRM · deal tracking · compliance checks · commission · AI connector
- Stack
- Django · React · PostgreSQL · Celery
- Status
- In daily use
One record, inquiry to commission
The agency sells and rents homes. Its agents kept their own lists, the office kept a legacy desktop CRM, and deals, commission, monthly targets and agents’ documents each lived in their own spreadsheet. The same details were typed again at every step.
We replaced all of it with one system: inquiries, contacts, listings, buyers, deals, compliance checks, commission, people and reports. Every screen reads the same records, so an inquiry becomes a buyer, a deal and a commission split without anyone typing it twice. The rules the agency already followed, who approves what and in which order, are built into the system rather than remembered.
- ≈100 screens each with its own help guide
- 20,000+ automated tests run on every change
- ≈10 staff roles each with its own view and rights
- 5 months from the first commit to every deal in it
Source: the system’s source and its history, December 2026. Counts are rounded.
How a sale moves through it
Each step hands the next one a complete record, and each step that commits the agency waits for the person whose job it is.
- InquiryChecked against existing contacts, tied to its listing, and routed to an agent by fixed rules.
- MatchBuyers whose wishes fit a listing are found, with the reason for each match.
- OfferCaptured by the agent and accepted by a manager before the deal opens.
- ChecksEvery party on the deal is checked, with the evidence kept on file.
- Close and commissionThe deal moves through its stages in order, and commission is paid only after it closes.
No inquiry sent to a guess
Inquiries from the property portals arrive as leads. Each one is checked against the contacts already on file, so a returning buyer is not entered twice. It is tied to a listing only when the listing’s reference matches exactly, then assigned to an agent by the same fixed rules every time. When nothing matches exactly, the inquiry waits for a person rather than going to the wrong agent.
Area, budget (within 20 percent either way), bedrooms, bathrooms and whether the buyer wants to buy or rent all have to fit. Extras such as a garden only move a buyer up the list, and each match shows why it was made. Sending the listing to the buyers who fit is one step.
The deal file, start to close
Once a manager accepts an offer, the deal goes to the team that sees it through to closing. Its stages run in a fixed order, and the system refuses a change that would skip one, wherever the change comes from. File numbers are made automatically. The letters each deal needs come from templates the team edits themselves, with the parties and dates filled in. Deals that fall behind their dates go on a list of their own.
- A check for every party. Staff open an anti-money-laundering case for each buyer and seller on each deal, with a checklist and risk factors for that kind of party: a person, a company or another entity.
- Documents without the chasing. A client gets a single-use upload link that expires after seven days, instead of emailing copies around.
- Reports prepared for filing. Reports to the authorities are prepared by the system for a person to check and submit.
- A record that can’t be edited. Every check and every change is logged, and the log can’t be altered.
Commission in four steps
Commission used to be worked out in a monthly spreadsheet. Now it follows the deal. The agent submits the split, finance approves it, the principal authorizes it, and finance pays it, and only once the deal has closed. That order lives in one place in the code, so no screen, export or AI assistant can take a shortcut around it. A split is locked once it is signed off.
At month end the commission sheet comes out as a PDF or a spreadsheet, and payslips are made and emailed without anyone building them.
People, targets and reports
Two more spreadsheets went. Each agent’s contract, license and qualifications now sit on their record, marked valid, expiring, expired or missing, with reminders before anything lapses. Monthly targets are scored in the system: the figures are uploaded and matched to each agent, each agent confirms their own, and the month is locked.
Dashboards show the pipeline, cash flow, deals behind schedule and a leaderboard. Managers can only manage the people ranked below them, and commission is hidden from anyone whose role doesn’t need it.
AI that follows the same rules
A staff member can link a general-purpose AI assistant to the system with one sign-in. Every request it makes goes through the same permission checks as the screens, under that staff member’s account, so its view is exactly theirs. Access is read-only by default. An edit needs extra permission, shows a preview and waits for the person to confirm; only adding a note or a task happens at once. It cannot delete anything, and nothing it does sends a message to a client on its own. A set of ready-made workflows covers routine jobs.
The result
Staff were using the first parts within weeks of the first commit. About four months in, the legacy desktop system was switched off; about five months in, every deal ran in the new system. Records came across in stages, extracted, mapped, checked, loaded and reconciled. Every difference between the old data and the new had to be explained before the old system was retired, down to past commission.
The targets and agent-document spreadsheets are gone, payslips are made and emailed from the deals, and when something in the system is wrong, staff report it from the screen they are on. Each report becomes a tracked issue, with personal details taken out.
For engineersThe stack, permissions, the AI connector and releases
Stack. Django and Django REST framework on Python 3.12, a React and TypeScript front end built with Vite and Tailwind, PostgreSQL 16, and Celery with Redis for background work. It runs as its own deployment on cloud servers, with object storage and Cloudflare in front. Phones use the same web app, and every screen has a phone layout.
Permissions. Two core roles, about ten staff roles on top, and a ranked management ladder. Querysets are filtered on the server, whole modules can be switched off, and agents can’t export or print. Every write goes to an audit log, as do AI calls and sign-ins.
The AI connector. An MCP server that calls only the REST API, as the signed-in user, never the database, so the API’s permission checks are the only ones there are. Connection is by OAuth or a personal token. Tokens are read-only by default; writes need a write scope, deals and commission need their own scopes, and every edit previews before it commits, except adding a note or a task.
Releases. Every pull request runs linting, pytest, Vitest and a secret scan, and builds and health-checks the whole stack, on a self-hosted runner kept apart from any machine with client data. A merge deploys with migrations, a smoke test and automatic rollback. A weekly security run opens its own fixes as pull requests. More than 400 database migrations so far.
One system that the whole agency works in, where an inquiry becomes a deal and a commission payment without being typed twice, and every approval happens in the order the agency set.