Skip to content
View as agent
Workspace dashboard: portfolio totals, active deals grouped by fund with their review status, and the property mix

Problem

Underwriting a property deal starts with a pile of documents: a rent roll, a P&L, a balance sheet, a draw schedule, each in whatever format the last owner used. Someone reads them, retypes the numbers into a spreadsheet, and hopes every line item landed in the right bucket. It takes days, and a miscategorised line is invisible until it has already moved a decision.

Approach

You create a deal and drop the documents in, and each one is extracted separately. A model reads them, but it can only pick a category from a fixed list in the schema it answers in, and plain code checks the answer afterwards. Nothing reaches the underwriting model until a person approves each module, and once a month’s categories are approved every later month has to line up with them.

Deal onboarding: the source package, each category with a slot per month and bulk upload that reads months off the filenames

Architecture

Interface
React 19 and Vite with TanStack Router, ag-grid for every financial table, a shared component library, most of it built by my teammates
API
Express 5 on Prisma and Postgres, Better Auth sessions, one response envelope, Zod on every request body and query
Extraction
FastAPI and Inngest, single-shot Claude calls with categories picked from a fixed schema, pdfplumber and openpyxl for the parsing
Models
LibreOffice daemons recalculating the deal workbook, with versioned assumption scenarios
Chat
Per-deal agent over its own documents: Postgres full-text and pgvector fused with RRF, in-process ONNX embeddings, page-level citations
Access
Invite-only Microsoft sign-in, three-tier roles, tenant scope as a where clause on every deal read
Platform
ECS Fargate behind an ALB, RDS, S3 and CloudFront, secrets in Parameter Store, GitHub OIDC
Hardening
A KMS key per store and a permission boundary on every task role; WAF at the ALB and at CloudFront, GuardDuty, Security Hub, CloudTrail, Config and VPC flow logs defined in the Terraform and switched on per environment
Delivery
Trivy over the files and the secrets, a report-only Trivy pass over the Terraform, a harden-runner egress audit, every Action pinned to a commit SHA, a release-age floor on new packages, CODEOWNERS on the dependency files

Decisions

  • Starting again instead of patching the prototypeBuilding on the working proof of concept looked fast, but its structure would have cost more to adapt than to replace. I started from an empty repo, keeping its ideas and none of its code.
  • Categories come from a fixed listEarly versions asked the model for loose JSON and cleaned up after it. Category mapping now answers in a schema with a fixed list, so a line item can’t land in a category that doesn’t exist.
  • Cleaning document text before the promptRow labels are capped in length and count and stripped of control characters before the categorisation prompt, so a stranger’s file can’t slip in hidden text.
  • Nothing counts until a person approves itEach module is approved on its own, against its exported artifact. The first approved month locks the category mapping for every later upload, and recalculation after an edit runs with no model involved.
  • Two spreadsheet engines kept warmRecalculating the workbook means running LibreOffice, and a cold start per request hit the slowest step. Two daemons now start with the container and take work in turn, with a cold spawn as fallback.
A deal’s extracted draw schedule: budget against funding to date, read-only once the module is approved

Outcome

Over six months I led a team of four from an empty repo to a multi-tenant platform where a deal goes from raw documents to a recalculated model: five extraction modules with their own review and approval, versioned assumption scenarios, a per-deal chatbot that cites the page it read, and the AWS estate as code. Dev runs the whole pipeline end to end.

View as agent