First post. I’m using this blog to document what I learn about Workers, and figured I’d start by writing about how I set it up.
I’m a backend dev with minimal frontend experience, but this whole thing took about 30 minutes from creating the repo to having it live on Workers. Honestly, writing this post took longer than the actual setup.
Workers recently added support for static sites through Workers Assets. For the framework, I went with Astro because a few coworkers use it and the docs are solid. It can handle React, Vue, Svelte, whatever you want, but I just needed something simple that builds to static files.
I didn’t want to build a blog theme from scratch, so I used a template. Run npm create astro@latest blog and pick “Use blog template” when it asks. Then npm run build generates everything into a dist directory.
To deploy, you need a wrangler.toml in the root of your project:
name = "my-new-blog"
compatibility_date = "2024-10-04"
compatibility_flags = ["nodejs_compat"]
[assets]
directory = "dist"
Then run npx wrangler deploy. Wrangler creates the worker, uploads your dist directory, and gives you a workers.dev URL. The whole thing is free.
That’s really all there is to it. Pick a framework, use a template if you don’t want to design anything, point wrangler at your build output, deploy. I’ll probably write more about customizing things as I go, but for now this gets you from zero to deployed blog in about 30 minutes.