BuildMetrics AI
Moved a construction project-controls SaaS to Next.js 14 and made its heaviest workflows fast.
A construction project-controls SaaS had outgrown its React/Vite setup. The main dashboard was a single ~3,100-line component, large bill-of-quantities (BOQ) tables froze the browser, and data loaded through a chain of sequential queries.
Move the application boundary
Migrated 57 routes to Next.js 14 App Router, with Supabase SSR authentication and middleware. The server owns access checks before a protected screen renders.
57 routes → App Router → SSR auth → middleware
Make the dashboard understandable
Split the ~3,100-line dashboard into modular views, calculation services and export hooks. Enforced the API/data-access boundary with strict TypeScript and ESLint.
views → services → data access
↘ export hooks
Keep heavy work off the interface
Virtualized BOQ tables with TanStack React Virtual. Moved Excel and PDF processing into Web Workers so exports no longer compete with interface work on the main thread.
visible rows → virtual window
exports → worker → download
Retrieve data together
Replaced an O(N) Supabase query waterfall with consolidated server-side retrieval. The client requests the result in one round trip.
sequential requests → server retrieval → 1 round trip
Put limits around AI
Added grounded validation of AI-generated narratives and database-backed usage limits. Validation and account limits sit alongside the feature rather than relying on the prompt alone.
request → account limit → generation → validation
I would add repeatable performance budgets around the largest BOQ datasets and export paths, and trace server retrieval separately from rendering. That would make regressions visible before users encounter them, and provide measured timings for the next iteration.