Rodney Lab Newsletter — February 2023Rodney Lab Newsletter — February 2023
Font spacing
Font size
🚀 Pick of the Month — Astro 2.0 Hybrid Rendering #
Astro 2.0 finally dropped last month. My verdict: I like it! The two main new
features are Collections and Hybrid Rendering. I was most excited about
Hybrid Rendering. Static sites are faster, more secure and better suited to
content resources (blogs, documentation and so on). And it is in building
content sites that Astro shines. That said, even content-rich sites often
need some server interactivity. This was possible in Astro 1.0 but only by
switching from static generation to server rendering.
Hybrid Rendering lets you ride two horses at once! Let’s say you want to add a
comment form to your content site. With Astro 2.0 and Hybrid Rendering, you can
configure Astro to create an SSR app, but then add a prerender directive to
all your pages. This tells Astro to generate pages statically. Finally, you
create a server API route to listen for comment form submissions. That’s it
— a static site with server interactivity. The full
code for this example, using browser APIs and with added Cloudflare Turnstile bot detection, is on GitHub.
🧑🏽💻 Follower Feedback — GraphQL is still going Strong #
I have put together quite a few
GraphQL tutorials and demos over the last
couple of years. I’m surprised, even with the rise of tRPC that I still get
feedback from developers using these resources. Diving deeper, research seems to
point to GraphQL being chosen for more complex uses. Federation (unifying
diverse GraphQL sources into a single API access point) is such an example.
Another is apps with backends created outside the JavaScript ecosystem
(headless WordPress
is a great example here).
tRPC does have great ergonomics and helps you get started quicker
when your app doesn’t need those bells and whistles. A lot of engineers swear
by it!
If you want to show GraphQL a little love, here’s some tooling with recent
updates and a quick tutorial:
GraphQL Code Generator: generates
TypeScript types from a schema. Recently got persisted operations support.
Houdini: SvelteKit GraphQL client which
just got bumped to version 1.0.
Deno GraphQL Server:
tutorial from Deno on building your own GraphQL server.
Productivity —
Glow CLI Markdown previews: This
is a fantastic little tool for previewing Markdown files in the Terminal. As a
bonus, it also has a Vim plugin. I have tested it in
Neovide and it should work in other
Vim GUIs.
Services — Tinybird serverless Clickhouse:
with
Google retiring Universal Analytics
(UA), you might be looking at alternatives. Analysing site traffic in a
privacy respecting way helps you deliver what your audience is looking for. I
have heard good things about UA alternatives like
Fathom, Matomo,
Pirsch & Plausible. These all
offer a hosted service, and you can self-host some of them. Tinybird
is a little different here as it is serverless and they just handle the
data. You are free to create your own cookie and decide what data to
collect and push to Tinybird. On the serverless platform, you can create
data processing pipes and even serve the outputs from REST endpoints. I love
the customization potential here. However, if time is a constraint, try
their web analytics starter.
Resources —
Comprehensive Rust free Google Course:
A great Rust learning resource. It was originally created for Google Android
engineers, but is now open sourced and available to anyone. The course is in
mdBook format. You compile it locally
and can then run interactive exercises in the browser. You will appreciate
this course more if you already use the C++ language, as there are frequent
references to C++. This saves re-explaining concepts you are already
familiar with. You might still prefer
The Book if
your previous experience is in other languages.