background preloader

Phoenix Framework

Facebook Twitter

Twitter OAuth Authentication with Elixir and Phoenix. There are a few good examples showing how to use OAuth authentication in Phoenix and Elixir, but I wanted a solution which used a small amount of dependencies, and had the ability to make authenticated requests on behalf of a user. parroty/extwitter provides the functionality to authenticate as a user, as well as to make requests on behalf of that user.

Twitter OAuth Authentication with Elixir and Phoenix

I wanted to just use this library, and avoid adding the additional dependencies of ueberauth and guardian. Full code is available at: Here’s a breakdown of some of the interesting parts: AuthController We start off authenticating via twitter in the request function. If the user authorizes, they will be redirected to our callback function with oauth information in the request parameters. Now that we can make verified requests, we call verify_credentials to ensure everything is kosher, and also to receive information about the user’s twitter account. > a Slack Clone with Elixir, Phoenix, and React (part 1 — Project setup) – Medium. Skip ahead: Part 2 — Live Demo — GitHub Repo Background: I have been a Ruby developer for a few years, and I recently began learning Elixir.

> a Slack Clone with Elixir, Phoenix, and React (part 1 — Project setup) – Medium

I am quickly falling in love with Elixir and the Phoenix framework, and am excited about the possibilities presented by these technologies. Much like what Rails did for Ruby, Phoenix is bringing Elixir into popularity because it enables developers to build fast, stable applications very efficiently, and makes it easy to work with real time data. At the time of writing, I have ~1 week experience with Phoenix. Similar to Rubber Ducky Debugging, I am writing this blog post to force myself to think differently about the problems I am solving and therefore gain a better understanding of the language and framework.

If you are totally new to Elixir, I recommend Programming Elixir, and Programming Phoenix, as they will describe the fundamentals much better that I can. What we’re building Tech Stack Backend. How-To Guide: The Phoenix Framework And Ember.js. In this guide I'll go over how to setup the Phoenix Framework as our back-end to an Ember.js front-end.

How-To Guide: The Phoenix Framework And Ember.js

We'll use JSON API with Phoenix and Postgres as our DB. I've been looking around for guides on using Phoenix with Ember and I thought the best way of learning would be writing my own. As I was writing this I found out it was incredibly easy to get something working in Phoenix fairly quickly. The only problems I ran into were getting some of the dependencies setup correctly. What I learned migrating a Rails app to Elixir/Phoenix. What I learned migrating a Rails app to Elixir/Phoenix I’ve been keen on Elixir for a while now.

What I learned migrating a Rails app to Elixir/Phoenix

For us at Made by Many the promise of the productivity of Ruby without compromising on raw performance and scalability is rapidly making it a prime candidate for our go-to server-side language of choice. Phoenix + React: love story. RePh 1. Phoenix + React: love story.

Phoenix + React: love story. RePh 1.

RePh 1. Hi, in this article I’m going to show you, how to create a fullstack app with React and Phoenix. There are already a few similar tutorials out there, however none of them shows process of development for a complete functional app with server-side rendering and routing. The article is about to fill the gap. In the first part we will create a basic (but yet functional) app which will copy standard Phoenix app layout and will include real-time statistics of visitors: number of total, online and max. online users. Complete app code is available at Github, every step lives in it’s own commit: Why you should use Elixir Phoenix. Sans titre. First, you bring in the Socket from the Phoenix.js client. import { Socket } from '.

sans titre

Stateless vs stateful web apps. Edit: We have got some great feedback that highlighted inaccuracies and unfairness in our post.

Stateless vs stateful web apps

We have amended the post accordingly but you can read the errata at the bottom. With Rails 5 soon to be released, many developers are planning to further explore Action Cable and add stateful features to their web applications via WebSockets. In this article we will highlight some points worth discussing when deploying such features. When we use HTTP, scaling horizontally and vertically is cheaper and easier as the server is stateless. Every request contains all the information for it to be fulfilled, like the current user id stored in a cookie, which is then fetched and processed. With WebSockets, instead of isolated requests, you have a long-running conversation. Deployment considerations Before moving forward, let’s try to put some numbers on how your application is affected once you go stateful.

Imagine you run a newspaper application and you render 100 articles per second. Internationalization using Gettext in the Phoenix framework. Written using Phoenix 1.1 Internationalization - what is it?

Internationalization using Gettext in the Phoenix framework

Internationalization (henceforth called i18n, because programmers are lazy and hate typing long words) is the process of adapting a web application for use in different languages or cultures. Any application that allows you to change your language has implemented i18n. It’s a close sibling of localization (L10n) - the process of actually implementing a different language/culture in a web app. Once support for i18n has been included in an app, it can be localized. For a concrete example, Facebook (at last count) supported 98 different languages - you can change your settings to use Facebook in such languages as Vietnamese, Italian, or Welsh; languages with entirely different character sets such as Russian, Hebrew or Arabic; or more esoteric choices such as Esperanto, Latin, Leet Speak, or English (Upside Down).

I18n with Linguist <h1>Welcome, <%= %>! You might write the following: Phoenix v1.1.2 and React.js. Trello clone with Phoenix and React (pt.1) Phoenix is Rails 5 — Infinite Red. Phoenix is Rails 5 Rails 5.0 is approaching, bringing with it niceties for websockets, backend-only API servers, and revamping the command layer.

Phoenix is Rails 5 — Infinite Red

Version 4.0 brought turbolinks, russian-doll caching, the queue API, and a host of improvements. All of these, except maybe turbolinks, were great new features but did not fundamentally alter the way applications are built in Rails. That’s good news! Phoenix is not Rails. In his yearly recap last December, Brian went public with his plans to transition the company over to Elixir and Phoenix development.

Phoenix is not Rails

Throughout this year, he found it was a smooth transition for the team going from primarily Rails to Phoenix powered applications. On the surface, Phoenix shares some familiar conventions with Rails that lets folks jump into new applications and contribute early to a project – on their way to greater mastery. Complete mastery will take a bit more practice than knowing a few shared conventions, but the similar-at-a-glance features has enticed Ruby teams to get involved and many are delighted to get up and running quickly. Unfortunately, it has also led to wrong assumptions about Phoenix's likeness to Rails, causing some to miss the important differences around their core philosophies.