WebDev with Phoenix

Alexander Tchitchigin

Positive Technologies

def loop(), do: loop()

Setup

Production

  • BEAM
  • Battle-tested framework
  • Batteries included
  • Secrets management

Not-Production

  • UI/UX
  • Authentication
  • Authorization
  • Internationalization
  • Testing

New Project

  • $ mix phx.new taskbuster
  • $ cd taskbuster

Project Setup

  • Edit dev.exs

  • $ mix deps.get # unless already run
  • $ mix ecto.create

Project Run

  • $ mix phx.server
  • or

  • $ iex -S mix phx.server

Accounts

  • $ mix phx.gen.html Accounts User users name:string username:string:unique email:string:unique password:binary
    
  • $ mix ecto.migrate

Tasks

  • $ mix phx.gen.html Tasks Task tasks title:string description:text owner_id:references:users assignee_id:references:users
    
  • $ mix ecto.migrate

Comments

  • $ mix phx.gen.html Comments Comment comments body:text author_id:references:users task_id:references:tasks
    
  • $ mix ecto.migrate

Channels

Via some manual labor. :)

End result

And that's all folks! :)

Introduction to Web Development with Elixir and Phoenix

By Alexander Letov

Introduction to Web Development with Elixir and Phoenix

  • 134