SlideShare a Scribd company logo
Playing with Elixir/Phoenix
Anton Sakharov, CTO @ MLSDev
Playing with Elixir/Phoenix
Playing with Elixir/Phoenix
Elixir / Phoenix
This talk is not about
Elixir syntax or Phoenix cool features
The best way to master new technology
or framework is
to develop something simple but
not useless
* IMHO
Internal company website: Quote Pad
● Post quotes
● View quotes (latest / best)
● Vote for quotes (like / dislike)
● Email subscription to new quotes
Features
Old Quote Pad
● Written in 2012 by iOS developer in order to learn Ruby on Rails
● Rails 3.2.6
● SQLite in production ¯_(ツ)_/¯
● Email/password authentication using Devise gem
● Non-responsive UI
● No moderation functionality
● No admin area/dashboard
New Quote Pad
● Elixir/Phoenix
● Authentication via Google Apps / G Suite / whatever they name it tomorrow
● Amazon RDS / PostgreSQL
● UI facelift, make it responsive
● Moderation, admin. dashboard, blah-blah-blah...
● Migrate data/content
Playing with Elixir/Phoenix
Learning curve
1. Elixir
2. Phoenix
3. Libraries
4. Deployment
5. …
6. PROFIT!!!
First steps
and things to avoid
Do not jump to Phoenix
straight away
Learn Elixir first
Playing with Elixir/Phoenix
https://elixir-lang.org -> GUIDES
Do not learn Elixir and
Phoenix by tutorials and
videos only
1. You'll stay a Script Kiddie
2. Tutorials are probably outdated
Playing with Elixir/Phoenix
This book is about Phoenix 1.2.
Current Phoenix is 1.3; 1.4 is about to be released
http://phoenixframework.org/
Before you go on ...
Playing with Elixir/Phoenix
Must-read documentation
● Elixir guides (mentioned earlier)
● Phoenix guides and docs
● Plug (Rack / Middleware in Rails world)
● Ecto (ActiveRecord in Rails world)
https://hexdocs.pm
Playing with Elixir/Phoenix
Pitfalls
● Do Elixir stuff non-Elixir way
● Do Phoenix stuff Rails-way
● Tend to OOP
● Erlang OTP gives you a lot out of the box, keep it in mind
● On the other hand, there are not that many
production-ready packages yet (like RubyGems)
Pitfalls
Do Elixir stuff non-Elixir way
Non-Elixir:
list = Enum.map(1..100_000, &(&1 * 3))
list = Enum.filter(list, odd?)
list = Enum.sum(list)
Elixir:
list =
1..100_000
|> Enum.map(&(&1 * 3))
|> Enum.filter(odd?)
|> Enum.sum
Elixir:
def sum_list([head | tail], acc) do
sum_list(tail, head + acc)
end
def sum_list([], acc) do
acc
end
Non-Elixir:
sum = 0;
for (i=0; i<sizeof(array); i++)
sum += array[i]
Do Elixir stuff non-Elixir way
Do Phoenix stuff kind of Rails-way
defmodule User do
schema "users" do
# ...
field :quote_count, :integer, virtual: true
end
# ...
end
# …
def list_users(user, params) do
page = User |> Repo.paginate(params)
# Don't do this ;)
%{page | entries: Enum.map(page,
fn u -> %User{u | quote_count: Quotes.user_quote_count(u)} end)}
end
OOP habits
user.update(%{role: "admin"}) # this is not Elixir ;)
Users.update(user, %{role: "admin"}) # this is!
What about background jobs ?
Playing with Elixir/Phoenix
Not too many production-ready stuff available yet
● from simple things like URL validators
● to advanced like Devise for Rails
Bodyguard
Authorize plug
Data migration
● dump SQLite database: `sqlite3 dbname.sqlite3 .dump > dump.sql`
● remove `AUTOINCREMENT`
● varchar(255) -> `CHARACTER VARYING(255)`
● datetime -> `TIMESTAMP WITHOUT TIME ZONE`
● ` (backtick) -> ' (single quote)
● '' (empty string) -> `NULL` for empty date/time
● ...
Playing with Elixir/Phoenix
Playing with Elixir/Phoenix
Deployment
● Distillery
● edeliver
● .env
● nginx in reverse proxy mode
● SSL certificate
● Docker
● AWS ECS
● …
● WAIT!
Playing with Elixir/Phoenix
Playing with Elixir/Phoenix
rel/config.exs
Playing with Elixir/Phoenix
Deployment pitfalls
● Erlang binaries: Mac OS X vs Linux
● Erlang versions: brew vs apt-get
Playing with Elixir/Phoenix
● t2.micro (1 GB RAM) fails to build Erlang from source:
virtual memory exhausted
● it takes sooooo long to build Erlang from source…
Deployment pitfalls
DEMO
Links
https://elixir-lang.org/
http://www.phoenixframework.org/
https://github.com/h4cc/awesome-elixir/
https://hex.pm
https://hexdocs.pm/
https://github.com/mlsdev/
Any questions?
Thank you!

More Related Content

PPTX
KEY
Make GUI Apps with Shoes
PPTX
Elixir Study Group Kickoff Meetup
PDF
Elixir and Phoenix for Rubyists
PDF
Ruby on Rails
PDF
Aniki has come
PPT
Automated Testing With Watir
PDF
Domain Driven Development applied
Make GUI Apps with Shoes
Elixir Study Group Kickoff Meetup
Elixir and Phoenix for Rubyists
Ruby on Rails
Aniki has come
Automated Testing With Watir
Domain Driven Development applied

Similar to Playing with Elixir/Phoenix (20)

PDF
Introduction to Elixir
PDF
The Ring programming language version 1.10 book - Part 7 of 212
PDF
Beyond JavaScript Frameworks: Writing Reliable Web Apps With Elm - Erik Wende...
PPT
Shell scripting - By Vu Duy Tu from eXo Platform SEA
ODP
Ample SDK: A tour de force
PDF
Flex And Rails
PDF
Intro to Elixir talk
PPTX
Elixir introduction
PPTX
Exploring SharePoint with F#
KEY
Wider than rails
ODP
Plug yourself in and your app will never be the same (1 hr edition)
PDF
Elixir introd
PDF
Exploring Clojurescript
PDF
Awesome Concurrency with Elixir Tasks
PDF
Introduction to meta-programming in scala
PDF
Introducing Elixir and OTP at the Erlang BASH
ODP
NYPHP March 2009 Presentation
PPTX
Why Ruby?
PDF
Zen and the Art of Code Maintenance
PDF
Erik Wendel - Beyond JavaScript Frameworks: Writing Reliable Web Apps With El...
Introduction to Elixir
The Ring programming language version 1.10 book - Part 7 of 212
Beyond JavaScript Frameworks: Writing Reliable Web Apps With Elm - Erik Wende...
Shell scripting - By Vu Duy Tu from eXo Platform SEA
Ample SDK: A tour de force
Flex And Rails
Intro to Elixir talk
Elixir introduction
Exploring SharePoint with F#
Wider than rails
Plug yourself in and your app will never be the same (1 hr edition)
Elixir introd
Exploring Clojurescript
Awesome Concurrency with Elixir Tasks
Introduction to meta-programming in scala
Introducing Elixir and OTP at the Erlang BASH
NYPHP March 2009 Presentation
Why Ruby?
Zen and the Art of Code Maintenance
Erik Wendel - Beyond JavaScript Frameworks: Writing Reliable Web Apps With El...
Ad

Recently uploaded (20)

PPTX
VVF-Customer-Presentation2025-Ver1.9.pptx
PDF
Design an Analysis of Algorithms I-SECS-1021-03
PDF
PTS Company Brochure 2025 (1).pdf.......
PDF
Navsoft: AI-Powered Business Solutions & Custom Software Development
PPTX
Operating system designcfffgfgggggggvggggggggg
PPTX
ai tools demonstartion for schools and inter college
PDF
medical staffing services at VALiNTRY
PPTX
CHAPTER 2 - PM Management and IT Context
PDF
Audit Checklist Design Aligning with ISO, IATF, and Industry Standards — Omne...
PDF
Understanding Forklifts - TECH EHS Solution
PPTX
Odoo POS Development Services by CandidRoot Solutions
PDF
System and Network Administration Chapter 2
PDF
Flood Susceptibility Mapping Using Image-Based 2D-CNN Deep Learnin. Overview ...
PDF
How to Migrate SBCGlobal Email to Yahoo Easily
PPTX
Agentic AI Use Case- Contract Lifecycle Management (CLM).pptx
PDF
EN-Survey-Report-SAP-LeanIX-EA-Insights-2025.pdf
PDF
Design an Analysis of Algorithms II-SECS-1021-03
PDF
SAP S4 Hana Brochure 3 (PTS SYSTEMS AND SOLUTIONS)
PDF
Internet Downloader Manager (IDM) Crack 6.42 Build 42 Updates Latest 2025
PDF
Nekopoi APK 2025 free lastest update
VVF-Customer-Presentation2025-Ver1.9.pptx
Design an Analysis of Algorithms I-SECS-1021-03
PTS Company Brochure 2025 (1).pdf.......
Navsoft: AI-Powered Business Solutions & Custom Software Development
Operating system designcfffgfgggggggvggggggggg
ai tools demonstartion for schools and inter college
medical staffing services at VALiNTRY
CHAPTER 2 - PM Management and IT Context
Audit Checklist Design Aligning with ISO, IATF, and Industry Standards — Omne...
Understanding Forklifts - TECH EHS Solution
Odoo POS Development Services by CandidRoot Solutions
System and Network Administration Chapter 2
Flood Susceptibility Mapping Using Image-Based 2D-CNN Deep Learnin. Overview ...
How to Migrate SBCGlobal Email to Yahoo Easily
Agentic AI Use Case- Contract Lifecycle Management (CLM).pptx
EN-Survey-Report-SAP-LeanIX-EA-Insights-2025.pdf
Design an Analysis of Algorithms II-SECS-1021-03
SAP S4 Hana Brochure 3 (PTS SYSTEMS AND SOLUTIONS)
Internet Downloader Manager (IDM) Crack 6.42 Build 42 Updates Latest 2025
Nekopoi APK 2025 free lastest update
Ad

Playing with Elixir/Phoenix