Elixir

Build Interactive Phoenix LiveView UIs with Components

LiveView empowers developers to build interactive, single-page web apps with ease by providing a framework that eliminates the need for guesswork. In this post, we'll take a look at how you can layer simple, single-purpose functional components to wrap up shared presentation logic. We'll also use more sophisticated live components to craft easy-to-maintain single-page flows that handle complex user interactions.

8 Common Causes of Flaky Tests in Elixir

Flaky tests are like meme stocks — many people have them, but no one knows what to do with them. Today, we will change that by diving into some common causes and, more importantly, solutions for flickering tests in Elixir. Elixir has many great primitives that let us run tests asynchronously, including immutable data, lightweight processes, and the Ecto SQL sandbox. Running tests asynchronously can greatly speed up your test suite, but can also increase the chance of flaky tests.

Three Ways to Debug Code in Elixir

Elixir provides a very powerful suite of tools that devs can use to observe the behavior of their code and debug errors. There are several different strategies you can use to debug code in Elixir. While it is hard to produce a comprehensive list of all possible debugging methods, we will cover some of the most common methods in today’s post.

Authorization and Policy Scopes for Phoenix Apps

Authorization (not to be confused with authentication) is vital to every application but often isn’t given much thought before implementation. The IETF Site Security Handbook defines authorization as: So, in short, authorization is about defining access policies and scoping. For example, consider a platform like Github.

How to Do Live Uploads in Phoenix LiveView

The LiveView framework supports all of the most common features that Single-Page Apps must offer their users, including multipart uploads. In fact, LiveView can give us highly interactive file uploads, right out of the box. In this post, we’ll add a file upload feature to an existing Phoenix LiveView application. Along the way, you’ll learn how to use LiveView to display upload progress and feedback while editing and saving uploaded files.

Under the Hood of Macros in Elixir

Welcome back to part two of this series on metaprogramming in Elixir. In part one, we introduced metaprogramming and gave a brief overview of macros. In this part, we will explore the inner workings and behaviors of macros in more depth. As discussed in the previous post, macros are compile-time constructs in Elixir. So, before diving into how macros work, it is important to understand where macros lie within Elixir’s compilation process.

Real-Time Form Validation with Phoenix LiveView

LiveView is a compelling choice for building modern web apps. Built on top of Elixir’s OTP tooling and leveraging WebSockets, it offers super-fast real-time, interactive features alongside impressive developer productivity. LiveView keeps the developer’s mind firmly rooted on the server-side, even when testing and debugging. This can empower you to deliver interactive features in single-page apps faster than ever before.