Cloud Admin Refactor Notes
This refactor split the Harbor Cloud Admin app into smaller modules without intentionally changing user-facing behavior or the generated `dist/site` output shape.
Summary
This refactor split the Harbor Cloud Admin app into smaller modules without intentionally changing user-facing behavior or the generated dist/site output shape.
The main goals were:
- reduce the giant browser controller entrypoint
- separate support-console logic from theme-workbench logic
- separate static-site rendering from the build bootstrap
- remove unused React/TSX baggage from a non-React app
What moved where
Browser app modules
- now only boots the browser app
- main browser bootstrap
- admin/session/theme payload types
- shared mutable runtime state
- cloud API and session-storage config
- token storage and authenticated request wrapper
- DOM helpers, feedback helpers, view switching, and generic formatting
- support-console rendering, lookup flows, overrides, notifications, auth/session handling, and password changes
- theme palette generation, preview rendering, theme load/save flow, and theme form binding
apps/cloud-admin/src/admin-client.tsapps/cloud-admin/src/admin/main.tsapps/cloud-admin/src/admin/types.tsapps/cloud-admin/src/admin/state.tsapps/cloud-admin/src/admin/config.tsapps/cloud-admin/src/admin/api.tsapps/cloud-admin/src/admin/dom.tsapps/cloud-admin/src/admin/supportConsole.tsapps/cloud-admin/src/admin/theme.ts
Shared app helpers
- shared font option metadata used by both the browser theme editor and the static site builder
apps/cloud-admin/src/shared/themeTypography.ts
Static site builder
- now only boots the static site build
- file-copy/build orchestration
- shared HTML shell and CSS
- page body markup
- now stores website contact submissions and exposes them to the Cloud Admin support console
apps/cloud-admin/src/build-site.tsapps/cloud-admin/src/site/buildSite.tsapps/cloud-admin/src/site/renderLayout.tsapps/cloud-admin/src/site/renderBody.tsapps/cloud-api
Intentional deviations
- The app still uses direct DOM updates rather than moving to a framework. This refactor keeps the current rendering model and focuses on structure, not a technology change.
supportConsole.tsis still a fairly large module because the account/enrollment/admin workflows are tightly related and share runtime state.renderLayout.tsremains sizable because the static site CSS is intentionally kept colocated with the generated admin shell for now.- Contact submissions currently land in the support inbox as stored records only.
HARBOR_CONTACT_SEND_EMAIL=falsekeeps local testing database-only for now.
Optimizations included
- Removed unused
reactand@types/reactdependencies fromapps/cloud-admin/package.json. - Removed the unused JSX compiler setting from
apps/cloud-admin/tsconfig.json. - Eliminated duplicated font option definitions by sharing them between the builder and the theme editor.
- Added a support-console contact inbox fed by
cloud_contact_submissions. - Added shared corporate sitemap links so Cloud Admin, Website, and Docs move like one family of Harbor surfaces.
Remaining follow-up
- If Cloud Admin grows substantially again, split
supportConsole.tsinto render and action modules. - Consider moving repeated static-site CSS patterns into shared theme/layout helpers if Website and Docs need the same treatment next.
- If the public/admin static surfaces converge further, extract more cross-site builder helpers after refactoring
websiteanddocs-site.
Validation
pnpm --filter @harbor/cloud-admin typecheckpnpm --filter @harbor/cloud-admin build