Building a chat app in 8 minutes with Phoenix
elixircasts.io
elixircasts.io
I have a lot of prior Rails / Flask experience and minimal Elixir experience but you can still figure things out for the most part.
It's kind of funny but, even at this Elixir newbie stage I feel more confident reading and tracing most Elixir code vs Ruby.
And when it comes to performance, threads and queueing, not having to deal with duct-tape and gum solutions like Resque (Ruby's "One Ring" (I love it and I hate it)) makes such a big difference.
The best tools are the ones you don’t even notice, and Elixir is an absolute pleasure. You get to focus on the problem with little ceremony. Chat is a really interesting application of Channels, too.
It’s especially interesting to me as my team and I are working on a hosted API called Chatkit that makes it equally easy to add real-time chat to your applications, no matter what technology you’re using: https://pusher.com/chatkit
In addition to basic chat data, we also manage, “Who’s online”, typing indicators, rich media... And more
I highlight those features in particular because I am especially curious what that would look like with Elixir and Pheonix? Managing chat data, especially at scale is quite a hairy problem.
By the way, it simple/clean to subscribe to Elixir Channels on other platforms like Android and iOS, for example? One place we think we can add a lot of value is X-platform client SDKs (JavaScript, Kotlin, Swift, etc.)
Also the Phoenix channel implementation uses CRDTs behind the scenes from what I gather. They make problems like user presence much more tractable [2].
1: https://blog.discordapp.com/scaling-elixir-f9b8e1e7c29b 2: https://github.com/phoenixframework/phoenix/blob/master/guid...
https://opkode.com/blog/slacks-bait-and-switch/#comment-3799...
As far as native platform clients, we have all major channel clients covered across community libs – Swift/objc/Java/C#
Elixir & phoenix are fun though. I really like how much easier it is to test an elixir app (functional language).
For example, when I last read through the codebase it was common to find features that simply wouldn't work, because the code referenced hardcoded parts of the sample application.
You'll also going to run into a lot of issues trying to migrate off of Coherence if you ever need to support anything other than form based username / password login.
I think it really is worth the effort to go with Ueberauth [0]. You'll need to do more work upfront, but the maintainability gains will quickly pay off. You can even use :ueberauth_identy [1] to provide username / password based auth without too much trouble.
I don't agree about ueberauth though. It assumes too much knowledge on the part of the developer, and is insufficient if one is looking for a "plug and play" authentication solution. I used it with Guardian but in the end moved away from it because using JWTs for authentication is just not a good idea.
Ueberauth definitely isn't a turnkey solution, but I'm not convinced that turnkey solutions for authentication are possible for real use cases. It's only going to be so long before you run into a customer that needs to integrate you into their SSO provider, and even Devise isn't going to help you then.
What Ueberauth needs, in my opinion, is a hex, built on ueberauth_identity, that adds support for everything people have grown accustomed to from Devise, like password resets, out of the box. You'll still need to do the manual work of mapping credentials to your user resource, but at least you'll be leaving yourself open to eventually supporting other authentication methods, without too much carrying cost in the meantime.
Elixir will get there eventually though :)
Some concepts are a bit weird like GenServer but it completely decouples your application from your state.
Writing tests was intuitive and one of the few times I’ve been doing TDD that really felt faster than manual testing.
https://pragprog.com/book/lhelph/functional-web-development-...
https://medium.com/@Stephanbv/elixir-phoenix-build-a-simple-...
EDIT: This comment was not appropriate, I apologize.
I don't think it does. It shows something implemented quickly, suggesting that it's a tutorial you can sit down and follow in one go.
This title is misleading.
Install a chap app in 8 minutes would be more appropriate, although really it's just sensationalism.
I think it just implies that the reader can do it without prior knowledge, and that Y minutes is surprisingly small.
You wouldn't write "build a blog in 80,000 minutes" even if it could be done with one line of code. And you wouldn't write "build [complicated thing] 3 minutes" and then show an expert rapidly typing a pre-determined program into an editor.
If a newbie can do it in Y minutes following the tutorial, it seems valid to me.
In the talk by Chris Bell, (29:15) they use Flow to migrate millions of records.
GenStage specifically: we needed an internal load tester and GenStage plus easy concurrency allowed to quickly build an effective and reliable tool with rate control
It lets us super easily manage things like rate limiting and throttling, while providing backpressure so that an influx of scans (or scans on large APIs) won't overload our infrastructure.