At build time, Astro parses the JSON array, generates static HTML files for all 500+ routes, and writes them straight to the disk.
Overcoming the Build-Time Bottleneck
When you generate hundreds of pages programmatically, asset optimization can slow down your builds significantly. Initially, my build times on Cloudflare Pages were dragging towards the 3-minute mark because of dynamic image optimization and massive CSS parsing per page.
I solved this by:
- Standardizing layout components to prevent style duplication.
- Relying on Tailwind's JIT compiler to keep the global CSS payload under 15kb.
- Pre-indexing the templates into a lightweight local JSON search index so users can query jobs instantaneously without a heavy search engine backend.
The result? The entire project builds in under 22 seconds, scores a perfect 100/100 on Lighthouse desktop performance, and serves instantly to users who just want to grab a template and apply for their next gig.
Check out the live site at mycoverletter.org and let me know what you think of the speed! I'd love to hear your feedback on the UI or how I can optimize the static build pipeline even further.
Top comments (0)