# Status

Milestone 1 of 5. Nothing here is simulated: every screen reads and writes the real database.
Features not built yet are listed as such, not mocked.

## Milestone 1: tenant isolation, auth, permissions, deployment

| Area | State |
|---|---|
| Businesses, sites, users, memberships modelled explicitly | ✅ |
| Postgres row-level security on every tenant table; app connects as a non-owner role | ✅ tested (two businesses) |
| Composite foreign keys stop a record linking to another tenant's site | ✅ tested |
| `:businessId` from the browser authorized against memberships on every request (404 for non-members) | ✅ |
| Background jobs carry tenant ID and re-enter RLS context (domain verification worker) | ✅ |
| Sign-up creates business + owner + draft site with preview subdomain | ✅ |
| Password login (Argon2id), hashed session tokens, httpOnly/secure cookies, login throttling | ✅ |
| TOTP two-factor; required for platform admins and (default) owners/managers; replay protection | ✅ tested against RFC 6238 vectors |
| Roles: owner / manager / staff | ✅ (staff can view only) |
| CSRF protection (JSON-only + Origin check) | ✅ |
| Append-only audit log (app role cannot write or alter it) | ✅ |
| Secrets encrypted at rest (AES-256-GCM) | ✅ MFA seeds |
| Preview subdomains, custom domains with TXT verification, automatic HTTPS, unknown hosts refused | ✅ |
| Platform admin: overview, businesses (suspend/reactivate), audit log, system health | ✅ |
| Admin "Add a client site": creates business + draft site, invites owner by link (14-day, single use) | ✅ |
| One-command installer for cPanel/WHM VPS (Apache proxy + AutoSSL, auto-sync of new sites) and plain VPS (Caddy) | ✅ cPanel sync tested against a mock; first real run on your server |
| Client dashboard: products (exact cents/grams), branding, domains, publish | ✅ basic |
| Storefront: branded catalogue page by hostname | ✅ basic |
| Docker Compose + Caddy on one VPS; DB/Redis not exposed | ✅ |
| CI (tests on real Postgres) + SSH deploy with pre-deploy backup and health check | ✅ |
| Encrypted off-server backups, restore drill script | ✅ script; drill must be run on your server |
| File uploads / S3 media storage | ❌ Milestone 2 (logo is URL-only for now) |
| Staff invitations, password reset emails | ❌ Milestone 2 (needs email provider) |
| Database-level session cleanup job | ❌ small follow-up |

**Not yet verified end-to-end:** the code was written in an environment without
package-registry access, so the first full `pnpm install` + build happens in GitHub
Actions / on your server. The database migration and isolation tests, TOTP and money
parsing were run and pass. Expect a first round of small build fixes, which Claude
will make via pull requests.

## Still to come

**Milestone 2: storefront + billing.** Butcher-shop template with schema-validated page blocks,
revisions and preview/publish; product pages, cart, checkout, customer accounts, order
emails; Stripe Billing for client subscriptions (test mode first); Stripe Connect for
merchant payments; webhook event store with idempotency and reconciliation; media uploads.

**Milestone 3: plugins.** Typed plugin SDK, private registry, upload → isolated build →
compatibility checks → tests → approval → release, per-site plugin subscriptions billed
through Stripe, one reference plugin running on two unrelated sites.

**Milestone 4: meat workflows.** Farm-to-plate and bulk-meat presets, boxes, bulk packs,
preorders, delivery areas, pickup, lead times and cutoffs, packing lists and cut totals,
extension points (Build-a-Box, subscriptions, delivery runs, labels, wholesale).

**Milestone 5: hardening.** Security assessment, load test, timed restore drill, pilot onboarding.

Stripe will run in **test mode** until you confirm your Stripe account, Connect settings
and who carries refunds, chargebacks and tax.
