Skip to content

Rewrite it in Fresh#10

Open
ethmarks wants to merge 37 commits intomainfrom
fresh-rewrite
Open

Rewrite it in Fresh#10
ethmarks wants to merge 37 commits intomainfrom
fresh-rewrite

Conversation

@ethmarks
Copy link
Owner

@ethmarks ethmarks commented Feb 4, 2026

This PR switches away from SvelteKit and rewrites the site in Fresh.

Background

Content updates are one of the biggest architectural factors of Blips. The data is stored in a remote CMS rather than a folder inside the repo, which complicates things significantly.

My initial strategy was to make Blips fetch and render all content at runtime on the client side. This had the advantage of being portable and very simple, but it came at the cost of long page load times.

Then, in #3, I re-architected Blips to use SSG and a webhook. This approach involved zero runtime logic and allowed for very very fast page load times, but it necessitated a complex webhook (with a GH PAT) and required rebuilding the entire site on each content update, which is complex.

I prototyped a solution in #8 using SvelteKit's adapter-auto for SSR, meaning the site would fetch and render the blip data on each request at runtime, but it would do so on the server-side. This approach isn't compatible with GitHub Pages, so I had to switch to Vercel. This solution worked well on paper and in testing, but eventually it became apparent that it had a significant drawback: cold starts. After periods of inactivity, Vercel would shut down the server to save resources and quickly spin up a new one once a new request was received. Unfortunately, "quickly" still meant that it took >5 seconds, which is far more than I'm ever willing to tolerate for load times of my sites.

So the things that I was unwilling to tolerate were:

  1. rendering the blips on the client side (moderately slow page load always + requires client JS)
  2. a webhook (complex and requires a GH PAT)
  3. cold starts (very slow page load sometimes)

Fresh & Deno Deploy

The solution that I found that fulfilled all three of these criteria was using the Fresh web framework and Deno Deploy.

Fresh is the SSR framework for Deno (as opposed to Node.js). I'd really enjoyed using Lume (the SSG framework for Deno) for ethmarks/posts, so I figured that Fresh was likely to also be good.

Deno Deploy is Deno Land Inc's hosting service. It has native support for the Deno runtime and Fresh (Vercel supports neither). Critically, Deno Deploy uses v8 isolates which can cold start in tens of milliseconds, whereas Vercel uses full VMs which take multiple seconds to spin up.

However, Fresh is not SvelteKit (citation needed), so I needed to rewrite the whole site from scratch. And that's what this PR does.

Notable Changes

This wasn't just a note-for-note translation of framework boilerplate, however. Here are a few specific changes I made.

  • I used the new ethmarks/common shared stylesheets and components instead of the old soon-to-be-deprecated stylesheets and components from ethmarks.github.io.
  • I used TSX for the SingleBlip component rather than Svelte
  • I switched to Day.js from date-fns for simplicity and better Deno support.
  • I switched to @deno/gfm from marked for better Deno support.
  • I removed the deploy.yml GitHub Action. Fresh is fundamentally incompatible with GitHub Pages, so there's no reason to have any logic pertaining to it as a deployment target. This means that the Sanity Webhook is no longer used and can be disabled.
  • I Decreased bundle size from 251.78kb gzipped (SvelteKit) to 205.71kb gzipped (Fresh), largely due to not shipping the Svelte runtime for hydration.

@ethmarks ethmarks mentioned this pull request Feb 4, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant