RentGuard Turns the Security Deposit Fight Into a Chain of Custody
A four-stage evidence pipeline for the messiest argument in renting, built by one developer for the Indian rental market.
- RentGuard reframes the deposit dispute as an evidence problem rather than a negotiation problem: what did the apartment look like on move-in day, and can you prove it.
- Its four stages (DOCUMENT, TRACK, COMPARE, RESOLVE) all read and write the same case file, so a single photo gains evidentiary weight as it moves down the pipeline.
- The AI photo comparison runs as a separate sidecar service behind a shared secret, keeping the slow and failure-prone model work out of the deposit ledger.
- The code ships with a dev-mode role-switching path and unauthenticated uploads, a demo-first build that is one misconfigured environment variable away from privilege escalation.
The crack under the window
The crack under the window is always the one you forget to photograph. You move into a flat on a Tuesday afternoon, phone in hand, and you shoot forty photos before the boxes are unpacked. The kitchen counter. The balcony door. The inside of the wardrobe. You do not photograph the hairline crack under the window sill, because it is boring and you have a bed to assemble.
Eighteen months later you move out, and the landlord's invoice includes a line for wall damage near the window. The amount is real. Your memory of that crack is real too. But memory is not evidence, and neither is a text thread. The fight stops being about money and becomes a fight about what the apartment looked like on day one, which neither side can prove.
RentGuard starts from the premise that this is not a negotiation problem. It is a forensic evidence problem. Get the evidence right at move-in, and the negotiation at move-out gets shorter.
Four stages, one case file
The project organizes everything around four stages, and the README states them in order: DOCUMENT, TRACK, COMPARE, RESOLVE.
The detail that matters is that these are not four features bolted together. They are four phases of one record. The same move-in photo earns a condition rating in DOCUMENT, a timestamp and a maintenance history in TRACK, a diff result in COMPARE, and a deduction line item in RESOLVE. Nothing is discarded, and nothing lives in a separate app.
Document is the part everyone skips
Everyone takes photos. Almost nobody rates them. RentGuard's DOCUMENT stage asks for room-by-room move-in inspections where each photo carries a structured condition rating alongside it. That rating is what converts a camera roll into a record.
A photo of a wall is ambiguous. A photo of a wall rated as a minor scuff on a painted surface, north wall, is a data point you can hold against a claim eighteen months later. The rating is the part a landlord cannot shrug off, because it was written down before there was any argument to win.
Compare is where the AI earns its keep
The COMPARE stage is where the project stops being a photo album. RentGuard ships a second Node service, ai-service, that runs next to the main API and handles photo comparison and summarization. The backend talks to it over HTTP with a shared X-AI-Secret header.
Splitting it into a sidecar rather than a function inside the Express app is a deliberate call. Photo comparison is the slowest and most failure-prone operation in the product, and isolating it means a model timeout does not take the deposit ledger down with it. The AI is treated as a service, not a hard dependency.
The rest of the topology is conventional. A React SPA talks over HTTP to an Express API, which fans out to MongoDB, a local uploads directory for evidence files, and the AI service on its own port. The layering runs route to controller to service to model, with the business rules living in the service layer.
Resolve is an itemized bill of particulars
RESOLVE is where the legal framing turns literal. When a landlord proposes deductions, RentGuard records them as an itemized ledger. Every line item can be linked to the evidence that supports or disputes it, and every dispute is a first-class record with its own status.
There is a dedicated audit service and a dedicated evidence service. Status transitions are logged rather than overwritten, so a deposit's history stays readable. The system does not ask the tenant to win an argument. It asks the tenant to point at the record.
What RentGuard replaces
The first three columns all solve storage. Only the last one solves the argument.
| Google Photos album | Paper checklist | Spreadsheet | RentGuard | |
|---|---|---|---|---|
| Structured condition ratings | No | Yes, unsearchable | Yes, manual | Yes, per room |
| Move-in vs. move-out diff | Manual, by eye | Manual, by eye | Manual, by eye | Side-by-side, AI-assisted |
| Evidence linked to a deduction | No | No | No | Yes, per line item |
| Audit trail | No | No | No | Yes |
| Dispute record | No | No | No | Yes |
What the code actually does (and doesn't)
The architecture is candid about being a demo, and the unfinished parts are easy to spot. The CORS callback returns true in both branches, so the comment that promises strictness in production is a promise the code never keeps.
if (!origin || origin === env.clientUrl || origin === 'http://localhost:5173') {
callback(null, true);
} else {
callback(null, true); // Permissive in dev, strict in prod
}
More seriously, login accepts a role parameter and overwrites the account's stored role whenever isDev is true. Because isDev defaults to true when NODE_ENV is unset, a deployment that forgets a single environment variable turns a demo convenience into a privilege-escalation path.
if (role && user.role !== role && env.isDev) {
user.role = role;
await user.save();
}
Uploads are served from /uploads before any authentication middleware runs, so evidence photos are readable by anyone who has the URL. The filenames mix a timestamp with random bytes, which is obscurity, not access control. JWT_REFRESH_SECRET is defined but never used, and the API is mounted at both /api and /api/v1, so the versioning is cosmetic.
A case file for a market that needs one
The seed data uses Indian names and Bengaluru addresses, and deposits default to 84,000 in rupees. The two-role model, tenant and landlord, fits a market where deposits of several months' rent are standard and disputes are routine.
A production version would need signed upload URLs, real role-based access control, refresh tokens, and a login flow that does not trust the client to name its own role. But the mental model is already right. RentGuard treats the move-in inspection as the start of a chain of custody, and that is the part worth keeping.





