Why I selected Elixir and Phoenix as my main stack
Tags: elixir, webdev, beginners, programming
Published: 2023-01-21 16:16:04

This is just a personal journey documentation on how I decided to use my current tech stack.

Over the years I have tried different frameworks, mostly in PHP, like [Code Igniter](https://codeigniter.com/) (2010), [ProcessWire](https://processwire.com/) (2014) and [Laravel](https://laravel.com/) (2015).

They helped me complete different projects with diverse complexity. They are wonderful tools. But sadly most of the jobs I managed to land were using legacy versions of PHP and the codebase and developer experience was spartan to say the least. As an example in one project (2020) I had to connect to a remote Windows machine, edit the code in Notepad++ and then upload it using FTP. Odd workflows aside, I wanted to land more modern projects. So I embarked in a quest to find a new tech stack. 

First I wanted to update my tools, maybe I just needed a small patch instead of changing them. So I made a project for a client using Laravel, [Inertia.js](https://inertiajs.com/) [Svelte](https://svelte.dev/), and then other project using Laravel, Inertia and [React](https://reactjs.org/). I liked *Svelte* over *React*, so if future frontend projects appear, my main tool would be *Svelte*.

Both projects resulted in a superb improved developer experience and were finished in record time. A single monolith with backend and frontend did wonders because I did not need to create REST apis or GraphQL endpoints to make a fullstack system. Now I can have all the power of an SPA with all the good parts of a Backend, like direct access to a database.

I explored using *Inertia.js* as my main tool and made some adapters for ProcessWire, to understand better how it worked.

{% embed https://dev.to/clsource/inertia-adapter-for-processwire-3l6i %}

## Vapor (Swift)

My first option other than PHP was using [Swift](https://developer.apple.com/swift/) and [Vapor](https://vapor.codes/). I have made some projects with iOS and Objective-C, maybe I could also learn *Swift* and create both native iOS apps and backends with the same language.

But I discovered that it lacked the *Inertia.js* adapter, so I found this project 

{% embed https://github.com/lloople/vapor-inertia-adapter %}

and created an example

{% embed https://dev.to/clsource/vapor4-inertia-svelte-laravel-mix-3dh1 %}

### Pros

- Using *Xcode* to program a backend application was super nice, It was awesome to have an IDE with all the bells and whistles for the *Swift* language.


- Coming from *Objective-C* was helpful to understand the Apple ecosystem and workflows.

### Cons

- I often have to resort to other editors such as *VSCode* to edit non well supported files such as *JS*, *CSS* or *HTML* files.


- If you want to use *XCode* you need to use an updated operating system, if you have an older not supported Mac computer you will need to use *Docker* and use the *Linux* version of the *Vapor* framework, with poorer perfomance and developer experience due to using containers instead of *Xcode*.

## Masonite (Python)

[Masonite](https://docs.masoniteproject.com/) is a wonderful [Python](https://www.python.org/) framework, much similar to *Laravel* I found in 2018. I even chatted with Joseph about it in the old Slack channels, before the community moved to Discord.

{% embed https://dev.to/masonite/the-history-of-the-masonite-framework-2n2b %}

And there were some *Masonite* Inertia adapter too

{% embed https://github.com/girardinsamuel/masonite-inertia/ %}

### Pros

- I liked the way is well organized and the maintainer is super friendly.


- You can leverage all the wonderful tools that *Python* has like [PyCharm](https://www.jetbrains.com/pycharm/).

### Cons

- I did not like the way *Python* manage it dependencies, having so many options like [Poetry](https://python-poetry.org/) or [Pipenv](https://pipenv.pypa.io/en/latest/), it feels non standarized as other languages.


- Many of the available jobs for *Python* that I could find were either for [*Django*](https://www.djangoproject.com/) based projects or Machine Learning stuff I didn't like too much. So using *Masonite* would only be for green field type projects.

## Springboot (Java)

In university I learned a bit of [Java](https://www.java.com/), so maybe I could use it professionally I guess?. There were many options to choose from. [DropWizard](https://www.dropwizard.io/en/latest/), [Spark](https://sparkjava.com/), [Play Framework](https://www.playframework.com/). But the more documented one in the internet I found was [Springboot](https://spring.io/projects/spring-boot), besides there were some courses in spanish and some friends that knew something about *Springboot*, so I give it a chance.

I created some experiments like a simple Discord bot

{% embed https://github.com/NinjasCL/wrenbot %}

But I could not find an adapter to Inertia, just some *POC*, and I did not want to invest too much time in creating an adapter for it.

{% embed https://github.com/jrodalo/inertia %} 

### Pros

- Highly robust framework, lots of documentation, courses and examples.

- Super mature libraries and dependencies.

### Cons

- Most of the jobs I could find were for Banks and other "older" institutions. That have requirements such as going to the office (before C19) and even dress codes. I prefer to work remotely.

## JavaScript

I already use some [*Javascript*](https://www.javascript.com/) at the frontend, why not use it at the backend?. I tried [Adonis.js](https://adonisjs.com/) because it was similar to Laravel, but felt odd to me. Also a client once required some bridge and I used [Fastify](https://www.fastify.io/). 

{% embed https://github.com/NinjasCL/airnotifier-moodle-bridge %}

## Pros

- I already knew *Javascript* and made some small apis and scripts.

## Cons

- There are lot of different frameworks out there. If you learn one, there is no guarantee that the next job you find will use the same. For example if you learn [*Express*](https://expressjs.com/) and the next one used [*Koa*](https://koajs.com/) or [*Nest*](https://nestjs.com/).

- Already felt like a there were something wrong in *Javascript*, because there is always some breaking change that needs to rewrite the codebase or update the dependencies. I did not like that *npm* throws a lot warnings in the bootstrap of the project or installing deps.

## Elixir and Phoenix

Ok so I previously toyed around with [Elixir](https://elixir-lang.org/) in [Exercism](https://exercism.org/tracks/elixir) and liked a lot the language. I found [Phoenix framework](https://www.phoenixframework.org/) but I did not understand it quite well.

A functional language took time for me to understand the conventions and workflows. It was like a whole new world.

Nevertheless I just waited some time before going fulltime as an Elixir dev. Accepting small freelance jobs in PHP and other small projects. But I decided to write in my *CV*:

> "Would love to participate in Elixir based projects"

I really loved the idea of *LiveView* and how it wasn't needed a separate frontend framework to achieve a SPA like experience. So Inertia.js wasn't needed in the first place. 

Although an adapter is available, before *LiveView* was created.

{% embed https://github.com/devato/inertia_phoenix %}

In February 2022 I received my first offer as a fulltime Elixir developer, just because I said I liked to work with Elixir, no previous experience with it required!.

There I learned more deeply about *LiveView* and [Surface UI](https://surface-ui.org/).

Even took a course with [Grox.io](https://grox.io/)'s awesome teacher [Bruce Tate](https://twitter.com/redrapids), It was an awesome experience. Highly recommended.

### Pros

- Elixir is a fun language. **fun**ctional and **fun** to work with.

- Is easier to find good jobs and be selected, comparing it to other markets such as Javascript were there are more job opportunities, but also more people to compete with.

- The [Erlang](https://www.erlang-solutions.com/) (1986) ecosystem is older than Java (1995). So is filled with lots of robust solutions to real world problems, like concurrency. 

### Cons

- In my country there are few companies that uses Elixir (I hope that changes soon), but if you know english you can easily access international remote positions.

## Conclusions

Why I selected Elixir?. Because I found it fun, functional and robust. And I landed a dream like job just because I liked the language, compared to other technologies that I have to create a "doctoral thesis" just to be interviewed. Elixir's job seeking experience was smooth.

That first Elixir job finished in October 2022 and after some small vacations I landed another dream like job soon after.

Elixir is a powerhouse both in the Technology side of things and the Job market side of things.

For me is the technology of the 2020's decade and much more!.