Taming Phoenix (Framework)'s Wild West amid the crippling indifference of Lockdown San Francisco
Tags: elixir, phoenixframework, oldproblemsnewlanguages, depression
Published: 2021-09-15 19:54:31

<small><em>Skip ahead to <strong>[the part about software](#the-code-parts)</strong></em></small>

The pandemic gave all of us trials we never expected to face. For some, [going to bed became an uncomfortable, surreal struggle](https://www.nationalgeographic.com/science/article/coronavirus-pandemic-is-giving-people-vivid-unusual-dreams-here-is-why), while others had a hard time [leaving bed completely behind](https://www.theverge.com/tldr/2020/12/14/22174641/pajama-suit-jacket-zoom-meeting-comfort-aoki) once they had to start their day. Everyone got [lonelier](https://mcc.gse.harvard.edu/reports/loneliness-in-america) (in the U.S., at least), and some people [confused small pieces of cloth over their mouth for threats to democracy](https://theconversation.com/face-mask-rules-do-they-really-violate-personal-liberty-143634). Then many of those same people [threatened democracy](https://en.wikipedia.org/wiki/2021_storming_of_the_United_States_Capitol). And, of course, all of this happened against the backdrop of [a lot of people getting sick and dying](https://www.google.com/search?q=covid-19), both of which make it _really_ tough to grease the wheels of Industry by throwing ourselves onto the gears[^orsomething].

[^orsomething]: I think that's how that expression goes.

<a name="lucky-me"></a>But I was one of the lucky ones. A person who, even before to the pandemic, had weird dreams aplenty, and no reason to put on pants in the morning; who could distinguish between a public health precaution and an attempted violent overthrow of a peacefully-elected government; who had known loneliness ever since childhood and therefore regarded all of this sheltering-in-place as just another snow day. Most importantly, of course, was the fact that I did not succumb to the horrible illness ravaging the planet. So everything was golden and there were no problems.

_**Or weren't there?**_ As it turns out, having the most significant events of my life in 2019 be that my best friend abandoned me over a misunderstanding on Independence Day; a company whose work I really believed in fired me in my first 10 days there (and a week before my birthday); another company — who made their offer (for more money) before the first job had even made theirs, and were gracious enough to hold the offer open for me — fired me in my first 3 months there (and a week before Christmas)[^yup]; and the few spokes of my support system being flung near and far around the world, meant that I spent all of 2020 and a few months of 2021 wrestling with the towering impression that… maybe the people most important to me, and so many colleagues, could so easily discard me because I truly was worthless, and discardable, to anyone and everyone, and that was how I would always be.

[^yup]: eeeeeyup. Not long stories, but ... not for here, not right now.

It wasn't at all helpful, either — while people would tell me the usual unemployment insurance requirement of looking for work was suspended in light of the fact that, well, nobody could go look for work, and then later that the unemployment office was offering additional financial support to every unemployed person regardless of circumstance — that despite filing for unemployment _well_ into the throes of the pandemic, my benefits were still bound by the unsympathetic, mechanically-administered requirement of, yes, being able to prove I was looking for work, amid shelter-in-place mandates. I have no idea how much unemployment I was even awarded; I only know that I never received any of it. I was disposable, not only to the first real friend I'd made in the five years I'd been living in the Bay Area, and to both of the companies I'd worked for since mid-2018, but to _California itself._ It felt like I was being told, "You're emotionally devastated, and unsure of whether you even have any redeeming qualities? Well Tough. If you can't muster the energy and nerve to jump through hoops nobody else is being asked to jump through, then maybe you _deserve_ to be going through debilitating emotional devastation."

<a name="the-code-parts"></a> Being a huge gamer, my first reaction was to bury myself in the quick satisfaction of challenge-reward loops and cleanly-packed, fully resolved internal narratives that only a PS4 and Nintendo Switch could provide[^games]. Being a programmer, my _second_ reaction was to start putting together a business I could build, scale, and maintain by myself.

[^games]: If you've never played _Dragon Quest XI_, _Persona 5_ (base or _Royale_), _Watch Dogs 2_, or _Assassin's Creed_ either _Odyssey_ or _Valhalla_ … definitely don't start playing any of them during the long, dark night of your soul.

And having those three goals – short feature turnaround as complexity increases, graceful (and inexpensive) scaling as the user base grows, and low maintenance and upkeep requirements as its usage ramps up – meant that I might not want to remain in my typical, Ruby on Rails, wheelhouse. A maverick doesn't _need_ vibrant communities gathered around tried and true frameworks with incomparable stores of ready-built solutions to the implementation questions I might face.[^1]

These goals would **actually** be best achieved by building my app in Elixir[^2] and the Phoenix Framework![^3]

_**Or would they actually?**_ As it further turns out, having little to no guidance through the deep processes that are revealed by not-working-in-Rails has given me firsthand appreciation of just how mountainous, jutting, and craggy the terrain really is underneath the leveled-out, perfectly-trimmed lawn that not-not-working-in-Rails provides developers. In my comfy Rails homestead, questions like _"How should I integrate with Github?"_, *"What do I do to verify a webhook payload's signature?"*, and *"OAuth?"* weren't a matter of digging through reams of esoteric API documentation, and weren't even a matter of digging through one gem's esoteric readme, but were usually a matter of deciding _which_ gem sparkled brightest amid Rubygems.org's gleaming sea of options; each one eager for recognition, praise, and also, possibly, donations in order to help sustain the developer's basic need for survival idk.[^hahaha]

[^hahaha]: please donate to me [via Ko-fi](#donate-plz-hahaha)!

But dagnabbit, I've come this far with my ErlangVM-powered, stubborn, sometimes completely inscrutable functional programming workhorse. I'll be darned if I'm gonna let a little wandering through the desert as I'm dying of thirst make me turn around and reach for Ruby's object oriented, rocket-propelled horseless carriage, that's as configurable, simple, and easy to use as a LEGO playset with thorough, highly detailed instructions and examples. LEGO blocks are _toys._ I'm not building a _toy,_ I'm building a _robust, self-healing, high-uptime **software application as a service**_ (SAAaS)! User authentication is **better** when it takes you two weeks to implement!

But since I did have to figure out so much of this process through my own research, struggle, and persistent reiteration, I figure there might be other people out there, foolhardy enough to say "Maybe my next project would be a good fit for Elixir/Phoenix 🤔." You may be right, you beautiful dreamer, and to help you through some of the rough parts you might encounter, I'm gonna go ahead and tell you how I've been forging my trail. If it helps you cut your own path through this rugged, recursive frontier, then I've made a difference.

You can expect this series to receive regular[^4] updates about the snags, slowdowns, and showstoppers I've pushed through on my way to building a SAAaS[^5] on Phoenix in Elixir. That being said, if you felt concerned at all for my livelihood from reading [that section I let you skip over](#lucky-me), or if you find yourself appreciating the writing style of these tutorials, any amount you could <a  href='https://ko-fi.com/Z8Z55L1K8' target='_blank' rel="noreferrer noopener">donate to me through Ko-Fi</a> would make you an honest lifesaver. I'm working on launching my business as fast as I can, but if I want to see it become profitable, first I need to be able to keep my head above water as rent, utilities, internet, phone, food costs, unforeseen expenses, the student loans I'm still repaying a decade later, and (last, but only second to rent in being the farthest thing from "least") interest on repayments all threaten to drown me.

In the meanwhile, soon I'll be publishing my first tutorial in this series, "Taming Github OAuth integrations with Überauth and Guardian (but then actually no just Überauth)", and ~~will update this post with a link as soon as~~ that went up fast! [Read it here](https://dev.to/thepeoplesbourgeois/taming-github-oauth-integrations-in-phoenix-with-the-help-of-uberauth-and-guardian-but-then-actually-no-just-uberauth-2ec6).

<figure align="center">
<a rel="noopener noreferrer" href="https://ko-fi.com/Z8Z55L1K8" name="donate-plz-hahaha" target="_blank"><img alt="Donate to me through Ko-Fi, and be proud that you're keeping me alive" src="https://dev-to-uploads.s3.amazonaws.com/uploads/articles/oib0eopqcc8ch17eacw5.png" referrerpolicy="no-referrer"></a>
  <figcaption>Being alive is nice!</figcaption>
</figure>

[^1]: I would, of course, later come to question and regret my decision to eschew ready-built solutions to the implementation questions I have faced

[^2]: Elixir is a great language on a great runtime, and once I have a production server up and running, I'm sure I will discover just **how** great.

[^3]: Phoenix is similarly a great framework, but as I have learned, and as you will come to find, it suffers from both a substantial gap between features it provides and features you have to find for yourself, as well as a substantial gap between documentation that's quickly referencable and provides the answers you're looking for, and the documentation that it has. That's not to deride Phoenix or its documentation; explaining a piece of software is _hard work,_ and I'm grateful for the literature its maintainers provide about its ins and outs; it's not as comprehensive as the Rails guide, but Rails has also been downloaded over 295 million times (from Rubygems, which is not where Rails was hosted for the first 45 versions it had) to Phoenix's 56 million total downloads. Bear witness to the network effect in action, people.

[^4]: "Regular" in terms of once the data is smoothed out for irregularities, of course

[^5]: I know it's not the abbreviation I'm just trying to be funny. I'm just trying to be funny, y'all 😢