# Connection plan — not implemented by this package

## Application boundaries

- One responsive site entry: server login resolves Creator, customer admin/supervisor, individual driver or shared market account.
- Creator manages customers, markets, customer admins and licensed features. Big Heavy retains its existing two workspace identities. Other customers start with one empty workspace.
- Admin/supervisor access is enforced on every server operation by company and allowed markets. Customers cannot add markets; Creator provisions them. Drivers never receive management endpoints or other customers' records.
- Individual driver login opens that driver's route directly. Shared market login permits a name choice in that market, but cannot prove who selected a name. Keep this risk explicit when deciding payroll access.

## Planned records

Company → workspace → market → people/equipment/stores/routes. Every operational record carries company, workspace and market IDs, not only a visible market number. Global user identity, scoped memberships and versioned sessions are separate from records. Feature entitlements must be enforced server-side, not just hidden in menus.

## Workflow contracts

| Action | Required online behavior |
| --- | --- |
| Submit Routes | Publish the selected schedule date, crew, FB/Box number, ordered stores/commingles, assigned stops, estimated miles, equipment and dispatcher notes. Re-submit updates the same route using a revision and idempotency key. |
| Complete Day | Validate assignment, driver role, all required values, vehicle and trip checks on the server. Upsert the same route/day completion, never create an extra paid day. No assignment means no completion endpoint permission. |
| Dashboard/reports | Consume the same canonical completion as scheduling. Recalculate totals without duplicate crew routes. Keep driver notes and dispatcher notes separately labeled. |
| Correction | Permit only the agreed current-day window before the next route takes over; enforce server time and concurrency. Retain prior values, actor, timestamp and reason/audit trail. Weekly recap remains read-only. |
| Helper | View assigned route and coworkers; no required end-of-day report. Driver assignment determines report duty. |
| Equipment request | Create pending Add Equipment Request or Equipment Request Change. Red management alert opens details; only approved changes update Fleet atomically, scoped to market. |
| Message Drivers | Send title/body only to selected markets/people. Recipient can read and delete their inbox copy, not everyone else's record. Route dispatcher notes stay separate. |
| Payroll override | Separate payable days and required explanation from scheduled/worked totals. Show red override, original amount, actor/time/note. Do not change route, stop or mileage totals. |
| Remember Me | Use revocable secure HttpOnly sessions; password resets and disabled access invalidate sessions. Never store a real plaintext password in local storage. |
| Recovery | Creator-only import, export, clear and history APIs; timestamped revisions and backups, restore preview, current-state safety backup and confirmation. No destructive action by visiting a URL. |

## Backend seam to replace

### Paid Driver Login & Phone App entitlement

Creator controls this independently for each customer. New customers default to off; Big Heavy retains its existing preview access. Off must hide admin Driver Access/password provisioning and reject driver login, route reads, daily submissions/corrections and equipment requests on the server, including direct URLs and previously remembered sessions. Turning it off must revoke existing driver sessions without disabling authorized management/manual entry. Turning it on permits scoped driver setup for Creator-provisioned markets; it does not grant customers permission to create additional markets. No automatic payment processor is connected: Creator sets the entitlement manually.

The local operational preview currently demonstrates this rule for Big Heavy only: hiding Driver Access, blocking the phone page and reacting to changes in another tab. Other companies remain separate configuration drafts until tenant authentication/data services are connected. Browser storage is not enforceable licensing or security.

The current management app's `window.bh`/preview API dispatch, driver local submission storage and Creator local configuration storage must become authenticated server requests to a single data service. Do not expose desktop IPC to browsers. Keep browser demonstration storage behind a development flag. Do not silently merge demonstration entries with imported operational records.

Suggested endpoint groups (design only): sessions, companies, memberships, markets, people, equipment, stores, routes/publish, completions, equipment-requests/decisions, messages/inboxes, payroll-adjustments, reports, imports, backups/restores and audit. Server derives tenant scope from the session and validates all client-supplied IDs; URL/query parameters never grant permissions.

## Launch gates

1. Choose hosting/database/object storage and approve costs; configure secrets outside shipped browser files.
2. Implement and test identity, role/market/tenant isolation, CSRF protection, rate limiting, session revocation and audit.
3. Wire each workflow above with transactions, revision checks and idempotency tests. Keep privileged data operations Creator-only.
4. Test safe desktop export/import on a disposable database, including relationships, missing market mappings and attachment counts. Never infer missing markets.
5. Test all six themes in light/dark, phone/tablet/desktop, readable dialogs and themed PDF output. Custom export retains every available metric; base report follows its screen layout.
6. Test restore, accidental deletion, duplicate submissions, offline/reconnect and two admins editing simultaneously.
7. Pilot with one iPhone, one Android and management browser before switching live work away from the desktop/sync folder.

The included LIVE-CONNECTION-REQUIREMENTS.md preserves the fuller agreed checklist. It is a requirements record, not proof that online behavior exists.
