Rewriting johnholland.com.au
Taking a 2022 corporate site from SSH deploys, zero tests and no types to a typed, statically built, CSP-hardened site with quality checks before deploy in CI.
- Client
- John Holland
- My role
- Tech lead: devops, CI/CD, security
- Team
- Led the team at MoWorks
- Stack
- Astro, Solid, Strapi 5, AWS, Azure Kubernetes
The old site worked. It was a Next.js 12 app on Strapi 4, deployed over SSH, and when something went down we wouldn’t find out before the account manager.
The rewrite kept the content, fixed the structure and added safety net(s). I led the team as tech lead and built the Astro and Strapi 5 rewrite, the delivery pipeline and the security work myself.
The finished thing
Improvements
My team| Area | Before | After |
|---|---|---|
| Rendering | Next.js 12 server, GraphQL at runtime | Astro static build with Solid islands; SSR only for CMS preview |
| CMS | Strapi 4, MySQL, JavaScript | Strapi 5, PostgreSQL, TypeScript |
| API typing | Hand-written queries, no contract | OpenAPI spec, generated typed SDK, responses validated at build |
| Tests | 0 test files | Over 100: unit, end-to-end, visual, accessibility, Lighthouse CI |
| Search | Server round trip per query | Pagefind static index, no server |
| Deploy | Images copied to a server over SSH, long-lived AWS keys | S3 + CloudFront, atomic releases, GitHub OIDC |
| Security headers | Three basic headers, no Content-Security-Policy | Hash-based CSP, HSTS, Permissions-Policy, frame-ancestors |
| Tooling | Two Yarn projects side by side | pnpm + Turborepo, 2 apps and 18 shared packages |
Stats
Types as the foundational correctness standard
Mine- Strapi 5 Writes its own OpenAPI spec
- openapi.json CI fails if it is stale
- Typed client Generated, with precision by my library, never amended, patched or hand modified
- Astro, static Every response is checked at build time, a violation fails the build.
- S3 + CloudFront Switched live in one step
Validated client, for the build
Validates every response against the contract, a violation of the types fails the build, unlike SSR not the site.
Unchecked client, for the browser
Unfortunately the validator (typebox) wants to use eval, CSP doesn't allow that. This was the compromise, acceptable as the next layer, our e2e test suite, covers it.
Tools I published along the way
Mine@ryangreenup/strapi-typed-openapi-spec
Generates an OpenAPI spec with real types from a Strapi 5 app. It drives the typed SDK described above. Types are finer that other plugins and an OpenAPI spec is less commitment.
- v3.0.3 in this build
- GPL-3.0
@ryangreenup/strapi-instant-preview
Live preview of draft content in a split pane, so editors see a page in real time (waiting minutes for a deploy was never gonna fly).
- v1.0.0
@ryangreenup/strapi-draft-autosave
Autosaves drafts in the Strapi editor, with a snapshot to revert to.
- v1.0.0
A strict CSP that works with client-side navigation
MineThe default: a policy per page, in a meta tag
- Breaks when the client router swaps pages
- Cannot set frame-ancestors
The fix: one hashed policy sent as a header
- Hash every inline script in the built HTML
- No unsafe-inline and no unsafe-eval for scripts
- The build fails if the policy grows past 4 KB
- A third-party accessibility widget runs without unsafe-hashes
Security Report Summary
A+
| Site: | https://johnholland.com.au/ |
|---|---|
| Report Time: | |
| Headers: |
|
Content-Security-Policy: default-src 'self'; script-src 'self' 'sha256-0O7iB6zr...' 'sha256-1BvDVWLr...' [4 more hashes] 'wasm-unsafe-eval' [4 hosts]; object-src 'none'; base-uri 'self'; form-action 'self'; [...] frame-ancestors 'self'That’s the policy that gave the client an A+ (as johnholland.com.au was as of 23 Nov 2026). Two exceptions, but they don’t allow inline script: search compiles WebAssembly, which needs wasm-unsafe-eval, and styles still allow unsafe-inline.
Managing assets in CLI
MineRestoring about 32,000 cached images (1.9 GiB) before every build was something I wish I had considered earlier. This full build was a 3 week timeline and a week out from the try line we found it was 4 hours to build in CI and 12 minutes to restore assets from into CI
I was about to build a custom server (well I already had one laying around from
a previous client), fortunately s5cmd got that to 28 seconds.
The build itself takes about two minutes.
Atomic releases, no downtime during rollout
Each build uploads beside the live site, then one key points to the new one. A failed or cancelled run means the site stays live.
Redirects at the edge
Editors manage redirects in the CMS, the build pipeline ensures CloudFront gives out real 301s and 302s.
Builds that resume
A run stops itself if a new publish comes through, if it's before the job's time limit it saves it's cache and the images it encoded, so the next one picks up from there with the new content ready to roll.
No stored cloud keys
GitHub OIDC for every AWS step of the new pipeline, third-party actions pinned by commit SHA, secrets encrypted with SOPS.
Publish means rebuild
Publishing in the CMS triggers a rebuild by webhook. Editors don't know or care how it's deployed, nobody noticed thanks to the live preview
Reproducible on a laptop
One script runs the same build as CI from production content, a failed deploy is so much easier to work on locally when there's a directory of html files to look at.
The bar, written down as code
My team- ≥ 95 Performance
- 100 Accessibility
- 100 Best practices
- 100 SEO
- LCP largest paint
- ≤ 2.2 s
- FCP first paint
- ≤ 1.2 s
- TBT blocking time
- ≤ 50 ms
Lighthouse CI runs on four key pages in CI and a miss fails the check and the PR doesn’t merge. The test suite also covers:
- broken links
- duplicate IDs
- SEO metadata
- axe accessibility
- visual regressions
- 7 s build budget
One page type, built from bands
MineThis was where most of the work went, there is one component in both Astro and Strapi for a page. Everything is built by bands and the client (honestly the bloody account manager) now has full editorial capacity, a WYSIWYG site builder.
Here’s a mock up of the CMS page editor with the homepage loaded and mocked on the right. Drag it around and you too can experience the thrill of being in the marketing team!
We're up for the challenge of transforming lives
A model of the editor, rebuilt for this post. Nothing here is saved.
opening.herorenders asHero.astrotext.introrenders asIntroBand.astromedia.media-splitrenders asMediaSplitBand.astrotext.statsrenders asStatsBand.astromedia.text-imagerenders asCareersBand.astrofeatured.projectsrenders asProjectsBand.astrofeatured.followrenders asFollowBand.astro- Latest news (a page setting)
- Footer (site-wide)
Before: a schema per page
The old CMS had 43 one-off page types, just a fixed set of fields. A new layout involved a rebuild and frankly an input field of the same site behind a subdomain would have served better.
After: a page is a list
Editors stack bands and reorder them by dragging. The seven loaded above are sections 1 to 7 of the homepage anatomy below.
The renderer is a typed map
One dictionary maps the band to its section component. Add a band to the CMS without a component and the type check fails and no build.
Guard rails live in the schema
Limits such as 'three to six figures' and a maximum heading length stop a page breaking its own layout. There was too much flexibility at first tbh.
Nine sections, one scroll
<Layout><BlockRenderer blocks={page.blocks} />- 1Hero
<Hero headingId="hero-0" />Its image is also the page's share image. - 2Intro
<IntroBand headingId="intro-1" />Its lead is the fallback meta description. - 3Image and text
<MediaSplitBand headingId="media-split-2" /> - 4Statistics
<StatsBand headingId="stats-3" /> - 5Careers call to action
<CareersBand headingId="text-image-4" /> - 6Featured projects
<ProjectsBand headingId="projects-5" /> - 7Instagram feed
<FollowBand headingId="follow-6" />
<NewsBand tone={toneAfter(page.blocks)} />- 8Latest news
tone="brand" headingId="news-7"Not a band: rendered from page.news, in the opposite tone to the band above it.
<SiteFooter footer={site.footer} />- 9FooterFrom the layout, so every page gets the same one.
</Layout>Who did what
- The Astro and Strapi 5 rewrite
- The contract pipeline and the three npm packages
- Typed page bands and the renderer that maps them to sections
- The CSP and security-headers package
- CI/CD, releases and build caching
- Accessibility fixes and the monorepo setup
- An SEO and security audit tool
- The Strapi 4 to 5 upgrade and content-model redesign
- MySQL to PostgreSQL
- The Next.js 12 to 16 upgrade that motivated the rewrite
- Route contracts, tested against captured responses
- Design alignment and QA rounds with the client
What I can do for your site
Site audit
SEO and security headers, crawled read-only from your sitemap. You don't just get a checklist and a page inventory. You get a dashboard (a nice fast solid.js one too!)
CMS Overhaul
I can do Strapi 4 to 5, but i'll tell you why you should just use Figma's Payload CMS. If you must have Strapi you'll get it with a typed client.
Performance budgets
If it's not over 95 on Lighthouse thresholds somethings wrong. This runs in CI, so nothing on the dev side can slow down your site.
CI/CD hardening
No stored cloud keys, atomic releases, a strict CSP, and caches that are faster than the build.
Got a large site that needs a quality build?
I take builds like this one from first commit to production.