My New Favorite Dev Stack

Over the years I’ve gone through a bunch of different development stacks from the ancient LAMP stack to Nginx and the LEMP stack and further into PERN (I’ll forgive you if you don’t know all these acronyms) and everything has to be chosen for whatever use case you’re trying to develop for. Sometimes, whats best for companies is different for personal developer projects because of cost, reliability, etc. Recently, I’ve been exploring something a bit different that I’m really excited about and I wanted to discuss this new stack to show what it’s capable of and explain why I’m using this for all of my personal projects at the moment.

The “Edge”

Edge computing is a relatively new phenomenon as it requries large server farms to partner with companies across the globe and well, that’s not easy! The idea is that servers are distributed and while they may have datacenters in specific locations partnering with ISP’s and things like that can enable data hosting from more local “nodes” than traditional hosting. The advantage to “edge” computing is that it reduces latency for some resources that can be cached near the user. This plays in to my thoughts that the best stack is static and offline first with some included data injected from a central source (backend, database) more like traditional desktop software than what one would think of as a traditional website.

Many cloud providers have reached global scale and are able to provide edge functionality in a way that’s transparent to the developers, for example uploading a static build of a website to S3 and using Cloudfront as a cache is a good way to have your website distributed via edge computing but we can also use this intentionally to our advantage to improve page speed for websites wether those websites are dynamic or static by keeping this in mind during the development process. In the age of “mono-repos” and SSR it’s hard to remember the benefits of building a truly separate and static frontend but this stack may be a good reason to think about what you really need - though SSR applications are supported the ideal move for speed is to minimize SSR usage for static frontends.

Cloudflare

I’ve never been one to shill for a company but I love what Cloudflare has been doing for developers in the past few years. First, adding Cloudflare Pages which was a fantastic way to deploy websites to the edge so that you can reach users with minimal latency for static builds but they have further improved upon this with Cloudflare Workers enabling whole new frameworks like Hono for the backend to exist. This has been a game changer for a few reasons but first and foremost is that it’s free to use for developers just building shit to send out to the world - eventually you will be charged though so monitize those projects! Not only do they give you free frontend and backend hosting but there’s also a free domain included (*.pages.dev) and everything is automatiaclly deployed across Cloudflare’s massive network of servers across the globe enabling edge computing automatically.

Ops & Integrations

The best part is that Cloudflare Workers allows you to deploy websites directly from Github with little to no configuration. You can simply link a repo and tell Cloudflare how to build your project and it takes it from there.

Here’s the build configuration for my main portfolio site:

You use the build command and build output directory the same as you would on a local build and suddenly you have a live edge build of your project with zero configuration. This works with npm, yarn and pnpm at least those are the one’s I’ve tested so far..

Topping it all off Cloudflare can automatically generate preview builds of your branches for you so when you’re testing a new feature you can see how it looks live with no extra config, cost or platforms in the mix. This may be the ultimate developer experience for solo devs just trying to publish things.

WebSockets

Recently, I’ve been working on a large and complex social media platform and I had a need to introduce WebSockets into my platform and I thought that I had found a use case that was outside of Cloudflare’s system but lo and behold Cloudflare has Durable Objects once again solving my problem with edge computing in mind.. In fact, Cloudflare has a whole host of services to sovle a lot of the more “dynamic” problems in-house and of course they do, they want you to pay for their services, but these are super easy to use and integrated into their systems in a way that makes sense and is easy to learn. In an era in which we are having to learn new platforms every day just to stay up to date this is a breath of fresh air for developers just trying to put their personal projects online and let’s be honest you need a whole degree just to navigate the services from AWS, GCP, etc.

Monorepos

A bit of a rant but as always, I advise against the new phenomenon of mono-repos and mono-stacks (ie. NextJS) I think it’s important to have separation and this is a good reason why - your backend doesn’t need to be distributed in the same way your frontend is but for the user experience it’s important that your frontend is dynamic and widely available. A well performing frontend that can display information regardless of backend availability is more user friendly. Having the ability to display an error message in your frontend while still making it available to the user is more user friendly than not displaying a page at all. While this is not directly tied to the topic at hand I think that separation helps with this type of infrastructure because if your frontend is a static build that can be distributed anywhere it opens up a lot more potential UX improvements than if your frontend and backend are intrinsically linked.

We spent a lot of time and effort to move away from SSR in the old days of PHP and now we’ve come full circle and this change was discussed as a fix for SEO but I don’t think that moving backwards 10 years is a “fix” for anything - we should figure out a way to do this that’s modern and works with our stacks instead.

Addendum

I’m not sponsored by or being paid by Cloudflare I just love their services. There’s no paid, sponsored or affiliate links here.. just my thoughts about this platform. I currently host 8 different projects between Cloudflare Workers and Pages including a large and complex social media platofrm that I mentioned earlier which includes frontend, backend and database components and all of them are currently hosted for free - auto deployed from Github and the only thing I have to worry about is making sure my builds pass before pushing (side note: you can solve this with Git hooks…) so I’m very happy with my experience thus far.

My main portfolio website is hosted in Cloudflare Pages and is a PWA React app with 99% page speed score - go ahead and check it out, it’s absurdly fast and a large part of that is the fantastic infrasturucture. Efficient programming can only get you so far if you’re dealing with a subpar infrastructure and I think us developers can all realte to using difficult services just to deploy simple projects that don’t make us any money.

There’s been a lot of discussion lately about cloud-agnostic software and using things like Docker to deploy images to several cloud providers too and while I think this is on the right track the ultimate cloud-agnostic build is a static website and a backend that’s designed to use a modern backend framework that’s supported on every platform. I’m not convinced that Docker is the answer to our thoughts of a truly cloud-agnostic platform but I also think that Docker serves to solve a mostly non-issue when developing new, modern platforms since we’ve always had the ability to configure machines to fit our needs the only thing Docker has done is introduce a new level of obscurity to our stack - if you learn Docker, you don’t have to learn sys-admin stuff sure but in reality you still do that just with Docker configs instead of software configs.

Maybe I’m just old and I don’t build things with the YC circlejerk in mind but let’s be honest with ourselves we’re not really solving problems we’re just introducing other problems and saying look! there’s a solution! when that solution is just a new way to explain the original problem.