
Phoenix 1.3.0 Released - chrismccord
http://phoenixframework.org/blog/phoenix-1-3-0-released
======
slashdotdash
For anyone curious about Phoenix and Elixir, I can sincerely recommend the
following resources to get you started:

\- Programming Phoenix by Chris McCord, Bruce Tate, and José Valim [1]

\- The Little Elixir & OTP Guidebook by Benjamin Tan Wei Hao [2]

\- Elixir in Action by Saša Jurić [3]

Phoenix initially attracted me to Elixir, I've stuck around for that and the
OTP platform: pattern matching, process based concurrency (actor model),
supervision, immutability, macros, and more.

"Elixir took the Erlang virtual machine, BEAM, and put a sensible face on it.
It gives you all the power of Erlang plus a powerful macro system." – Dave
Thomas

[1] [https://startlearningelixir.com/r/programming-
phoenix](https://startlearningelixir.com/r/programming-phoenix)

[2] [https://startlearningelixir.com/r/the-little-elixir-and-
otp-...](https://startlearningelixir.com/r/the-little-elixir-and-otp-
guidebook)

[3] [https://startlearningelixir.com/r/elixir-in-
action](https://startlearningelixir.com/r/elixir-in-action)

~~~
ezero
Another great resource that was recently released is the Phoenix Inside Out
series by Shankar: [https://shankardevy.com/phoenix-
book/](https://shankardevy.com/phoenix-book/)

I just got it a few days ago and I'm about 30% into the first book. What I can
say so far is that the author's approach resonates really well with me. Going
through the book feels like sitting next to a colleague, who is introducing
you to Phoenix and is really knowledgeable in the topic. The book is full of
interesting tidbits and explanations about Phoenix internals without getting
in the way. I also appreciate the TDD approach including both acceptance and
unit testing. The most important thing for me though, is how Shankar condensed
teaching Elixir into a single chapter. I have previously tried to study Elixir
a few times with the intention of eventually getting into Phoenix but I always
got overwhelmed by the OTP material. I didn't want to make the mistake of
trying to learn Rails before being comfortable with Ruby again so I put off on
learning Phoenix altogether. What Shankar has done is to dedicate one chapter
to teach just enough Elixir for you to get started. This was perfect for what
I needed and it was reassuring knowing exactly how much (or little) Elixir you
need to know before diving into Phoenix.

If you have previous experience in another MVC framework and are interested in
Phoenix I highly recommend this series (at least based on what I've read so
far).

I should note that the current version of the book is targeting Phoenix
v1.3.0-rc.2. Although Shankar has already made an announcement with the
intention to update the book soon after the officially 1.3.0 release.

~~~
Tomte
What is Garuda? Just a random title? A library/component in the Elixir
ecosystem?

It's a strange way to sell a book, when neither the web site selling the book
nor googling seem to enlighten me.

~~~
ezero
From the web site: "Create a mini-Phoenix framework using Elixir and Cowboy.
What can be the best way to understand Phoenix than to create it yourself."

Garuda, I'm sure after googling you found the Wikipedia entry for it. It is
just a play on words since Garuda, like Phoenix, is a type of mythical bird.

~~~
Tomte
Ah, I found the Wikipedia entry, but didn't make the connection with Phoenix.
Thanks!

------
s0l1dsnak3123
We’ve been using Phoenix at my company in production for over a year now. So
far the experience has been overwhelmingly positive, our team have totally
come round to its adoption, our server costs have come down and our response
times have gone down also.

Coming from Rails, the ecosystem isn’t quite there yet, but it is _far_ more
mature than rails’ was this early on.

The hardest thing for us has been deployment, but we’ve solved that
internally, including giving back by building exrm_deb (it works with
distillery too!) to compile the entire project into a Debian package.

If you haven’t already looked at Phoenix (and Ecto!) give it a try :)

~~~
bobwaycott
Releases as a .deb?! Awesome!

~~~
s0l1dsnak3123
You can have them as RPM as well if you are so inclined!
[https://github.com/smpallen99/exrm-rpm](https://github.com/smpallen99/exrm-
rpm)

------
bnchrch
I've been working professionally in Elixir/Phoenix for the past 4 months.

Summary: It's amazingly productive, pleasant to work with and simple.

Coming from a background spanning Python/Django, C#/.net and Node/Express I
really believe it blows them out of the water.

Thank you for all the hardwork of the Phoenix team and the amazing community
you've made.

~~~
GiorgioG
As a .NET developer by day, I'm curious what you like about Elixir over
C#/.NET? I have a copy of Elixir in Action on my nightstand, I just haven't
had a chance to crack it open yet.

~~~
bratsche
I wouldn't say I like things _over_ C#/.NET (I love C# and use it for
mobile/desktop devel, but I've never used it for web).. but I'll list some
things I like about Elixir:

Erlang's concurrency model is amazing. It's like having micro-microservices
running inside your virtual machine. And you can distribute across nodes.
Nothing else really has this kind of thing.

Pattern matching is beautiful and it's easy to use. Other languages have this
too, so it's not like this is unique. This is one of my favorite things
though; you can destructure things, you can pattern match inside a function
using case, and you can pattern match on functions themselves like:

    
    
        def say("Hi"), do: IO.puts("Hello")
        def say("Bye"), do: IO.puts("Goodbye")
        def say(_msg), do: IO.puts("Where am I?")
    

That's basically the equivalent of having a single say() function that then
does a switch/case on the input.

And a more recent addition to the language is "with". This is fantastic, it's
one of my favorite things now. Usually you might have code that sets a
variable from something, checks to make sure it's valid, sets another
variable, checks to make sure it's valid, etc, etc... until finally you're
function is ready to actually perform its purpose. Any of those checks might
cause it to exit early or to switch paths. So Elixir has this "with" feature
that looks sort of like this:

    
    
        def create(conn, %{"id" => group_id, "friend_id" => friend_id}) do
          with {:ok, user} <- current_user(conn, groups: [memberships: [:user, :group]]),
               {:ok, group} <- Groups.fetch_for_user(user, group_id),
               {:ok, friend} <- Friendship.fetch_friend(user, friend_id),
               {:ok, member} <- Groups.add_member(group, friend)
          do
            render(conn, "success.json", msg: msg)
          else
            {:error, msg} ->
              conn
              |> put_status(:unprocessable_entity)
              |> render("failure.json", msg: msg)
          end
        end
    

I love this feature. It makes code so much more readable and maintainable in
my opinion.

~~~
hhandoko
I believe these are referred to Railway-Oriented Programming. I've seen
several other examples for Elixir (incl. ones using macros), but by far this
is the 'cleanest' syntax :)

Here's a similar construct in Scala:

    
    
        (for {
          user   <- currentUser(...)
          group  <- groups.fetchForUser(...)
          friend <- friendships.fetchFriend(...)
          member <- groups.addMember(...)
        } yield {
          render(...)
        }).recover {
          case e: Exception -> ...
        }

~~~
glittershark
Or you could just call it what it is: a monad

~~~
ramchip
"Railway-Oriented Programming" is a lot more specific than "monad".

------
dmix
The directory reorganization is a good sign that Elixir/Phoenix are not simply
rehashing Ruby/Rails for the sake of popularity but are willing to prioritize
what makes the most sense for this particular language - and asking how they
can improve upon what already exists.

I recently ported my app from 1.2->1.3 and moving away from Models to
Contexts/Data was a simple transition that makes a lot of sense.

The `data` files (aka your new models) are basically where the schema for your
model lives and the `context` (your models API) is the interface for your
data.

For example when building a blog:

Instead of having User, Session, Post, and Comment models which contains your
DB schema, business logic, and interfaces for getting/setting data all models
directory ala Rails:

    
    
        blog/app/models/comment.rb
        blog/app/models/post.rb
        blog/app/models/session.rb
        blog/app/models/user.rb
        blog/app/controllers/...
        blog/app/views/...
    

you instead create a namespace for each group of data:

    
    
        lib/blog_app/accounts/accounts.ex
        lib/blog_app/accounts/session.ex
        lib/blog_app/accounts/user.ex
        lib/blog_app/blog/blog.ex
        lib/blog_app/blog/comment.ex
        lib/blog_app/blog/post.ex
        lib/blog_app/web/controllers/...
        lib/blog_app/web/views/...
    

And in your data file `lib/blog_app/blog/post.ex` for example, you'd keep just
your schema defining the fields like "title, permalink, body, etc" and code to
handle validations and virtual attributes.

Then in your context file `lib/blog_app/blog/blog.ex` you define the API that
access your data. So from your controller instead of calling:

    
    
        Post.all
        Comment.all
        Comment.find(1)
        User.new({..})
    

You now call:

    
    
        Blog.list_posts
        Blog.list_comments
        Blog.get_comment(1)
        Accounts.create_user({..})
    

It makes for a very logical structure for your MVC code.

------
softwarelimits
Phoenix is great! I only wish there was one recommended way for authentication
and authorization - there are so many [1] different libraries that I got stuck
in researching the options - I am confused, do not know which one to use. What
is your preferred way? I would like to avoid to implement every little detail
on my own - to get security done right was the main reason for me using open
source libraries.

It would be great if there was one official way to make it easier to implement
app security with the framework. I feel that this is the only missing part in
phoenix - but it is a very important one.

BTW: does anybody know some tool that generates a phoenix api from a json-
schema? Thanks!

[0] [https://github.com/h4cc/awesome-
elixir#authentication](https://github.com/h4cc/awesome-elixir#authentication)

~~~
sergiotapia
The beautiful thing about Phoenix framework is that there is no "one-true way"
to do things. Rails is omakase, Phoenix is not, and that's a good thing.

You want the whole enchilada? Use Guardian.

Need oauth? Use ueberauth.

Just want email and password? Use comeonin to hash your password.

It's liberating to know exactly how your system works and that it's not hidden
behind some magical blackbox like Devise.

~~~
crisopolis
Guardian is annoying to setup but works for me. I just want something that
generates JWT and takes a JWT.

~~~
dgjuuff
I've been using Joken for that (JWT), just finished writing up some code that
integrates with Auth0 and pulls in the signing certificate from the auth0
domain (.well-known/jwks.json).

------
fareesh
I'm spending all my free time with Phoenix. I come from a Rails, Laravel,
Django and a bit of .NET Core background. So far I am extremely impressed. I'm
surprised it has not been adopted by that many folks in production.

~~~
dopeboy
I'm a django guy. I have no experience with functional programming.

What would a transition to phoenix + elixir look like for me?

~~~
dqv
You'll have a phase of disorientation where you'll be wishing you had x
feature in Django and the reverse where you'll wish you had y feature in
Phoenix/Elixir.

The thing I really miss from Django is the admin scaffolding. Phoenix just
isn't there. In practice, you could continue to use Django as a front-end.

I moved away from Django when the recurring question of "this is neat, but how
do I make it keep going no matter what?"

~~~
abledon
Could you give some examples of 'neat' things that needed to keep going no
matter what on django (thus switching to Phoenix)

~~~
dqv
I should have said Python instead of Django.

The problem is that I was/still am a rookie of a programmer. I could not wrap
my head around async in Python. I just wasn't getting it. I had a nagging
sense that it was going to fail in the middle of the night and there was
nothing I could do about it.

So, enter Elixir, which actually has a syntax that is kind of close to Python.
It made immediate sense. If you want to do something that can cause the
program to fail, do it in a process and send a message back with the result.
If the program spawning the process fails, the supervisor will restart it!

Sorry - back to your question - and this will probably disatisfy you, but the
answer is that everything was neat. It was just simple CRUD stuff, but doing
it in Python didn't feel "robust" enough.

I'm fully aware that my reasons are superficial, but the way Elixir works has
made me way more confident as a programmer.

~~~
0xADEADBEE
This isn't your fault. Python doesn't get the asynchronous stuff particularly
right, nor does it make it as straightforward as it should. I've moved to
Elixir and one of my employers has moved to Go as a direct result of Python's
concurrency model (and the hilariously needless and recondite primitives
attached). Your reasons aren't particularly superficial; I'd pick the Actor
model over systemd and uWSGI for anything critical!

------
srjilarious
Really excited to see this out. I've been learning Elixir and Phoenix with the
1.3rc and have really been enjoying it!

I'm a fan of Contexts myself as that is typically how I architect apps on
mobile as well. I like having everything separated more explicitly and
testable individually and Contexts seem to promote that in a really nice way.

------
tiffanyh
Wow.

In the past few weeks:

\- Erlang/OTP 20 released,

\- Elixir 1.5 released

And Cowboy 2.0 is in Release Candidate phase.

Exciting times.

------
digitalzombie
Gonna do phoenix for a side project.

I'm just a bystander reading about erlang and elixir for awhile. Did web dev
in php and a little bit of nodejs.

But I think what you guys doing are great. I'm glad Elixir and Phoenix came
about it really helps drive the language into a field (web dev) and get people
to notice.

And that one implementation of figuring out how people is log off or not that
is in Phoenix was really sweet when you presented it.

------
playing_colours
Would you suggest to choose Elixir / Phoenix for an api for a startup? Is it
too risky now, or good enough + very attractive?

~~~
qaq
It's used by fairly big projects/Companies bet365, Bleacher Report, New
Relic,Discord, PagerDuty, Puppet labs, FireEye etc.

~~~
brightball
I had not heard New Relic was using it

~~~
qaq
[https://elixirforum.com/t/senior-software-engineer-new-
relic...](https://elixirforum.com/t/senior-software-engineer-new-relic/2258)

------
gregpardo
I actually love the domain driven work done in this release. I think it was a
bold move from the team and breaks them even further away from Rails on EVM
that people tend to think.

I have been bit so many times with trying to figure out where to put things
like authentication/registration in a traditional MVC rails like app.

------
jrs95
I've always been intrigued by Phoenix/Elixir but I was worried it may just be
a fad. Seems like it's had solid growth over the last couple years though, so
I may end up diving into it over the weekend.

------
Tistel
We are using Elixir and Phoenix. Its amazbalz. The properties of the erlang VM
(100k processes, individually garbage collected etc) are going to make it a
killer platform. (edited)

------
misterbowfinger
Are there any "here be dragons" for Phoenix? Does it play well with legacy
systems? Support for different protocols, etc.

~~~
cutler
I don't think Elixir has production-level support for gRPC which is a bit of a
deal-breaker for me.

~~~
Ndymium
There seem to be plenty of gRPC libraries for Erlang though, according to a
quick googling.

------
brightball
Great news! Been waiting for this so I could tinker and then make a pitch to
my office where I think it's an ideal fit.

------
samtechie
Does Phoenix 1.3.0 fully support Elixir 1.5? I keep getting warnings when
compiling since I upgraded to Elixir 1.5.

~~~
pmarreck
It does. You may also need to upgrade your mix dependencies, I'm sure many of
their authors are busy fixing the deprecation warnings as I type

------
neya
I use Phoenix with all my newer projects. The performance is stellar. I
single-handedly was able to create what many startups out there have built
with 100s of thousands of engineers[1] in a short period of time. This may be
possible with Rails too, but then, I found a lot of things are much more
convenient to get done in Phoenix than in Rails - For example, Contexts
(nested models), Routes, etc.

When I started with Phoenix I was anxious that the experience was going to be
just like when I first tried out Play/Scala, but no. To my surprise, my
experience was fantastic. Truly, this framework allows you to focus on your
business problems rather than fighting with configurations/conventions.

One of the best decisions the team has made is introducing the concept of
contexts from DDD[2]. Initially, I was pretty confused, but now, I simply
cannot imagine myself going back once that I've understood it. It's basically
breaking down your business into smaller tiny modules, like I've done in [1].
The other thing I love about Phoenix is the concept of umbrella applications.
I'm not sure if Rails has an equivalent, but I think this alone is worth
exploring Phoenix for.

I don't even have micro-services in my architecture yet, but because of these
patterns, I'll be able to break out and scale my application if I require to,
in the future.

Phoenix has proven to me that it can not only scale performance-wise, but also
architecture-wise. Last time I tried developing [1], it was in PHP and I had
to hire 5 devs to get it done..6 months later and we still weren't done.
However, in just a matter of weeks, I was able to finish a complete working
prototype of this mammoth application, with UI and frontend. As for my
production setup, I use Docker + AppEngine (using a custom VM) and it has
served me really well. The performance is top notch and everything works so
flawless.

As for the language itself, I really love Elixir. I simply cannot imagine
going back. It really forces you to think differently about your code. Last
time I tried to learn a functional language, it was Scala - also a beautiful
language on top of the JVM. But, the problem is, it's so academic in the sense
that even a good book on scala had 400+ pages. Some of them had 700+ pages.
But Elixir isn't like that, you can pick up the language in a matter of weeks
(YMMV, it took me 2) AND build a project in no time.

For Elixir, if you're coming from a Ruby background, you'll be able to pick it
up fairly easy. However, you will find it challenging when you hit a situation
where you would have used a traditional for loop, but in Elixir, you would be
forced to re-architect your code. And that's a good thing.

[1]
[https://news.ycombinator.com/item?id=14785209](https://news.ycombinator.com/item?id=14785209)

[2]
[https://martinfowler.com/bliki/BoundedContext.html](https://martinfowler.com/bliki/BoundedContext.html)

~~~
dvlsg
Interesting. I've been trying to decide which language to learn next. Between
Scala, elixir, and haskell at the moment. Was leaning Scala, but all the
praise here is starting to convince me to go elixir. What problems did you run
into with Scala?

~~~
neya
In Scala, there are many ways to write a function. I wish I can share some
code snippets, but, I'll just summarize for the sake of simplicity:

1) Functions have different forms and even nomenclature based on how many
parameters they accept, how they are represented, etc.

2) Scala still has OO, which means it needs to carry a lot of baggage. The
breadth of Scala's nomenclature combined with OO will take you a long way to
learn the language.

3) Scala still runs on JVM which means you need to learn some of the JVM
concepts if you'll be using it in prod. If you're from a Rails background,
this is completely a new arena, because this is usually the Java guys' arena.

4) I wanted to be able to simply open up the source code and be able to
understand what's happening. This was possible in Ruby/Rails, and ultra easy
to do in Phoenix/Elixir, but painful in Play/Scala. IF you open up the source
code of a Play! framework project, there's code so succinct that you would
need to be strong with the language's understanding to get the full picture.
Case class, implicit, etc., just to cite a few. In Elixir/Phoenix, it's just
modules and it's just simple, yet elegant.

5) That being said, it's still good to learn Scala because there are tons of
libraries out there with special use cases which you can use Scala for - It's
still a good strongly typed language to build a robust project on. IF I
remember correctly, David Pollak mentioned in his book that he'd written an
app in Scala that ran for years without any problems.

As for Haskell, I read this somewhere - "Haskell is nice and all, but it's no
Erlang." Since Erlang also has a bit of a learning curve, the next best
alternative is Elixir.

P.S, - languages should be chosen based on one's own philosophy and in this
case, Elixir strongly resonates with my own philosophy and all this is just my
own opinion on why I chose it :)

Cheers.

~~~
bostonvaulter2
> I wanted to be able to simply open up the source code and be able to
> understand what's happening. This was possible in Ruby/Rails, and ultra easy
> to do in Phoenix/Elixir

While it is possible to look at source code in Ruby/Rails, in practice for me
(even after a few years of production ruby experience) it was extremely
painful to look at any number of libraries due to the amount of redirection
and implicit state, and monkey patching. But Elixir has (almost always) been
VERY easy to follow, sometimes the code is just so simple.

------
jaequery
It's truly amazing when you see the numbers yourself, as Elixir/Phoenix
produces some wicked TTFB(time to first byte) speed and concurrent
performances you can't get from other languages.

I wouldn't be surprised to see one elixir server replacing 5x - 10x servers.

~~~
renrutal
In some cases, more like 30x - 75x:

[http://www.techworld.com/apps-wearables/how-elixir-helped-
bl...](http://www.techworld.com/apps-wearables/how-elixir-helped-bleacher-
report-handle-8x-more-traffic-3653957/)

------
jonathanreinink
Been following Phoenix for a while now. It looks amazing! One small complaint:
the lack of code highlighting in the documentation really bugs me.

------
Kiro
How are people hosting their Phoenix projects? I'm used to Heroku or Laravel
Forge. I don't really want to mess too much with servers.

~~~
bostonvaulter2
Phoenix works well on Heroku:
[https://hexdocs.pm/phoenix/heroku.html](https://hexdocs.pm/phoenix/heroku.html)

I also want to try gigalixir which has a free tier:
[https://gigalixir.com/](https://gigalixir.com/)

~~~
pmarreck
Note that Heroku has some drawbacks with regards to Elixir:

1) Daily restarts, which kill any app-side state such as a cache or ETS table

2) Can't take advantage of any clustering

3) Can't do hot upgrades

------
kornish
Does anyone have any favorite open-source Phoenix codebases?

~~~
reledi
[https://github.com/thechangelog/changelog.com](https://github.com/thechangelog/changelog.com)

------
Gaelan
I had to switch to the home page and go below the fold to figure out what
Phoenix _was_ (a web framework in Elixir).

------
out_of_protocol
Quote interesting release, many useful features. `action_fallback` looks
really nice. Contexts ... not so much imo

~~~
the_angry_angel
> Contexts ... not so much imo

I'll prefix my comment by saying I'm someone who is more on the sysadmin side
of the scale of things. My code isn't pretty, but it generally works well
enough to get the job done. I'm learning (probably the most important thing, I
guess).

Contexts are one of things that I felt the same about. Until I tried really
using them, rather than stressing over whether or not I was using them
properly.

I made the mistake of trying to think of them as microservices, which bogged
me down and for my purposes was complete overkill. I've now reached a kind of
happy medium, which I've realised that I really should have already been
using. I've kinda realised I suck at api design. And for that I'm very
thankful to the phoenix team, because it feels like I'm learning.

------
desireco42
Oh finally! I've been using RC for quite a while now. Glad it is out.

------
richjdsmith
Awesome work Chris, thanks for everything you and the team are doing!

------
ranyefet
Thanks for the hard work! Looking for to upgrade

------
miguelrochefort
How is it better than F# and Akka.NET?

~~~
nobleach
I wouldn't say "better". Like any other framework, many things have to be
weighed. In the case of F#, it's a fantastic language with a fantastic
runtime. It is still "windows only"* for the moment though. Akka (and yes, I
realize that you mentioned .NET) is also very good in its varieties. Scala
being one of the ones that I've actually used. I believe where the sweet-spot
is for Elixir, in general is that Rubyists will feel mostly at home. The
language itself is just very, very nice. Phoenix continues this by copying
some of the nice ideas from Rails. But again, It's not better than the
language and tech that you mentioned, but it fits a certain swath of
developers. I wouldn't recommend someone who is well versed in F# with
Akka.NET drop what they're doing to migrate.

*Yes, I'm aware of Mono, but I've been completely unhappy with my experience using it.

------
charleshan
Awesome, nice work!

