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

ItemValue
Last Pushed Commitec6702c81726efb2c967be56c8267b281dd4ba13
Branchmain
Repositorysonantechai/contractor-portal
Live URLbuildright.sonandigital.com
API URLbuildright-api.sonandigital.com
StatusAll 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)

FileExpected LinesNotes
worker/index.ts~462Contains admin CRUD, employees CRUD, employee login, /api/config with business_logo, auth
src/components/PublicSite.tsx~198Hero with logo (left) + text/buttons (right), quote form, nav with Admin Login + Team Login
src/components/AdminApp.tsx~209Admin 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 settings table under key business_logo. Served via /api/config. No file storage service.
  • Amounts in centslabor_cents, material_cents on jobs; total_cents on estimates; amount_cents on 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:

  1. Write modified files to /tmp (not the FUSE mount)
  2. Hash from /tmp using Python subprocess
  3. Build trees with the Python ls_tree/mktree helpers (never shell printf/grep)
  4. Parent commit must be the last pushed SHA (ec6702c81726efb2c967be56c8267b281dd4ba13) — never use an intermediate failed commit
  5. Update .git/refs/heads/main via Python
  6. 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 main branch is pushed to GitHub