Last year I started planning a new site. It has been close to a decade since my portfolio site was built. The original site was done with Wordpress/JSON data and a homegrown htaccess/PHP router (more details here). I’ve learned a lot since then so I thought it was time for a rebuild to showcase those learnings.
Here are some of the original goals:
- ESM imports without a bundler (sans Webkit, Parcel, etc)
- Browser standard web components without a bundler
- WordPress REST API (maybe GraphQL layer?)
- Minimal SSR, maximal CSR (maybe Jamstack pattern?)
- Use my crusty old LAMP host (very affordable!)
Those are achievable goals but I was having trouble getting excited about building it. I think this is because it was essentially another iteration of the existing website: LAMP and Wordpress. Additionally, it was overly-complex. Using Wordpress/REST and all the others were goals simply to demonstrate that I could do them. They were overkill and a lot of effort overhead for the site’s intended purpose: to serve a handful of pages. Having worked in Node for the last several years, I was also not enthusiastic about going back to PHP.
Then I found Astro.
Pivot to Astro
A couple weeks ago, I caught a mention about Astro on a Fireship video. After a quick review of the Astro docs, my interest was piqued. Then a couple days later, Fireship released another video all about Astro’s 1.0 release and features. Armed with this quick explainer and a deeper dive into the docs, I found that Astro checked all the boxes on my wishlist for a multi-page app (MPA) project:
- Modularity: script, markup, style in one file
- File-based router: no configuration, just add a file
- Server-side JSX: JS expressions and JSX-style markup supported everywhere.
- Framework agnostic: use React, Angular, Lit, whatever you like
- Publish to static site or use the one of the SSR adapters
- Optimization by default: deferring render-blocking resources is simplified with Islands Architecture
The framework has a CLI wizard that makes it easy to get started quickly. I got this little blog spun up in just a few minutes. There’s still a lot of room for improvement that I’ll be working on in the comings weeks but it got me up and running real quick. So far the developer experience has been incredible and I’m looking forward to learning more about this promising framework.