Platform admin dashboard
Mark-only operator UI for deploying and managing Lovely Home Hub sites (production, test, sandbox, future tenants). Not shown to household owners or Airbnb guests.
Architecture
| Piece | Location |
|---|---|
| Site registry | platform/sites.yaml |
| Live infra contract | terraform output -json sites |
| Built manifest | platform-admin/public/platform-manifest.json (merged from Terraform + registry; committed so CI builds preserve contracts when state is unavailable) |
| Admin UI | platform-admin/ — separate Vite app → dist-platform/ |
| Operator API | platform-admin/functions/api/ (Pages Functions) |
Household hub tablets use the main src/ app. Platform admin is a separate Pages project at platform.lovely-home.co.uk with its own Access app — operator email allowlist only. No Worker or HUB_API binding — API is functions/api/platform/ on the same repo.
Local development
npm run platform:manifest # merge sites.yaml + terraform output
npm run dev:platform # API on :8791, UI on :5174Open http://localhost:5174 — dev API skips Cloudflare Access (signs you in as PLATFORM_OPERATOR_EMAILS, default dev@localhost; local only).
Terraform + deploy
Site cards come from the manifest built at deploy time, not live data. The production build leaves out sandbox
e2e-*lifecycle hubs (#940); the sandbox platform builds its own scoped manifest. Cards for removed hubs disappear on the next platform admin deploy.
Enable in terraform/environments/hub.tfvars:
Operators are not set in tfvars: they come from the platform billing D1 (see Platform operators).
platform_admin = {
enabled = true
hostname = "platform.lovely-home.co.uk"
pages_name = "home-dashboard-platform"
}export CLOUDFLARE_API_TOKEN="..."
cd terraform && terraform apply -var-file=environments/hub.tfvarsCreates Pages (home-dashboard-platform), Access (operators only), and DNS — no Worker/D1/R2.
First deploy (includes Pages Functions staged into dist-platform/functions):
unset CLOUDFLARE_API_TOKEN
npx wrangler login
bash scripts/deploy-platform-admin.shGit-connected Production builds run npm run build:platform (Vite output plus scripts/prepare-platform-pages-functions.mjs, which writes dist-platform/functions without the hub-only api/[[path]].js catch-all and, on CI, prunes that route from repo-root /functions too so Cloudflare’s bundler does not pull in the hub Worker proxy). The manifest is committed in git; CI merges registry changes with preserved contracts when Terraform state is not present. After terraform apply, run npm run platform:manifest and commit the updated manifest (or use the deploy script locally).
Contract precedence. When terraform output -json sites is readable, it wins outright: a Terraform-managed site missing from it has been destroyed, so its committed contract is dropped rather than preserved (the build logs dropped stale contract for …). Contracts are only carried over from the committed manifest when Terraform output is unavailable — Pages git builds — or for sites with terraform: false, whose contract was imported by hand. platform-site-deprovision-reusable.yml opens a follow-up PR with the rebuilt manifest after a teardown, so a destroyed hub stops carrying D1/R2 ids in git.
Deploy only from a synced checkout. A local deploy rebuilds the manifest from your platform/sites.yaml, and because Terraform state lives in R2 (unreadable from a laptop) contracts are copied from the previous manifest rather than verified. Deploying from a checkout that predates a teardown therefore republishes the dead site, complete with an in state badge Terraform no longer backs. scripts/check-platform-registry-sync.mjs runs first and refuses when platform/sites.yaml or worker/wrangler.toml differ from origin/main; it skips in CI, and PLATFORM_DEPLOY_ALLOW_STALE=1 overrides it.
Pages env vars (Terraform-managed)
| Variable | Purpose |
|---|---|
CF_ACCESS_TEAM_DOMAIN | Zero Trust team slug |
CF_ACCESS_AUD_PAGES | Access app AUD for platform hostname |
PLATFORM_ACCESS_APP_ID | This platform's own Access app id. The Platform operators panel edits its "Platform operators" policy (#1214) |
PLATFORM_HEALTH_CF_ACCESS_CLIENT_ID | Access service token client ID (GitHub secret of the same name, via Terraform, #1223) |
PLATFORM_HEALTH_CF_ACCESS_CLIENT_SECRET | Access service token secret (GitHub secret of the same name, via Terraform, #1223) |
PLATFORM_CF_API_TOKEN | Optional — Cloudflare API token for D1/R2 usage, Pages preview toggles, and marketing OTP guests (Terraform platform_cf_api_token). Needs Access: Apps and Policies Edit for the marketing list |
PLATFORM_OPENAI_ADMIN_KEY | Optional — OpenAI Organization Admin key for Grafana OpenAI panels (platform_openai_admin_key). Set GitHub secret PLATFORM_OPENAI_ADMIN_KEY and run Platform admin Terraform — manual dashboard edits are overwritten on apply |
PLATFORM_CF_WORKERS_PLAN | free or paid — which Cloudflare limits to show in monitoring/usage (default in Terraform: paid) |
PLATFORM_CF_R2_PLAN | free or paid — whether R2 usage shows the 10 GB free cap or usage-only (default in Terraform: paid) |
CLOUDFLARE_ACCOUNT_ID | Cloudflare account ID (Terraform) |
MARKETING_SITE_ORIGIN | Marketing site origin (default https://lovely-home.co.uk) |
MARKETING_ACCESS_APP_ID | Access application id for the pre-launch marketing gate (set when marketing_site_access_protected is true) |
OPS_HANDBOOK_HOSTNAME | Ops handbook custom domain (default ops.lovely-home.co.uk) |
OPS_HANDBOOK_ACCESS_APP_ID | Access application id when ops_handbook_access_enabled is true |
MARKETING_MAINTENANCE_MODE | When true, blocks public signup, add-home, and account OTP on the marketing site (existing hubs unaffected). Usually toggled from Platform settings → Maintenance (D1); set via Terraform/hub.tfvars so apply does not drop the key |
MAINTENANCE_BYPASS_SECRET | Optional — ?maintenance_bypass= or X-Lovely-Maintenance-Bypass for sandbox testing during maintenance |
ACTIVATION_RUN_SECRET | Activation emails: shared with the hub-jobs daily cron; signs unsubscribe links (activation_run_secret). See activation-emails.md |
ACTIVATION_EMAILS_ENABLED | true to send setup-tip emails to owners who opted in (activation_emails_enabled, default off) |
ACTIVATION_EMAILS_TEST_TO | Sandbox: send every activation email to this inbox (activation_emails_test_to) |
Marketing maintenance toggle
On the Sites tab, open Platform settings → Maintenance (Cloudflare Access — platform operators only).
| Control | Effect |
|---|---|
| Enable maintenance | Persists marketing_maintenance_mode in platform D1 (platform_settings). Blocks /api/public/signup, add-home, and account OTP on lovely-home.co.uk |
| Disable maintenance | Clears the marketing gate for those flows |
| Env fallback | If D1 has no value yet, MARKETING_MAINTENANCE_MODE / PUBLIC_SIGNUP_MAINTENANCE on Pages applies |
| No form flash | The /signup and /account sign-in cards start hidden (data-maintenance-pending) until the maintenance check finishes, then show the form or the maintenance panel. A CSS fallback reveals them after 5 s if the check never returns (#971). |
| Operator bypass | Operators on the allowlist skip maintenance; optional MAINTENANCE_BYPASS_SECRET for QA |
| Signup page message | Optional heading and message (marketing_maintenance_title / marketing_maintenance_message in platform_settings), e.g. "New sign-ups open on 31 October" (#969). While maintenance is on, they replace the default title and lead on /signup and are returned by GET /api/public/maintenance and in the signup 503. They are plain text, shown as written (not translated), with a heading limit of 120 characters and a message limit of 600; a blank line starts a paragraph. Sign-in and add-home keep the standard text. Clearing both brings back the translated default. |
Does not block: existing *.lovely-hub.com hub tablets, active account sessions, or signed-in account plan checkout.
Health probes call each hub site's /api/health and /api/access-probe. Those URLs are Access-protected, so Terraform creates a service token (Lovely Home — platform health checks) on the platform Pages project and adds a non-identity policy for that token only on each Terraform-managed hub site's Pages + Worker Access apps (#1166). Other service tokens in the account, such as the Grafana / social insights token, can't get through a hub's Access. Customer hubs are a separate Terraform state, so the hub module finds the token by its client ID (GitHub secret PLATFORM_HEALTH_CF_ACCESS_CLIENT_ID, which generate-hub-tfvars.mjs passes as platform_health_client_id). It used to look the token up by name, but Cloudflare token names aren't unique: a second token with the same name failed every hub provision (#1203). The GitHub secrets PLATFORM_HEALTH_CF_ACCESS_CLIENT_ID / _SECRET are the source of truth (#1223). Hubs admit the token with that client ID, and Platform admin Terraform puts the same two values on platform Pages. The account has a second token with the same name, the one cloudflare_zero_trust_access_service_token.platform_health made. Platform Pages used to get that one, so after the 2026-10-26 17:27 apply every hub refused the platform: health probes failed, and Account → Stays and Cleaners couldn't reach any home. Nothing copies the Terraform-made token into the GitHub secrets any more. To replace the token, set both GitHub secrets to the new token, re-apply the hub stacks, then run Platform admin Terraform.
Grafana AI usage secrets: PLATFORM_CF_API_TOKEN and PLATFORM_OPENAI_ADMIN_KEY are both pushed from GitHub Actions secrets via generate-hub-tfvars.mjs. Each Platform admin Terraform apply replaces the entire Pages production env map — if either GitHub secret is empty on the runner, that key is removed from Pages (OpenAI can disappear while you only fixed Cloudflare, and vice versa). Set both secrets before every apply. Check slots: bash scripts/verify-platform-ai-usage-pages-env.sh. Full pre-apply list: Platform apply checklist.
Account → Stays, Cleaners or Billing say every home "couldn't be reached" (#1221): the live platform Functions have lost PLATFORM_SITE_ARCHIVE_SECRET, which every platform → hub call needs (Saved setups also says it is missing at runtime). Run Actions → Platform refresh archive secret (confirm refresh-archive-secret). It writes that one secret in place, redeploys platform production and waits until /api/public/account/status reports archiveSecretConfigured: true. No Terraform. An apply that changed the var's type from plain_text to secret_text left the runtime without it: the Cloudflare provider sends only the changed half of an env var. Platform admin Terraform now writes every env var the plan changed again whole, then redeploys and waits for the new deployment before it checks (#1364, see platform-terraform.md).
Rotating PLATFORM_CF_API_TOKEN: After updating the GitHub secret, re-run Platform admin Terraform and confirm the plan includes module.platform_admin[0].cloudflare_pages_project.admin will be updated (env vars). Terraform sends the new value without its type, which Cloudflare would store as plain_text; the workflow's Write changed platform Pages env vars whole step writes it again as secret_text with its value (#1364). If the plan only touches hub_jobs (or other resources) and not the Pages project, Terraform state already matches generated tfvars — the new token was not pushed to Cloudflare. Either the workflow ran before the GitHub secret saved, or the secret on the runner still matches state. Fix: update the secret in Cloudflare → Pages → home-dashboard-platform → Settings → Environment variables → Production (paste the token that passes verify-platform-workers-ai-graphql.sh), save, then Retry deployment on production. Do not terraform apply -replace the Pages project to force a rewrite — that destroys and recreates home-dashboard-platform (custom domain, deployments, signup, billing and Stripe webhooks). Set a single secret in place instead, e.g. node scripts/set-platform-pages-archive-secret.mjs (uses the Cloudflare API PATCH, one key only), or edit it in the dashboard. Functions only pick up new secret values after a production redeploy (node scripts/retry-platform-pages-production-deploy.mjs). If the latest production deployment was created after the apply started it already has the new values, so the script stops there (#1094). Otherwise it waits up to 3 minutes in total for a build in progress, and if Cloudflare keeps answering 304 Not Modified it prints a warning with the live deployment id instead of failing the workflow (#1092) — if that deployment predates the apply, the next platform deploy (any push to main) or a re-run picks up the new values.
After changing Terraform, run:
cd terraform && terraform apply -var-file=environments/hub.tfvars
bash scripts/deploy-platform-admin.sh # only if Functions/UI changedTerraform API token: needs Access: Service Tokens → Edit (in addition to Access: Apps and Policies) to create the health-check service token. Without it, apply fails with 1010 auth.forbidden on access/service_tokens.
v1 features
- Site list from registry + Terraform contract
- Per-site Worker health and Access probe (server-side fetch via Access service token)
- Provisioning checklist hints
- “Add a site” runbook links
v2
- Summary bar (site count, Terraform-managed count, health overview)
- Check all health + auto-check on load when service auth is configured
- Per-site status indicator (healthy / degraded / unhealthy)
- Cloudflare dashboard deep links (Pages, Worker, D1, Access apps)
- Copy-to-clipboard operator commands (Wrangler deploy, sync script)
- Live provisioning checklist updates from health probe results
- Direct Access probe link per site
- Check all usage / per-site Check usage — D1 database size and R2 bucket usage vs Cloudflare free-tier limits (10 GB R2, 5 GB D1 per account)
Monitoring tab
Monitoring aggregates a platform-wide snapshot in one request (GET /api/platform/monitoring/summary):
- Overview strip — site count, health breakdown, open Stripe subscriptions, account storage
- Cloudflare — month-to-date billable usage (Workers, R2, D1, etc. via Cloudflare Billable Usage API), account R2/D1 storage, D1 database count vs plan limit (10 on Workers Free, 50,000 on Workers Paid), R2 bucket / Worker script / Pages project inventory
- Third-party APIs — OS Places UPRN counts (hub-tracked +
OS_PLACES_USAGE_BASELINEfor pre-tracking usage), trial countdown (OS_PLACES_TRIAL_END,OS_PLACES_TRIAL_DAYS); official quota on OS Data Hub - Billing — Stripe mode, subscription counts by status
- Marketing & signup — homepage, pricing API, and signup status probes
- GitHub automation — recent
platform-site-manageworkflow runs - Hub health matrix — worker, HUB_API binding, and Access probe for every manifest site
- External dashboard links (Cloudflare, Stripe, GitHub Actions, marketing site)
Set PLATFORM_CF_API_TOKEN (Account Read, D1 Read, R2 Read, Workers Scripts Read, Account → Analytics Read, Pages Edit, Account → Billing → Read, Access: Apps and Policies Edit) and CLOUDFLARE_ACCOUNT_ID on the platform Pages project (platform_cf_api_token in Terraform). Storage usage is fetched when you click Check usage; the Monitoring tab shows invoice line items (Billable Usage API, daily sync) and Workers request counts (GraphQL Analytics, month to date). After changing the token or Terraform env vars, retry deployment on home-dashboard-platform. Verify with bash scripts/verify-platform-billing-env.sh. The same token updates the marketing-site OTP list and powers Workers AI usage on the Grafana AI usage dashboard (GET /api/platform/ai-usage).
Optional for OpenAI spend panels: set PLATFORM_OPENAI_ADMIN_KEY (OpenAI Organization Admin key — not a project key) via Terraform platform_openai_admin_key or the Pages secret, then redeploy platform. Claude usage stays a Grafana placeholder until a Team-org Admin key exists (Individual orgs cannot use Anthropic’s Usage Admin API without a paid Team upgrade).
Platform operators (#1214)
Platform operators can open this dashboard, the marketing site while its sign-in gate is on, and the ops handbook. They also get the daily sign-up alert (unless PUBLIC_SIGNUP_ALERT_EMAILS is set) and pass marketing maintenance.
The list is the platform_operators table of the platform billing database (platform/migrations/0026_platform_operators.sql), one per platform: lovely-home-platform-billing for production and lovely-home-platform-billing-sandbox for sandbox. Emails are never committed, and there is no GitHub secret for them any more.
On the page: Platform settings → Site access → Platform operators shows who has access, when they were added and by whom. Adding or removing someone saves the table and updates Cloudflare Access straight away: this app's "Platform operators" policy (via PLATFORM_ACCESS_APP_ID) and the marketing and ops handbook lists, which keep their guests. You can't remove yourself or the last operator. If Cloudflare fails half way, the panel says so; adding or removing again re-syncs, and so does the next Platform admin Terraform apply.
Terraform reads the same table. Platform admin Terraform and the Platform Terraform plan run node scripts/platform-operators.mjs production github-env before generating tfvars, and scripts/tf-platform.sh passes -var=platform_operator_emails=… from the table (sandbox included), so an apply never drops someone added on the page. An empty table stops Terraform instead of removing everyone's access.
Way back in: the Platform operators workflow (Actions → Platform operators) lists, adds or removes people when the page can't be used. Pick the database, the action and the email. It applies pending platform billing migrations first and refuses to remove the last operator. Access changes from the workflow reach Cloudflare on the next Platform admin Terraform apply. Locally: node scripts/platform-operators.mjs <production|sandbox> <list|add|remove> [email].
Hub activity (#1585)
The Hub activity tab (next to Sites) shows one row per hub (cards on a phone) saying whether the hub is being used. It loads when you open the tab; Refresh activity asks every hub again. It shows counts, yes/no and dates only. No names, emails, text, addresses, codes or passwords leave a hub. (It was on the Sites tab until #1587 moved it to its own tab.)
| Column | Where it comes from |
|---|---|
| Setup wizard | site_profile.onboardingComplete (no date is saved) |
| Guide pages edited / total | guide_topics; pages that share one saved time with 2 or more others are the starter batch and don't count as edited |
| Manuals, Wi-Fi, Contacts | appliance_manuals; hub_secrets.wifi_ssid; primary/secondary contact phone or email set |
| People | family emails (count) · home_providers (count) |
| Stays | sitter_stays not cancelled; upcoming = access still open |
| Share links | share_links count and summed opens |
| Ask Lottie | hub_questions in the last 30 days |
| Hub opens | hub_opens, last 30 days, by kind of visitor |
| Last change | newest saved time across guide pages, manuals, providers, stays, share links, hub secrets (not the hub's own session secrets) and the site profile. "(build)" means within an hour of the hub going live |
- Hub opens (#1585): the hub app calls
POST /api/hub/openonce per browser tab after it starts (src/api/hubOpenApi.js,sessionStorageflag). The Worker (worker/src/routes/hubOpenRoute.js) adds 1 tohub_opens (day, audience); the kind of visitor comes from the session (resolveRequestAudience), never the request. Days older than 90 are deleted on each count. Migrationworker/migrations/0020_hub_opens.sql, applied to every hub by Deploy (d1:migrate:all). Counts start from that deploy. - Read by
GET /api/platform/hub-activityon the platform (functions/api/platform/platformHubActivity.js), which asks every hub'sGET /api/platform/hub-activityat once (platform health service token + per-hub archive secret, 8 s timeout,worker/src/lib/hubActivity.js) and keeps only known count fields. A hub that has not been redeployed yet shows "Hub not updated yet". - Privacy page: "What we collect", lawful basis, retention (90 days) and Local storage say this.
Website questions (#1335)
Platform settings → Website questions lists what visitors asked Lottie, the helper on lovely-home.co.uk (#1334), over the last 90 days. Not in the help pages shows what the help pages are missing. In the help pages shows the help entry her search found, so a wrong match can be spotted. Lottie said shows her latest AI reply to that question (#1434), or "Help paragraph" when she showed the help text instead. Each list is grouped by the question's words (case ignored), with the most-asked questions first. Add missing answers to src/help/ and run npm run build:website-help; Lottie picks them up on the next website deploy.
- Saved by
POST /api/public/lottie-ask(functions/api/platform/platformLottieAsk.js, #1434): the question, whether the help pages cover it, the entry title, her AI reply, the language and the page path. No IP address, name or email is stored. Each client may send 30 an hour, counted insignup_attemptsunder a hashed key, the same as signup. - AI replies (#1434): the panel shows whether they are on and how many of today's 300 are used (UTC day, counted in
signup_attemptsaslottie-ai-day:site), with a button to turn them off or on (PUT /api/platform/site-questions/ai, saved asplatform_settings.lottie_ai_enabled). Off, or past a limit, Lottie shows the help paragraph instead. AI needs theAIbinding on the platform Pages project (production only) and platform billing migration0028. The binding is added byterraform_data.workers_ai_bindinginterraform/modules/platform_admin/pages.tf, which runsscripts/attach-platform-ai-binding.mjs: the Cloudflare provider'sai_bindingsneeds the old Constellationproject_id, and the Pages API rejects any value with 8000022 "Invalid project ID", so the script PATCHes{ "AI": {} }and checks it stuck. The project ignoresai_bindingsdrift for that reason. If AI replies never show and the panel says on, check the binding is still on the project's production settings in the dashboard. - Draft an answer (#1434): each question the help pages don't cover has a button that asks Workers AI for a help entry (title and 2 to 4 sentences) from the English help and today's prices (
POST /api/platform/site-questions/draft). It marks anything it can't know as[check: …]. Nothing is published: check it, then add it tosrc/help/. Drafts count towards the same 300 a day. - Read by
GET /api/platform/site-questions(behind Access). - Table
site_questions, migrationplatform/migrations/0027_site_questions.sql. Rows older than 90 days are deleted whenever a new question is saved. Apply the migration (the Platform operators workflow withlist, ornpm run migrate:platform-billing) on production and sandbox before the platform deploys this code.
Marketing site OTP list
While the pre-launch gate is on, Marketing site access on the dashboard lists who can OTP into lovely-home.co.uk. Use the OTP gate enabled toggle to make the marketing site public without a terraform apply (adds or removes a Cloudflare Access bypass policy). Turn it off again at public launch, or set marketing_site_access_protected = false in hub.tfvars when you next apply.
- Operators (see Platform operators) always stay on that list and cannot be removed here. They also reach this dashboard.
- Guests are extra emails you add on the panel. They can open the marketing site only.
Do not make a previewer a platform operator unless they should also open platform.lovely-home.co.uk.
Terraform ignores guest drift on the marketing Access app (lifecycle.ignore_changes = [policies]), so a later apply does not wipe emails added here. Operator changes on the Platform operators panel are written to this list straight away.
If the panel shows a Cloudflare 403, update platform_cf_api_token with Access: Apps and Policies Edit and re-apply.
v3 — site wizard
Multi-step wizard (Add site, Edit, Delete on each card) dispatches GitHub Actions platform-site-manage.yml, which:
- Patches
platform/sites.yaml,hub.tfvars.example,worker/wrangler.toml, andworker/package.json - Runs
terraform validateand registry tests - Opens a pull request
New customer hubs default to {site-id}.lovely-hub.com with zone_name: lovely-hub.com in the registry. Internal stacks (demo, sandbox, test) can use Internal platform site in step 1 to target *.lovely-home.co.uk instead.
After the PR merges:
- Automated:
platform-site-provision.ymlruns on push tomain(Terraform, Worker, Pages, manifest). See platform-provision.md for one-time R2 + secrets setup. - Manual retry: Provision on the site card in platform admin.
Deploy Worker on a card dispatches platform-site-deploy.yml (Worker only).
Enable automation
Set on the platform Pages project (via Terraform or dashboard):
| Variable | Purpose |
|---|---|
PLATFORM_GITHUB_TOKEN | GitHub PAT with contents:write, pull_requests:write, and actions:write |
Set this in two places with the same PAT value:
- Cloudflare Pages (platform admin) — env var so the wizard can dispatch workflows.
- GitHub → Settings → Secrets and variables → Actions — repo secret so
platform-site-manage.ymlcan open PRs. The defaultGITHUB_TOKENcannot create PRs unless you also enable Settings → Actions → General → Allow GitHub Actions to create and approve pull requests (PAT is simpler).
| PLATFORM_GITHUB_REPO | owner/repo (default from Terraform: {github_owner}/{github_repo}) |
In hub.tfvars (never commit the token):
platform_github_token = "ghp_..."Then terraform apply and redeploy platform admin if needed.
Auto-merge site PRs
Wizard PRs on platform/site-* branches are queued for auto-merge (squash) when required checks pass. If any check fails, the PR stays open.
platform-site-pr-automerge.yml enables auto-merge when the PR opens (with retries while GitHub registers check runs). It runs on pull_request_target (workflow from main only) for:
- Wizard PRs:
platform/site-*branch + Platform Admin body marker - Operator provision/deprovision follow-up PRs still auto-merge if opened
- Paid signup/cancel do not open those PRs —
platform-site-registry.ymlcommits overlays tomainthrough GitHub's API withPLATFORM_GITHUB_TOKEN, so GitHub signs them (signed-commits.md); allow that PAT to bypass the pull-request rule
Auto-merge is enabled before CI finishes; GitHub merges only after required checks pass.
Required one-time repo settings:
- Settings → General → Pull Requests → Allow auto-merge
- Settings → Branches → Branch protection rule for
main:- Require status checks to pass before merging
- Required checks:
test(CI) andvalidate(Terraform validate) - GitHub's auto-merge API does not work without branch protection and at least one required check
If branch protection requires approving reviews, auto-merge waits until someone approves (or add a ruleset exception for platform/site-* branches).
Production is protected — cannot be deleted from the wizard. Demo is also protected (protected: true in platform/sites.yaml) because the marketing site links to it for public previews. Import existing stacks with scripts/terraform-import-hub-site.sh.
v4 — automated provisioning
See platform-provision.md for remote Terraform state, GitHub secrets, and the full CI pipeline.
Needs attention (#1510)
A strip at the top of the sites view lists homes whose build gave up after every automatic attempt and homes that have waited more than ten minutes since their build was queued without going live, each with Retry build (the card's Provision action). It also says when the sign-up page is showing the slow-build banner and why. The data is hubBuilds on GET /api/platform/sites; the rules are in platform-provision.md → Build tracking and feedback. Nothing shows when every build is fine.
v5 — automated deprovision
Delete in the wizard opens a PR that removes the site from the registry. After merge, platform-site-deprovision.yml deletes the Worker, runs terraform destroy for that site's module (D1, R2, Pages, Access, DNS), refreshes the platform manifest, prunes local hub.tfvars when deprovision runs on your machine, and removes the site from HUB_PROXY_SECRETS_JSON in GitHub Actions when configured.
Billing status and suspend / resume (#844)
Each hub card shows a Billing line with:
- the status (Trial, Active, Past due, Canceled, Incomplete);
- the plan (Free, Lovely Home+, Multi Home 3 or 10, from the account plan when one is set);
- the trial end, "since" or "canceled" date;
- the owner email;
- a Stripe ↗ link to the customer in the dashboard for the active mode (test or live).
Access → Suspend… blocks the hub for everyone until you Resume it. Billing is not touched, so Stripe keeps charging as normal; use it for disputes or abuse.
- Recording: a reason is required and kept in
hub_suspensions(migration0025_hub_suspensions.sql) with who did it and when. It isn't shown to the owner. - The hub's notice: an optional message is shown on the hub. It defaults to "This hub is temporarily suspended. Please contact support@lovely-home.co.uk."
- Which hubs: any hub the admin shows, including ones known only from their billing row (the sandbox manifest is filtered, #978).
- How it reaches the hub: the platform sends the change over the health-auth channel (
POST /api/platform/suspension, archive secret) and records it only once the hub has accepted it. A hub on an older Worker answers 404; redeploy it first. - On the hub: every
/api/*call except health,/api/hub-platform,/api/hub-suspensionand/api/platform/*returns423 HUB_SUSPENDED. The app shows a full-screen notice at start-up and checks again every 5 minutes, so wall tablets pick up a suspend or resume. If storage can't be read, the hub stays open.
Related
- platform-terraform.md — site provisioning
- platform/sites.yaml — manifest
- website/README.md — marketing site Access gate