Construye Hoy: daily site control for construction firms
Daily reports, GPS attendance, warehouse, schedule, cost control and a client portal, for small and mid-sized construction firms running several sites at once. One app serves the site manager, the warehouse, workers, subcontractors and the client, and a web panel serves owners and accounting. It is in development and not deployed yet. Everything shown here uses fictional data.
Progress
Change order
MessagesThe client portal, with a fictional firm and house.
How it is put together
- Apps
- Expo app with five roles, offline first
- Web panel for owners and accounting
- Server
- Hono API on Cloudflare Workers
- AI reading, invitations, 2FA, QR access
- Scheduled jobs
- Data
- PostgreSQL with row-level security
- Files and encrypted fields
The apps read and write the database directly with the user's own session, so row-level security decides what each person sees. The API only does what a user cannot do alone, and it uses elevated access only for those cases. Domain logic that every app needs lives in one shared package.
AI that proposes and waits for a person
- Photo or PDF
- Model fills a schema
- Totals are checked
- A person confirms
- Structured output, then arithmetic. Invoices and quantity take-offs come back as schema-validated data with a readability flag and a confidence per item. The invoice totals are then checked arithmetically, before anyone is asked to confirm.
- Documents are data, not instructions. The document goes to the model separately from the instruction, so text inside a PDF cannot act as an order.
- The cheaper model first. A fast model reads first, and a stronger one retries only when the result is unreadable. A truncated answer is not retried.
- Cost on every call, content on none. Every call, failed ones included, is logged with its model, tokens and computed cost, but not the document. Each company has a monthly quota, and an unknown model is charged at the highest rate.
- The provider is swappable. The model sits behind an interface, and without a key the app keeps working by hand.
The AI reading is built and tested, but it has not yet run against the live API, so there are no real cost figures yet.
The database is the security boundary
- Row-level security on every table. Owner and accounting roles only work after two-factor authentication.
- Money where few can see it. Amounts are stored as integers, and only in tables that site staff and clients cannot read. Supplier tax IDs are encrypted.
Tests
59 Vitest files with about 580 cases for the API, panel, app and shared logic, 42 pgTAP files for the database rules, and two end-to-end scripts that drive the app and the panel in Chrome, one of them with the network cut on purpose. Model answers are recorded, so no test calls the API: one feeds the real SDK a recorded response and checks the request and the computed cost. The CI workflow type-checks, starts a local database and runs all of them. The source is private, and I am happy to walk through it in an interview.