About this prototype
Built for TRUE Peak's evaluation (spec Section 9.4). It covers the four goals: sign-in with roles, two firms kept apart, photo upload to a cleaned PDF, and a client portal. All data is made up.
Working
- Sign-in with firm code, email and password, then a one-time 6-digit code. Show-password eye on the password field.
- Same generic error for unknown firm, unknown email, wrong password and locked account. Five wrong passwords lock the account for 15 minutes. Five wrong codes end the challenge. Codes expire after 10 minutes and work once; a new code cancels the old one; resends are limited to one a minute.
- Roles enforced on the server and in the database: owner sees every matter; attorney and paralegal only assigned matters; client only their own matters and only documents shared with them or sent by them.
- Two firms kept apart by PostgreSQL row-level security, forced on every table. The app connects as a role with no superuser and no BYPASSRLS. Firm, user and role are set per transaction from the server session.
- One email can have separate accounts at two firms (carlos.client@example.test) and each login sees only its own firm.
- Another firm's or another client's record ID returns the same "Not found" as an ID that does not exist.
- Sessions: 12-hour limit, 30-minute idle timeout, deactivated users lose access on the next request, "Sign out" ends this device, "Sign out of all devices" ends every session.
- Phone upload: take a photo or pick files (JPG, PNG, PDF). Each photo is checked right away for darkness, blur, glare, size and blank pages, with a retake prompt in English or Spanish.
- File type is decided from the file content, not the name. Limits: 25 MB per file, 50 pages and 300 MB per upload. Password-protected or broken PDFs are refused.
- Scan-style cleanup: orientation from the phone, straightening, crop to the page, shadow removal, white paper and dark text. Photos of scenes keep colour. Location and camera data are removed from the processed copy.
- Originals kept byte for byte with a SHA-256 fingerprint; the cleaned PDF is stored next to them. Pages can be reordered before sending.
- Duplicate warnings when a page was already uploaded to the same case or sent twice in one upload.
- Personal Injury HIPAA gate: until staff mark the authorization on file, a client can send only a photo ID, accident photos and invoices. Medical uploads get the exact message from the spec; the rejection is logged without the file contents.
- Uploads to a closed matter are refused. A repeated submission (double tap, retry after lost signal) returns the same document instead of a copy.
- Processing history with all nine steps per document. Staff can share or hide a document for the client and approve documents waiting for review.
- Audit log of sign-ins, failed passwords, views, downloads, uploads, rejected uploads and sharing changes. The app can add audit rows but cannot change or delete them.
- Per-firm branding (name and colour). Client screens in English and Spanish, chosen per person.
Simulated (clearly marked in the app)
- Two-step code delivery: shown in a "simulated inbox" box on the code page instead of a real email or text.
- Malware scanning (Microsoft Defender for Storage in Release 1).
- Text recognition and the searchable text layer (Azure AI Document Intelligence Read in Release 1), and therefore automatic category suggestion and the "page 2 of 5" missing-page check. The category is chosen by the person uploading.
- File storage is a local folder per firm, standing in for one Azure Blob container per firm.
Not in this prototype
- Microsoft Entra External ID (the prototype has its own password and code step with the same shape).
- Perspective (keystone) correction for photos taken at a steep angle (OpenCV in Release 1).
- iPhone HEIC photos are recognised and refused with a clear message; conversion comes in Release 1.
- Device limits, seat countdown, text messages, reminders, tasks, billing, calendar and everything else outside the four prototype goals.
- Processing runs inside the upload request. In Release 1 it runs in an Azure Function from a queue, with retries.
Third-party services and licences
- No paid service, external API or cloud resource is used. Everything runs on one machine: Node.js 22, a Next.js 16 front end, an Express 5 API and PostgreSQL 16.
- Open source libraries: next, react (MIT), pg (MIT), sharp (Apache-2.0; its libvips binary is LGPL-3.0), pdf-lib (MIT), zod (MIT), vitest (MIT, tests only).