Unlimited Plugins, WordPress themes, videos & courses! Unlimited asset downloads! From $16.50/m

Next lesson playing in 5 seconds

Cancel

Free Preview: Get Started With Phoenix

Introduction

01:20
  • Overview
  • Transcript

Phoenix is a web framework for the up-and-coming Elixir language. With a server-side MVC pattern, it's similar to other web frameworks like Ruby on Rails or the Python framework Django. Phoenix is a new framework, though, with new ideas to make web development easier and safer.

In this course you will learn how to use the Phoenix framework and get an in-depth introduction to its key architectural concepts. You'll build a web app right through to deployment, and along the way you'll learn about how Phoenix handles template rendering, asset compilation, database integration, WebSockets, testing, and more!

If you've never used Elixir, watch our course Get Started With Elixir.

1. Introduction

1.1 Introduction

Phoenix is a web framework written in the Elixir language that uses a server-side MVC pattern. It is similar to other web frameworks, like Ruby on Rails, or the Python framework, Django, since they share similar concepts. It aims to provide higher productivity and higher application performance. And with Elixir under the hood, it is very capable of doing that. Hello, and welcome to Get Started with Phoenix. My name is Markus Muhlberger. And in this Envato Tuts+ course, we are going to look at the parts that make this function of that framework. I'm going to explain the overall architecture of a Phoenix 1.3 application and what changed from previous versions, since that was quite radical. I'm also going to guide you through the different concepts of the framework, like routers, controllers, templates, and views. There is a whole section about Ecto, a database wrapper and query generator, to teach you about schemas, queries, and more. Finally, we are looking into more advanced topics, like real-time updates for web circuits, testing, and deploying the app to Heroku. So, let's get started with learning the Phoenix web framework from the ground up.

1.2 Project Overview

Hi and welcome back to Get Started With Phoenix. In this lesson we are going to look at the finished course project. The app is called Band Manager, it will have a list of artists, albums, and songs that users can write. We're also going to add a web circuit connection, so the UI gets updated automatically when other people rate a song, and the rating changes. In this case, I've just rated a song of three. Ratings are calculated as a simple average of all votes. Editing bands, and adding albums, works in a traditional way by using a separate page with a form. But adding songs is done at the same time as adding the album as a simple multi line list. The app uses a PostgreSQL database in the background, and persists the data with an or and mappa called Hector. Now let's look at the code, the Phoenix app lives in the lib band manager web directory. You have the controllers, templates, and views in this folder, as well as the router. There is also a web circuit handler in the channels directory, this is how Phoenix calls it. All the domain logic lives in separate folders. In this case we have an artists domain, that takes care of albums, bands, and songs. And the rating domain, which is responsible for applying a rating to a song. To have to think about this separation by creating models makes you also think about the application structure, and possible extensibility. In our case we could use the rating for other items, not just songs. Each domain also has an API module that acts as an isolation layer. Controllers should only interact with the domains for this, and not deal with Hector directly. As always with my courses, every lesson has it's own commit, and is tagged with a lesson number. So you can start off anywhere without needing to write anything yourself, it has been done before this lesson. In the next lesson we are going to install Elixir and the Phoenix Framework together, and initialize the Band Manager application, see you there.