BuildRight Contractors Portal
AI Session Handoff
Context document for starting a new AI coding session on this project
Last updated: 2026-07-12
Read this first when opening a new AI session for BuildRight. It contains everything needed to resume work without rediscovering context.
Current State
| Item | Value |
|---|---|
| Last Pushed Commit | ec6702c81726efb2c967be56c8267b281dd4ba13 |
| Branch | main |
| Repository | sonantechai/contractor-portal |
| Live URL | buildright.sonandigital.com |
| API URL | buildright-api.sonandigital.com |
| Status | All features deployed and working as of July 2026 |
Pending Work
All deployments current as of July 2026. There are no outstanding items at this time. The portal is feature-complete and live.
Key File Sizes (verify these haven't been truncated)
| File | Expected Lines | Notes |
|---|---|---|
worker/index.ts | ~462 | Contains admin CRUD, employees CRUD, employee login, /api/config with business_logo, auth |
src/components/PublicSite.tsx | ~198 | Hero with logo (left) + text/buttons (right), quote form, nav with Admin Login + Team Login |
src/components/AdminApp.tsx | ~209 | Admin portal shell, sidebar with all 11 modules including Team |
Architecture Reminders
- No Supabase — this project uses Cloudflare D1 (SQLite). All query results are flat arrays, no nested objects.
- Hash routing — empty hash = public site,
#login= admin login,#employee-login= employee login. No React Router. - Sign out =
window.location.reload()— drops all state, returns to public site. - Logo — stored as base64 in
settingstable under keybusiness_logo. Served via/api/config. No file storage service. - Amounts in cents —
labor_cents,material_centson jobs;total_centson estimates;amount_centson invoices. All integer fields. Divide by 100 for UI. - Employee PINs — 4 digits, hashed with PBKDF2-SHA256 (same salt as admin password). Never stored in plaintext.
Commit Rules (CRITICAL)
This repo is on a FUSE-mounted filesystem. Standard git add will silently corrupt large files. See CLAUDE.md at the repo root for the full FUSE-safe commit pattern. Summary:
- Write modified files to
/tmp(not the FUSE mount) - Hash from
/tmpusing Pythonsubprocess - Build trees with the Python
ls_tree/mktreehelpers (never shell printf/grep) - Parent commit must be the last pushed SHA (
ec6702c81726efb2c967be56c8267b281dd4ba13) — never use an intermediate failed commit - Update
.git/refs/heads/mainvia Python - User must push from Windows terminal (sandbox gets 403)
Deployment
npm run build— must run from Windows terminal (esbuild Windows binaries)wrangler deploy— must run from Windows terminal (sandbox 403)- D1 migrations: apply with
wrangler d1 execute contractor_db --file=migrations/0001_init.sql(already done for remote) - Cloudflare Pages auto-deploys when
mainbranch is pushed to GitHub