Why I selected Elixir and Phoenix as my main stack
Publish Date: Jan 21 '23
30 11
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 (2010), ProcessWire (2014) and Laravel (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.jsSvelte, and then other project using Laravel, Inertia and React. 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.
My first option other than PHP was using Swift and Vapor. 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
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 is a wonderful Python 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.
Inertia is a new approach to building classic server-driven web apps. From their own web page:
Inertia allows you to create fully client-side rendered, single-page apps, without much of the complexity that comes with modern SPAs. It does this by leveraging existing server-side frameworks.
Inertia requires an adapter for each backend framework. This repo contains the Masonite server-side adapter for Inertia.js
You can find the legacy Inertia PingCRM demo with Masonite here demo (WIP).
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.
Cons
I did not like the way Python manage it dependencies, having so many options like Poetry or Pipenv, it feels non standarized as other languages.
Many of the available jobs for Python that I could find were either for Django 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, so maybe I could use it professionally I guess?. There were many options to choose from. DropWizard, Spark, Play Framework. But the more documented one in the internet I found was Springboot, 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
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 at the frontend, why not use it at the backend?. I tried Adonis.js because it was similar to Laravel, but felt odd to me. Also a client once required some bridge and I used Fastify.
A replacement API for AirNotifier Moodle Plugin that connects directly to Firebase and other Push Notification Providers
AirNotifier Moodle Plugin Bridge
A replacement API for AirNotifier server for the AirNotifier Moodle Plugin that connects directly to Firebase, or others Push Notification Providers. This was made since newer versions of AirNotifier seems to be not working with the Moodle Plugin due to usage of old apis. This server implements all needed endpoints and acts as a middleware between Moodle AirNotifier Plugin and Push Notification Providers.
Installation
This server uses NodeJS instead of Python (Used by AirNotifier). Be sure to have NodeJS version >= 10 installed.
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 and the next one used Koa or Nest.
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 in Exercism and liked a lot the language. I found Phoenix framework 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.
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.
Even took a course with Grox.io's awesome teacher Bruce Tate, It was an awesome experience. Highly recommended.
Pros
Elixir is a fun language. functional 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 (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!.
Wonderful. I can feel many of these sentiments. Currently, I am trying to find a job, and I am intimidated by the current state of JS. Lots of entry level and college graduates trying their luck in the JS ecosystem. It has become overly competitive. It's hard to stay focused with too many libraries, frameworks, and tooling, plus the feeling of being outdated worries me a lot.
I am also a fan of Laravel and have developed a few of my clients' projects with it. I find it to be an absolute joy to be able to work with it. But the PHP ecosystem is losing momentum and getting a decent paying job (especially if you are from a third world country like India) is getting more difficult.
Not interested in Python either.
I will look into Elixir and see how it can help me to get a job. Aside from it, what other programming language would you recommend? Haskell? Clojure? Golang?
My main priority is to find a job in a less crowded programming language that has a bright future.
Ya, I am digging into Golang, but seems like people are ditching it in favor of Rust. I still have to find the cases where it outshine Rust. May be cloud application?
Not sure how good its for web development.
Golang is my least favourite language and makes me hate myself. The only place it outshines Rust is jobs. Very easy to get a high paying job in Go unlike Rust where you'll struggle to find jobs
Thanks for your comment!.
Elixir is surely a great investment. If you want to try other programming languages I recommend going functional using Erlang and maybe Gleam.
Rustler is a library for writing Erlang NIFs in safe Rust code. That means
there should be no ways to crash the BEAM (Erlang VM). The library provides
facilities for generating the boilerplate for interacting with the BEAM
handles encoding and decoding of Erlang terms, and catches rust panics before
they unwind into C.
The library provides functionality for both Erlang and Elixir, however Elixir
is favored as of now.
Features:
Safety - The code you write in a Rust NIF should never be able to crash the BEAM.
Interop - Decoding and encoding rust values into Erlang terms is as easy as a function call.
Type composition - Making a Rust struct encodable and decodable to Erlang or Elixir can be done with a single attribute.
Resource objects - Enables you to safely pass a reference to a Rust struct into Erlang…
Golang is a cool language, but I prefer to use tools that are not depending on corporations to maintain them (Java {Oracle}, C#/Typescript {Microsoft}, Swift {Apple}, Golang {Google}), if there are better alternatives. Here is an interesting article about that.
Also in concurrency, languages based in the Erlang VM are light years ahead, IMHO.
Thanks, my main concern is getting a job in less competitive programming language. I will check out all these options and will research a bit more. For now Elixir looks an ideal choice.
Assuming you've worked with TypeScript before at some point, how do you cope with lack of strong typing as compared to TypeScript? That's been the main thing that put me off putting more time into learning Elixir/Phoenix up to now
Wonderful. I can feel many of these sentiments. Currently, I am trying to find a job, and I am intimidated by the current state of JS. Lots of entry level and college graduates trying their luck in the JS ecosystem. It has become overly competitive. It's hard to stay focused with too many libraries, frameworks, and tooling, plus the feeling of being outdated worries me a lot.
I am also a fan of Laravel and have developed a few of my clients' projects with it. I find it to be an absolute joy to be able to work with it. But the PHP ecosystem is losing momentum and getting a decent paying job (especially if you are from a third world country like India) is getting more difficult.
Not interested in Python either.
I will look into Elixir and see how it can help me to get a job. Aside from it, what other programming language would you recommend? Haskell? Clojure? Golang?
My main priority is to find a job in a less crowded programming language that has a bright future.