erikras.com
HomeAbout

State Machines on the Edge

Remix Conf – Salt Lake City, Utah, USA – May 2022

Posted in Talks, XState, Remix, Finite State Machines
June 24, 2022 - 6 min read
State Machines on the Edge

When Remix was first announced, by the gentlemen behind React Router, I knew it was gonna rock...eventually. I figured they would need some time to work out the exact APIs. That it was released initially as a paid offering was all I needed to ignore it for a bit to let it mature. When it became open source several months later, my interest was piqued.

I've been using Next.js since it was in version 1.0. I fully understood all that it was doing for me, because I had extensive experience cobbling together such a site using Webpack, React Router, Express, Server Side Rendering, Hot Reloading, and all the hot new technologies in 2015. Even after authoring open source libraries used by millions of companies around the globe, React Redux Universal Hot Example remains my repository with more Github stars than any other. People are still starring it, despite all the cobwebs, as I have not touched it in six years. Every once in a while, someone will come up to me a conference and thank me for it, telling me that they built and launched and grew a startup using that starter kit. So I've been starting every project with Next.js and recommending that everyone do the same for years and years.

All that is to say that I was highly skeptical that any framework could come along and unseat my beloved Next.js from its pedestal. Nevertheless, I went through the Remix Tutorial – which is different (better) now than it was when I did it – to see what these Router boys were up to.

Within an hour, I was hooked. I will never start a project with Next.js again.

I've been building websites since all pages were static files. When it was discovered that you could execute code on the server – I ❤️ U /cgi-bin! – to dynamically change the HTML that was downloaded we were off to the races!

So I also come to Remix with a fundamental understanding of the ...errr... fundamentals of HTTP and how the web works. Seeing Remix embrace The Platform™ warms my heart. That said, I remember why we all moved away from The Platform™... because browsers sucked! But now that Internet Explorer is rotting in its grave, I think it might be just the right time to return to the fundamentals.

When Remix Conf 2022 was announced, I immediately began brainstorming ideas interesting enough to attract the attention of the Remix team. In my dayjob at Centered, I have been introducing XState state machines at every opportunity, and it invariably improves the codebase. There was even one particularly complex bit of backend logic, accepting a webhook from Linear, where I chose to implement it as a state machine, and, wouldn't you know it?, it improved the readability and robustness of the code. Remix is so elegant about how it does stuff on the backend, I began to wonder if I couldn't come up with some sort of an app to use a state machine on the backend using Remix. My previous talk was about using XState to implement an e-commerce checkout flow, so what if I could do that entirely on the backend?

Narrator: "He pulled it off."

I wrote the prototype entirely on a transatlantic flight in February, and shared the code with both the Remix and XState teams. My talk was sort of accepted at RemixConf. I was chosen as a backup speaker. This was a new concept to me, but it makes total sense. I was to have all the perks of a speaker, travel, expenses, hotel, etc., but rather than give my talk in front of the conference attendees, it would be to an empty auditorium the night before, and the talk would be released on YouTube with all the others, so future people wouldn't even know it was to an empty crowd. Great plan! I was just delighted to attend the conference!

As luck would have it, one of the speakers had some visa issues, and I was bumped up to give a talk in front of an audience. And it made all the difference! I've never given a talk with such an enthusiastic audience!

So, without further ado...

The Talk

The slides can be found here, and the code here, if you so desire.

Photos

The audience during my talkThe audience during my talk. I had the perfect slot, right before the morning coffee break.

View from the backThe view from the back. That's Kent C. Dodds' pink sleeve on the far left, furiously live tweeting.

Fisheye from the stageFisheye from the stage.

Heroes and friendsA few of my heroes that I now call friends, Tanner Linsley, Jenny Truong, Matt Pocock, David Khourshid, and Chance Strickland.

Michael Chan and Chance StricklandPhotogenic lads, Michael Chan and Chance Strickland.

Van SelfieWe morbidly joked about what a loss to the JavaScript community it would be if this van crashed.

Scooter CrewJohn Lindquist lent some scooters to Jenny Truong, Matt Pocock, David Khourshid, and me to ride around his neighborhood.

Smash BurgersJason Lengstorf taught me the meaning of "smash burgers", and my life will never be the same.

Salt Lake City – Aerial Shots

Flying into Salt Lake CityAs an East Coast boy whose never been to the rocky mountains, the terrain around Salt Lake City was gorgeous!

Salt LakeApparently they have a big – dare I say "great"? – lake of salt there.

Discuss on Twitter

© 2023 Erik Rasmussen